GB/T 32960 协议网关

    1. 终端侧:通过 GB/T 32960 协议进行交换数据,实现不同类型的数据的上报,或者发送下行的消息到终端。
    2. 平台侧:emqx-gbt32960 将报文解码后执行 注册/鉴权、或将数据报文 PUBLISH 到特定的主题上;代理订阅下行主题,将下行的 PUBLISH 消息转化为 GB/T 32960 协议的报文结构,下发到终端。
    3. 其它侧,可以对 2 中出现的上行的 PUBLISH 消息的主题进行订阅,以接收上行消息。或对发布消息到具体的下行的主题,以发送数据到终端侧。

    打开 EMQX Dashboard (opens new window),点击左侧的 “模块” 选项卡,选择添加:

    image-20200927213049265

    选择 GB/T 32960 协议接入网关:

    配置相关基础参数:

    image-20200927213049265

    添加监听端口:

    配置监听参数:

    image-20200927213049265

    点击添加后,模块添加完成: image-20200927213049265

    约定:

    • Payload 采用 Json 格式进行组装
    • Json Key 采用大驼峰格式命名

    数据流向: Terminal -> emqx_gbt32960 -> EMQX

    车辆登入

    Topic: gbt32960/${vin}/upstream/vlogin

    1. "Cmd": 1,
    2. "Encrypt": 1,
    3. "Vin": "1G1BL52P7TR115520",
    4. "Data": {
    5. "ICCID": "12345678901234567890",
    6. "Id": "C",
    7. "Length": 1,
    8. "Num": 1,
    9. "Seq": 1,
    10. "Time": {
    11. "Day": 29,
    12. "Hour": 12,
    13. "Minute": 19,
    14. "Month": 12,
    15. "Second": 20,
    16. "Year": 12
    17. }
    18. }
    19. }

    Topic: gbt32960/${vin}/upstream/vlogout

    1. {
    2. "Cmd": 4,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Seq": 1,
    7. "Time": {
    8. "Day": 1,
    9. "Hour": 2,
    10. "Minute": 59,
    11. "Month": 1,
    12. "Second": 0,
    13. "Year": 16
    14. }
    15. }
    16. }

    信息上报

    Topic: gbt32960/${vin}/upstream/info

    整车数据

    1. {
    2. "Cmd": 2,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Infos": [
    7. {
    8. "AcceleratorPedal": 90,
    9. "BrakePedal": 0,
    10. "Charging": 1,
    11. "Current": 15000,
    12. "DC": 1,
    13. "Gear": 5,
    14. "Mileage": 999999,
    15. "Mode": 1,
    16. "Resistance": 6000,
    17. "SOC": 50,
    18. "Speed": 2000,
    19. "Status": 1,
    20. "Type": "Vehicle",
    21. "Voltage": 5000
    22. }
    23. ],
    24. "Time": {
    25. "Day": 1,
    26. "Hour": 2,
    27. "Minute": 59,
    28. "Month": 1,
    29. "Second": 0,
    30. "Year": 16
    31. }
    32. }
    33. }

    驱动电机数据

    1. {
    2. "Cmd": 2,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Infos": [
    7. {
    8. "Motors": [
    9. {
    10. "CtrlTemp": 125,
    11. "DCBusCurrent": 31203,
    12. "InputVoltage": 30012,
    13. "MotorTemp": 125,
    14. "No": 1,
    15. "Rotating": 30000,
    16. "Status": 1,
    17. "Torque": 25000
    18. },
    19. {
    20. "CtrlTemp": 125,
    21. "DCBusCurrent": 30200,
    22. "InputVoltage": 32000,
    23. "MotorTemp": 145,
    24. "No": 2,
    25. "Rotating": 30200,
    26. "Status": 1,
    27. "Torque": 25300
    28. }
    29. ],
    30. "Number": 2,
    31. "Type": "DriveMotor"
    32. }
    33. ],
    34. "Time": {
    35. "Day": 1,
    36. "Hour": 2,
    37. "Month": 1,
    38. "Second": 0,
    39. "Year": 16
    40. }
    41. }
    42. }

    燃料电池数据

    1. {
    2. "Cmd": 2,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Infos": [
    7. {
    8. "CellCurrent": 12000,
    9. "CellVoltage": 10000,
    10. "DCStatus": 1,
    11. "H_ConcSensorCode": 11,
    12. "H_MaxConc": 35000,
    13. "H_MaxPress": 500,
    14. "H_MaxTemp": 12500,
    15. "H_PressSensorCode": 12,
    16. "H_TempProbeCode": 10,
    17. "ProbeNum": 2,
    18. "ProbeTemps": [120, 121],
    19. "Type": "FuelCell"
    20. }
    21. ],
    22. "Time": {
    23. "Day": 1,
    24. "Hour": 2,
    25. "Minute": 59,
    26. "Month": 1,
    27. "Second": 0,
    28. "Year": 16
    29. }
    30. }
    31. }

    发动机数据

    车辆位置数据

    1. {
    2. "Cmd": 2,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Infos": [
    7. {
    8. "Latitude": 100,
    9. "Longitude": 10,
    10. "Status": 0,
    11. "Type": "Location"
    12. }
    13. ],
    14. "Time": {
    15. "Day": 1,
    16. "Hour": 22,
    17. "Minute": 59,
    18. "Month": 10,
    19. "Second": 0,
    20. "Year": 16
    21. }
    22. }
    23. }

    极值数据

    1. {
    2. "Cmd": 2,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Infos": [
    7. {
    8. "MaxBatteryVoltage": 7500,
    9. "MaxTemp": 120,
    10. "MaxTempProbeNo": 12,
    11. "MaxTempSubsysNo": 14,
    12. "MaxVoltageBatteryCode": 10,
    13. "MaxVoltageBatterySubsysNo": 12,
    14. "MinBatteryVoltage": 2000,
    15. "MinTemp": 40,
    16. "MinTempProbeNo": 13,
    17. "MinTempSubsysNo": 15,
    18. "MinVoltageBatteryCode": 11,
    19. "MinVoltageBatterySubsysNo": 13,
    20. "Type": "Extreme"
    21. }
    22. ],
    23. "Time": {
    24. "Day": 30,
    25. "Hour": 12,
    26. "Minute": 22,
    27. "Month": 5,
    28. "Second": 59,
    29. "Year": 17
    30. }
    31. }
    32. }

    报警数据

    1. {
    2. "Cmd": 2,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Infos": [
    7. {
    8. "FaultChargeableDeviceNum": 1,
    9. "FaultChargeableDeviceList": ["00C8"],
    10. "FaultDriveMotorNum": 0,
    11. "FaultDriveMotorList": [],
    12. "FaultEngineNum": 1,
    13. "FaultEngineList": ["006F"],
    14. "FaultOthersNum": 0,
    15. "FaultOthersList": [],
    16. "GeneralAlarmFlag": 3,
    17. "MaxAlarmLevel": 1,
    18. "Type": "Alarm"
    19. }
    20. ],
    21. "Time": {
    22. "Day": 20,
    23. "Hour": 22,
    24. "Minute": 23,
    25. "Month": 12,
    26. "Second": 59,
    27. "Year": 17
    28. }
    29. }
    30. }

    可充电储能装置电压数据

    1. {
    2. "Cmd": 2,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Infos": [
    7. {
    8. "Number": 2,
    9. {
    10. "CellsTotal": 2,
    11. "CellsVoltage": [5000],
    12. "ChargeableCurrent": 10000,
    13. "ChargeableSubsysNo": 1,
    14. "ChargeableVoltage": 5000,
    15. "FrameCellsCount": 1,
    16. },
    17. {
    18. "CellsTotal": 2,
    19. "CellsVoltage": [5001],
    20. "ChargeableCurrent": 10001,
    21. "ChargeableSubsysNo": 2,
    22. "ChargeableVoltage": 5001,
    23. "FrameCellsCount": 1,
    24. "FrameCellsIndex": 1
    25. }
    26. ],
    27. "Type": "ChargeableVoltage"
    28. }
    29. ],
    30. "Time": {
    31. "Day": 1,
    32. "Hour": 22,
    33. "Minute": 59,
    34. "Month": 10,
    35. "Second": 0,
    36. "Year": 16
    37. }
    38. }
    39. }

    可充电储能装置温度数据

    1. {
    2. "Cmd": 2,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Infos": [
    7. {
    8. "Number": 2,
    9. "SubSystems": [
    10. {
    11. "ChargeableSubsysNo": 1,
    12. "ProbeNum": 10,
    13. "ProbesTemp": [0, 0, 0, 0, 0, 0, 0, 0, 19, 136]
    14. },
    15. {
    16. "ChargeableSubsysNo": 2,
    17. "ProbeNum": 1,
    18. "ProbesTemp": [100]
    19. }
    20. ],
    21. "Type": "ChargeableTemp"
    22. }
    23. ],
    24. "Time": {
    25. "Day": 1,
    26. "Hour": 22,
    27. "Minute": 59,
    28. "Month": 10,
    29. "Second": 0,
    30. "Year": 16
    31. }
    32. }
    33. }

    Topic: gbt32960/${vin}/upstream/reinfo

    数据格式: 略 (与实时数据上报相同)

    应答数据流向: Terminal -> emqx_gbt32960 -> EMQX

    下行主题: gbt32960/${vin}/dnstream 上行应答主题: gbt32960/${vin}/upstream/response

    参数查询

    Req:

    Response:

    1. {
    2. "Cmd": 128,
    3. "Encrypt": 1,
    4. "Vin": "1G1BL52P7TR115520",
    5. "Data": {
    6. "Total": 2,
    7. "Params": [
    8. {"0x01": 6000},
    9. {"0x02": 10}
    10. ],
    11. "Time": {
    12. "Day": 2,
    13. "Hour": 11,
    14. "Minute": 12,
    15. "Month": 2,
    16. "Second": 12,
    17. "Year": 17
    18. }
    19. }
    20. }

    Req:

    1. {
    2. "Action": "Setting",
    3. "Total": 2,
    4. "Params": [{"0x01": 5000},
    5. {"0x02": 200}]
    6. }

    Response:

    1. // fixme? 终端是按照这种方式返回?
    2. {
    3. "Cmd": 129,
    4. "Encrypt": 1,
    5. "Vin": "1G1BL52P7TR115520",
    6. "Data": {
    7. "Total": 2,
    8. "Params": [
    9. {"0x01": 5000},
    10. {"0x02": 200}
    11. ],
    12. "Time": {
    13. "Day": 2,
    14. "Hour": 11,
    15. "Minute": 12,
    16. "Month": 2,
    17. "Second": 12,
    18. "Year": 17
    19. }
    20. }
    21. }

    终端控制

    命令的不同, 参数不同; 无参数时为空

    远程升级: Req:

    1. {
    2. "Action": "Control",
    3. "Command": "0x01",
    4. "Param": {
    5. "DialingName": "hz203",
    6. "Username": "user001",
    7. "Password": "password01",
    8. "Ip": "192.168.199.1",
    9. "Port": 8080,
    10. "ManufacturerId": "BMWA",
    11. "HardwareVer": "1.0.0",
    12. "SoftwareVer": "1.0.0",
    13. "UpgradeUrl": "ftp://emqtt.io/ftp/server",
    14. "Timeout": 10
    15. }
    16. }

    车载终端关机:

    1. {
    2. "Action": "Control",