Skip to content

Commit

Permalink
J2534_WIN: Factored out test boiler plate.
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondman committed Oct 15, 2017
1 parent f1583cd commit 3683bbf
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 221 deletions.
28 changes: 26 additions & 2 deletions drivers/windows/pandaJ2534DLL Test/TestHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,36 @@ void check_J2534_can_msg(PASSTHRU_MSG& msgin, unsigned long ProtocolID, unsigned
Assert::AreEqual<unsigned long>(ExtraDataIndex, msgin.ExtraDataIndex, _T("Wrong msg ExtraDataIndex"), pLineInfo);
}

unsigned long J2534_set_PASS_filter(unsigned long chanid, unsigned long ProtocolID, unsigned long tx,
unsigned long len, char* mask, char* pattern, const __LineInfo* pLineInfo) {
unsigned long filterid;
PASSTHRU_MSG mask_msg = { ProtocolID, 0, tx, 0, len, 0, 0 };
PASSTHRU_MSG pattern_msg = { ProtocolID, 0, tx, 0, len, 0, 0 };
memcpy(mask_msg.Data, mask, len);
memcpy(pattern_msg.Data, pattern, len);
Assert::AreEqual<long>(STATUS_NOERROR, PassThruStartMsgFilter(chanid, PASS_FILTER, &mask_msg, &pattern_msg, NULL, &filterid),
_T("Failed to create filter."), pLineInfo);
return filterid;
}

unsigned long J2534_set_BLOCK_filter(unsigned long chanid, unsigned long ProtocolID, unsigned long tx,
unsigned long len, char* mask, char* pattern, const __LineInfo* pLineInfo) {
unsigned long filterid;
PASSTHRU_MSG mask_msg = { ProtocolID, 0, tx, 0, len, 0, 0 };
PASSTHRU_MSG pattern_msg = { ProtocolID, 0, tx, 0, len, 0, 0 };
memcpy(mask_msg.Data, mask, len);
memcpy(pattern_msg.Data, pattern, len);
Assert::AreEqual<long>(STATUS_NOERROR, PassThruStartMsgFilter(chanid, BLOCK_FILTER, &mask_msg, &pattern_msg, NULL, &filterid),
_T("Failed to create filter."), pLineInfo);
return filterid;
}

unsigned long J2534_set_flowctrl_filter(unsigned long chanid, unsigned long tx,
unsigned long len, char* mask, char* pattern, char* flow, const __LineInfo* pLineInfo) {
unsigned long filterid;
PASSTHRU_MSG mask_msg = { ISO15765, 0, tx, 0, len, 0, 0 };
PASSTHRU_MSG mask_msg = { ISO15765, 0, tx, 0, len, 0, 0 };
PASSTHRU_MSG pattern_msg = { ISO15765, 0, tx, 0, len, 0, 0 };
PASSTHRU_MSG flow_msg = { ISO15765, 0, tx, 0, len, 0, 0 };
PASSTHRU_MSG flow_msg = { ISO15765, 0, tx, 0, len, 0, 0 };
memcpy(mask_msg.Data, mask, len);
memcpy(pattern_msg.Data, pattern, len);
memcpy(flow_msg.Data, flow, len);
Expand Down
6 changes: 6 additions & 0 deletions drivers/windows/pandaJ2534DLL Test/TestHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ extern std::vector<PASSTHRU_MSG> j2534_recv_loop(unsigned int chanid, unsigned i
extern void check_J2534_can_msg(PASSTHRU_MSG& msgin, unsigned long ProtocolID, unsigned long RxStatus, unsigned long TxFlags,
unsigned long DataSize, unsigned long ExtraDataIndex, const char* Data, const __LineInfo* pLineInfo = NULL);

unsigned long J2534_set_PASS_filter(unsigned long chanid, unsigned long ProtocolID, unsigned long tx,
unsigned long len, char* mask, char* pattern, const __LineInfo* pLineInfo = NULL);

unsigned long J2534_set_BLOCK_filter(unsigned long chanid, unsigned long ProtocolID, unsigned long tx,
unsigned long len, char* mask, char* pattern, const __LineInfo* pLineInfo = NULL);

extern unsigned long J2534_set_flowctrl_filter(unsigned long chanid, unsigned long tx,
unsigned long len, char* mask, char* pattern, char* flow, const __LineInfo* pLineInfo = NULL);

Expand Down
Loading

0 comments on commit 3683bbf

Please sign in to comment.