Libraries to support working with GMLAN - General Motors CAN BUS network in most of their vehicles between 2007-present day. Please note this is a work in progress and not guaranteed to be correct, use at your own risk! Read commit logs / subscribe to see what has been added, it's a work in progress after all ;)
Diff: GMLAN.h
- Revision:
- 6:32592425aa57
- Parent:
- 5:d0b067be6d44
- Child:
- 7:5ec65e6e8095
diff -r d0b067be6d44 -r 32592425aa57 GMLAN.h --- a/GMLAN.h Tue Mar 19 10:03:21 2013 +0000 +++ b/GMLAN.h Wed Apr 03 16:09:10 2013 +0000 @@ -96,4 +96,38 @@ CANMessage generate(void); }; +class GMLAN_11Bit_Request { + /* + Class to allow easier handling of sending and receiving 11-bit messages + */ + private: + vector<char> request_data, response_data; + int id, request_state; + int tx_frame_counter, tx_bytes; + int rx_frame_counter, rx_bytes; + + char frame_padding [8]; + + public: + // (Main function) Create message and send it + GMLAN_11Bit_Request(int _id, vector<char> _request); + + // Process each frame to transmit and flow control frame if needed + CANMessage getNextFrame(void); + CANMessage getFlowControl(void); + // Process each received frame + void processFrame(CANMessage msg); + + // Handle starting and flow control + void start(void) { request_state = GMLAN_STATE_SEND_DATA; } + void continueFlow(void) { request_state = GMLAN_STATE_SEND_DATA; } + + // Return request_state to confirm status + int getState(void) { return request_state; } + // Return ID + int getID(void) { return id; } + // Return response + vector<char> getResponse(void) { return response_data; } +}; + #endif \ No newline at end of file