OVMS3/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/ph2_commands.cpp

88 lines
3.0 KiB
C++

/*
; Project: Open Vehicle Monitor System
; Date: 19th Nov 2022
;
; (C) 2022 Carsten Schmiemann
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
; THE SOFTWARE.
*/
#include "ovms_log.h"
#include <stdio.h>
#include <string>
#include <iomanip>
#include "pcp.h"
#include "ovms_metrics.h"
#include "ovms_events.h"
#include "ovms_config.h"
#include "ovms_command.h"
#include "metrics_standard.h"
#include "ovms_notify.h"
#include "ovms_peripherals.h"
#include "ovms_netmanager.h"
#include "vehicle_renaultzoe_ph2_can.h"
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandPreHeat(bool climatecontrolon) {
//ToDo: Sniff TCU packets for preheat/cool, OVMS is connected on TCU port
return NotImplemented;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandWakeup() {
ESP_LOGI(TAG, "Send Wakeup Command");
vTaskDelay(500 / portTICK_PERIOD_MS);
uint32_t txid = 0x747, rxid = 0x767; //IVI
uint8_t protocol = ISOTP_STD;
int timeout_ms = 100;
std::string request;
std::string response;
request = hexdecode("2F90090301");
int err = PollSingleRequest(m_can1, txid, rxid, request, response, timeout_ms, protocol);
request = hexdecode("2F900900");
err = PollSingleRequest(m_can1, txid, rxid, request, response, timeout_ms, protocol);
if (err == POLLSINGLE_TXFAILURE) {
ESP_LOGE(TAG, "ERROR: transmission failure (CAN bus error)");
return Fail;
}
else if (err < 0) {
ESP_LOGD(TAG, "ERROR: timeout waiting for poller/response");
return Fail;
}
else if (err) {
ESP_LOGD(TAG, "ERROR: request failed with response error code %02X\n", err);
return Fail;
}
return Success;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandLock(bool climatecontrolon) {
//ToDo: Sniff HFM/BCM packets
return NotImplemented;
}
OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandUnlock(bool climatecontrolon) {
//ToDo: Sniff HFM/BCM packets
return NotImplemented;
}