From 21834035950feaadac9d4c7cad82b90ee624c984 Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期一, 17 八月 2020 19:30:06 +0800 Subject: [PATCH] 传感器变更 --- lib/src/main/cpp/master/comm_if.cpp | 81 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 74 insertions(+), 7 deletions(-) diff --git a/lib/src/main/cpp/master/comm_if.cpp b/lib/src/main/cpp/master/comm_if.cpp index c4c4bb6..1166297 100644 --- a/lib/src/main/cpp/master/comm_if.cpp +++ b/lib/src/main/cpp/master/comm_if.cpp @@ -62,7 +62,7 @@ #define ID_SM_LIGHT_EXAM_REQ 0x0012 #define ID_MS_LIGHT_EXAM_RES 0x8012 #define ID_SM_DISTANCE 0x0020 - +#define ID_SM_CARSENSOR 0x0013 #define MA_OUT_GPS_BRIEF 0x0001 #define MA_OUT_RTK_BRIEF 0x0002 @@ -262,12 +262,12 @@ writer.String(brief->version); writer.Key("selftest"); writer.Int(brief->selftest); - writer.Key("gpio"); - writer.Int(brief->gpio); - writer.Key("speed"); - writer.Int(brief->speed); - writer.Key("engine"); - writer.Int(brief->engine); +// writer.Key("gpio"); +// writer.Int(brief->gpio); +// writer.Key("speed"); +// writer.Int(brief->speed); +// writer.Key("engine"); +// writer.Int(brief->engine); writer.Key("sn"); writer.String(brief->sn); @@ -276,6 +276,73 @@ SendMsgToMainProcIndep(ID_SM_MCU_BRIEF, sb.GetString()); } +void MA_SendCarSensorBrief(const struct carSensorBrief *brief) +{ + StringBuffer sb; + Writer<StringBuffer> writer(sb); + + writer.StartObject(); + + writer.Key("odo"); + writer.Int(brief->odo); + writer.Key("trip"); + writer.Int(brief->trip); + writer.Key("trip_time"); + writer.Int(brief->tripTime); + writer.Key("cell_volt"); + writer.Double(brief->cellVolt); + writer.Key("engine"); + writer.Double(brief->engine); + writer.Key("sas"); + writer.Int(brief->sas); + writer.Key("key"); + writer.Int(brief->key); + writer.Key("gear"); + writer.Int(brief->gear); + writer.Key("aps"); + writer.Int(brief->aps); + writer.Key("lock"); + writer.Int(brief->lock); + writer.Key("seat_belt"); + writer.Int(brief->seatBelt); + writer.Key("clutch"); + writer.Int(brief->clutch); + writer.Key("horn"); + writer.Int(brief->horn); + writer.Key("wiper"); + writer.Int(brief->wiper); + writer.Key("hand_break"); + writer.Int(brief->handBreak); + writer.Key("main_break"); + writer.Int(brief->mainBreak); + writer.Key("left_turn_lamp"); + writer.Int(brief->leftTurnLamp); + writer.Key("right_turn_lamp"); + writer.Int(brief->rightTurnLamp); + writer.Key("clearance_lamp"); + writer.Int(brief->clearanceLamp); + writer.Key("dipped_beam_lamp"); + writer.Int(brief->dippedBeamLamp); + writer.Key("main_beam_lamp"); + writer.Int(brief->mainBeamLamp); + writer.Key("fog_lamp"); + writer.Int(brief->fogLamp); + writer.Key("assist_break"); + writer.Int(brief->assBreak); + writer.Key("surround1"); + writer.Int(brief->surround1); + writer.Key("surround2"); + writer.Int(brief->surround2); + writer.Key("surround3"); + writer.Int(brief->surround3); + writer.Key("surround4"); + writer.Int(brief->surround4); + + writer.EndObject(); + + SendMsgToMainProcIndep(ID_SM_CARSENSOR, sb.GetString()); +} + void MA_SendGpsBrief(const struct gpsBrief *brief) { if (!(OnOff & MA_OUT_GPS_BRIEF)) -- Gitblit v1.8.0