使用 CAPL 脚本从 CANOE 发送 SOME/IP 消息时,跟踪窗口中出现 SOME/IP 长度错误(但获取了正确的数据)。我想我遗漏了在 Canoe 中应该进行的任何设置。
有人能提出可能的原因吗?如何解决这个问题?用于发送 SOME/IP 消息的代码如下所示。
非常感谢您的帮助...
on key 'w'
{
DWORD messageId = 0x12340004; // service ID = 0x1234, method ID = 0x0004
DWORD requestId = 0; // client ID = 0, session ID = 0
DWORD protocolVersion = 1;
DWORD interfaceVersion = 1;
DWORD messageType = 0x2; // notification message
DWORD returnCode = 0; // not available
DWORD aep = 0; // application endpoint handle
DWORD messageHandle = 0; // handle of the created SOME/IP message
BYTE payload[5]; // the message payload
DWORD count = 0; // a simple counter
// initialize the payload
count = 0;
payload[count++] = 0x11;
payload[count++] = 0x22;
payload[count++] = 0x33;
payload[count++] = 0x44;
payload[count++] = 0x55;
// open application endpoint
aep = SomeIpOpenLocalApplicationEndpoint(17, 50002);
// create the SOME/IP message itself and set the message payload
messageHandle = SomeIpCreateMessage(messageId,requestId,protocolVersion,interfaceVersion,messagType,returnCode);
SomeIpSetData(messageHandle,elcount(payload),payload);
// send the SOME/IP message
SomeIpOutputMessage(aep,0xFFFFFFFF,40001,messageHandle);
// release the some IP message
SomeIpReleaseMessage(messageHandle);
}