J2534_WIN: Readded ISO15765 First Frame processing.
parent
bb3052da62
commit
346ff6a04d
|
@ -444,8 +444,8 @@ namespace pandaJ2534DLLTest
|
|||
j2534_recv_loop(chanid, 0);//Check a full message is not accepted.
|
||||
}
|
||||
|
||||
//Check tx and rx FAIL with a MISMATCHED filter. 29 bit. Mismatch Filter. NoPadding. STD address. Single Frame.
|
||||
TEST_METHOD(J2534_ISO15765_FailTxRx_29b_MismatchFilter_NoPad_STD_SF)
|
||||
//Check tx PASSES and rx FAIL with a MISMATCHED filter. 29 bit. Mismatch Filter. NoPadding. STD address. Single Frame.
|
||||
TEST_METHOD(J2534_ISO15765_PassTxFailRx_29b_MismatchFilter_NoPad_STD_SF)
|
||||
{
|
||||
unsigned long chanid;
|
||||
Assert::AreEqual<long>(STATUS_NOERROR, open_dev(""), _T("Failed to open device."), LINE_INFO());
|
||||
|
@ -454,11 +454,13 @@ namespace pandaJ2534DLLTest
|
|||
write_ioctl(chanid, LOOPBACK, 0, LINE_INFO());
|
||||
auto p = getPanda(500);
|
||||
|
||||
//TX
|
||||
Assert::AreEqual<long>(ERR_NO_FLOW_CONTROL, J2534_send_msg(chanid, ISO15765, 0, CAN_29BIT_ID, 0, 6, 0, "\x18\xda\xe0\xf1\x01\x00"),
|
||||
_T("mismatched address should fail to tx."), LINE_INFO());
|
||||
j2534_recv_loop(chanid, 0);
|
||||
panda_recv_loop(p, 0);
|
||||
//TX: works because all single frame writes should work (with or without a flow contorl filter)
|
||||
J2534_send_msg_checked(chanid, ISO15765, 0, CAN_29BIT_ID, 0, 6, 0, "\x18\xda\xe0\xf1""\x11\x22", LINE_INFO());
|
||||
auto j2534_msg_recv = j2534_recv_loop(chanid, 1);
|
||||
check_J2534_can_msg(j2534_msg_recv[0], ISO15765, CAN_29BIT_ID | TX_INDICATION, 0, 4, 0, "\x18\xda\xe0\xf1", LINE_INFO());
|
||||
|
||||
auto panda_msg_recv = panda_recv_loop(p, 1);
|
||||
check_panda_can_msg(panda_msg_recv[0], 0, 0x18DAE0F1, TRUE, FALSE, "\x02""\x11\x22", LINE_INFO());
|
||||
|
||||
//RX. Send ISO15765 single frame to device. Address still doesn't match filter, so should not be received.
|
||||
checked_panda_send(p, 0x18DAF1E0, TRUE, "\x06\x41\x00\xff\xff\xff\xfe", 7, 0, LINE_INFO());
|
||||
|
|
|
@ -112,7 +112,7 @@ void J2534Connection_ISO15765::processMessage(const J2534Frame& msg) {
|
|||
}
|
||||
case FRAME_FIRST:
|
||||
{
|
||||
/*if (msg.Data.size() < 12) {
|
||||
if (msg.Data.size() < 12) {
|
||||
//A frame was received that could have held more data.
|
||||
//No examples of this protocol show that happening, so
|
||||
//it will be assumed that it is grounds to reset rx.
|
||||
|
@ -129,9 +129,12 @@ void J2534Connection_ISO15765::processMessage(const J2534Frame& msg) {
|
|||
this->messages.push(outframe);
|
||||
}
|
||||
|
||||
this->rxConversations[fid] = FrameSet::init_rx_first_frame(((msg.Data[addrlen] & 0x0F) << 8) | msg.Data[addrlen + 1],
|
||||
msg.Data.substr(addrlen + 2, 12 - (addrlen + 2)), msg.RxStatus);
|
||||
this->rxConversations[fid] = std::make_shared<MessageRx>(
|
||||
((msg.Data[addrlen] & 0x0F) << 8) | msg.Data[addrlen + 1],
|
||||
msg.Data.substr(addrlen + 2, 12 - (addrlen + 2)),
|
||||
msg.RxStatus, filter);
|
||||
|
||||
//TODO maybe the flow control should also be scheduled in the TX list.
|
||||
//Doing it this way because the filter can be 5 bytes in ext address mode.
|
||||
std::string flowfilter = filter->get_flowctrl();
|
||||
uint32_t flow_addr = (((uint8_t)flowfilter[0]) << 24) | ((uint8_t)(flowfilter[1]) << 16) | ((uint8_t)(flowfilter[2]) << 8) | ((uint8_t)flowfilter[3]);
|
||||
|
@ -143,7 +146,7 @@ void J2534Connection_ISO15765::processMessage(const J2534Frame& msg) {
|
|||
|
||||
if (auto panda_dev_sp = this->panda_dev.lock()) {
|
||||
panda_dev_sp->panda->can_send(flow_addr, val_is_29bit(msg.RxStatus), (const uint8_t *)flowstrlresp.c_str(), (uint8_t)flowstrlresp.size(), panda::PANDA_CAN1);
|
||||
}*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FRAME_CONSEC:
|
||||
|
|
|
@ -3,11 +3,15 @@
|
|||
class MessageRx
|
||||
{
|
||||
public:
|
||||
MessageRx(unsigned long rxFlags) : msg(""), expected_size(0), flags(rxFlags) {
|
||||
//expected_size = final_size & 0xFFF;
|
||||
//msg.reserve(expected_size);
|
||||
//msg = piece;
|
||||
//next_part = 1;
|
||||
MessageRx(
|
||||
unsigned long size,
|
||||
std::string piece,
|
||||
unsigned long rxFlags,
|
||||
std::shared_ptr<J2534MessageFilter> filter
|
||||
) : expected_size(size & 0xFFF), flags(rxFlags) {
|
||||
msg.reserve(expected_size);
|
||||
msg = piece;
|
||||
next_part = 1;
|
||||
};
|
||||
|
||||
bool rx_add_frame(uint8_t pci_byte, unsigned int max_packet_size, const std::string piece) {
|
||||
|
|
Loading…
Reference in New Issue