|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区
您需要 登录 才可以下载或查看,没有账号?立即注册
×
展示部分代码,全部代码将整理后补充到网站,敬请留意!!!
// —————————————————————————————————————————————————————————————————————————— //
// describe:
// param-in:
// param-re:
// —————————————————————————————————————————————————————————————————————————— //
int main(int argc, const char * argv[])
{
EVSE_SYSTEM("###########################################################\n");
EVSE_SYSTEM("[%s %s by %s at %s] \n",PROJECT_NAME,VERSION,AUTHOR,TIME);
EVSE_SYSTEM("@ %s/bin/main edited at: %s %s \n", MODULE_NAME,__DATE__, __TIME__);
EVSE_SYSTEM("###########################################################\n");
SystemExecute.mission_manage();
pause();
exit(0);
}
static void interface_receive(uint8_t *data, uint16_t len)
{
int error = 0;
if (SystemExecute.get_sys_state() != SYS_CHARGING || SystemExecute.get_v2g_state() == V2G_READY)
return;
if (Handshake.is_evcc_online() == false && SystemExecute.get_v2g_state() == V2G_HANDSHAKE) {
if ((error = Handshake.decode(data, len, DECODE_HANDSHAKE_REQ)) != 0) {
error = Handshake.encode(false, ENCODE_HANDSHAKE_RES);
} else {
error = Handshake.encode(true, ENCODE_HANDSHAKE_RES);
Handshake.set_evcc_online(true);
SystemExecute.set_v2g_state(V2G_INITIALIZE);
}
} else {
switch (Handshake.get_matched_protocol()) {
case MATCHED_PROTOCOL_ISO15118_2014:
error = MessageManageOne.decode_document(data, len);
break;
case MATCHED_PROTOCOL_DIN70121_2012:
error = MessageManageTwo.decode_document(data, len);
break;
case MATCHED_PROTOCOL_ISO15118_2020:
error = MessageManageThree.decode_document(data, len);
break;
}
}
if (error != 0) {
EVSE_EVCC("decode or encode tcp stream failed # %d \n", error);
}
} |
|