SimOneV2XAPI 源代码

from SimOneIOStruct import *

SimOne_V2XInfoUpdateCbFuncType = CFUNCTYPE(c_void_p, c_char_p, c_char_p, POINTER(SimOne_Data_V2XNFS))

SIMONEAPI_V2XInfo_CB = None

def _api_v2xInfo_cb(mainVehicleId, sennsorId, data):
	global SIMONEAPI_V2XInfo_CB
	if SIMONEAPI_V2XInfo_CB is None:
		return
	SIMONEAPI_V2XInfo_CB(mainVehicleId, sennsorId, data)

simoneapi_v2xInfo_cb_func = SimOne_V2XInfoUpdateCbFuncType(_api_v2xInfo_cb)


[文档] def SoGetV2XInfo(mainVehicleId, sensorId, infoType, detectionData): """获得对应车辆编号V2X中的UPER编码之后的v2x消息\n Get V2X UPER ASN Message :param mainVehicleId: vehicle id :type mainVehicleId: string :param sensorId: sensor Id :type sensorId: string :param infoType: obu message type, in accordance with enum ESimOne_V2X_MessageFrame_PR :type infoType: int :param detectionData: V2XASN data :type detectionData: SimOne_Data_V2XNFS :return: executive outcome: success/faile :rtype: bool """ _mainVehicleId = create_string_buffer(mainVehicleId.encode(), 256) _sensorId = create_string_buffer(sensorId.encode(), 256) SimoneAPI.GetV2XInfo.restype = c_bool return SimoneAPI.GetV2XInfo(_mainVehicleId, _sensorId, infoType, pointer(detectionData))
[文档] def SoApiSetV2XInfoUpdateCB(cb): """获得对应车辆编号V2X中的UPER编码之后的v2x消息更新回调\n Register the callback function for applying V2X UPER ASN message :param cb: callback function for applying obu message: cb(mainVehicleId, sensorId, V2XNFSData) :type cb: function :return: executive outcome: success/faile :rtype: bool """ global SIMONEAPI_V2XInfo_CB SimoneAPI.SetV2XInfoUpdateCB(simoneapi_v2xInfo_cb_func) SIMONEAPI_V2XInfo_CB = cb