diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-06-20 10:24:05 +0000 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-06-20 10:24:05 +0000 |
commit | 32e25cbca210a359b09768537b6f443fe90a3070 (patch) | |
tree | 3309794c15d8a8f8e9c1c08cad072ee1378813ba /CAN-binder/libs/isotp-c/src/isotp/send.h | |
parent | 76c43dec62b2e21cd6446360c00d4fe6b437533f (diff) |
Separation Generator to a dedicated repo
Change-Id: Id94831651c3266861435272a6e36c7884bef2c45
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/libs/isotp-c/src/isotp/send.h')
-rw-r--r-- | CAN-binder/libs/isotp-c/src/isotp/send.h | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/CAN-binder/libs/isotp-c/src/isotp/send.h b/CAN-binder/libs/isotp-c/src/isotp/send.h deleted file mode 100644 index 1af32668..00000000 --- a/CAN-binder/libs/isotp-c/src/isotp/send.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __ISOTP_SEND_H__ -#define __ISOTP_SEND_H__ - -#include <isotp/isotp.h> -#include <stdint.h> -#include <stdbool.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Public: A handle for beginning and continuing sending a single ISO-TP - * message - both single and multi-frame. - * - * Since an ISO-TP message may contain multiple frames, we need to keep a handle - * around while waiting for flow control messages from the receiver. - * This struct encapsulates the local state required. - * - * completed - True if the message was completely sent, or the send was - * otherwise cancelled. - * success - True if the message send request was successful. The value if this - * field isn't valid if 'completed' isn't true. - */ -typedef struct { - bool completed; - bool success; - - // Private - uint16_t sending_arbitration_id; - uint16_t receiving_arbitration_id; - IsoTpMessageSentHandler message_sent_callback; - IsoTpCanFrameSentHandler can_frame_sent_callback; - // TODO going to need some state here for multi frame messages -} IsoTpSendHandle; - -/* Public: Initiate sending a single ISO-TP message. - * - * If the message fits in a single ISO-TP frame (i.e. the payload isn't more - * than 7 bytes) it will be sent immediately and the returned IsoTpSendHandle's - * 'completed' flag will be true. - * - * For multi-frame messages, see isotp_continue_send(...). - * - * shims - Low-level shims required to send CAN messages, etc. - * arbitration_id - The arbitration ID to send the message on. - * payload - The payload for the message. If no payload, NULL is valid is size - * is also 0. - * size - The size of the payload, or 0 if no payload. - * callback - an optional function to be called when the message is completely - * sent (use NULL if no callback required). - * - * Returns a handle to be used with isotp_continue_send to continue sending - * multi-frame messages. The 'completed' field in the returned IsoTpSendHandle - * will be true when the message is completely sent. - */ -IsoTpSendHandle isotp_send(IsoTpShims* shims, const uint16_t arbitration_id, - const uint8_t payload[], uint16_t size, - IsoTpMessageSentHandler callback); - -/* Public: Continue to send a multi-frame ISO-TP message, based on a freshly - * received CAN message (potentially from the receiver about flow control). - * - * For a multi-frame ISO-TP message, this function must be called - * repeatedly whenever a new CAN message is received in order to complete the - * send. The sender can't just blast everything onto the bus at once - it must - * wait for some response from the receiver to know how much to send at once. - * - * shims - Low-level shims required to send CAN messages, etc. - * handle - An IsoTpSendHandle previously returned by isotp_send(...). - * arbitration_id - The arbitration_id of the received CAN message. - * data - The data of the received CAN message. - * size - The size of the data in the received CAN message. - * - * Returns true if the message was completely sent, or the send was - * otherwise cancelled. Check the 'success' field of the handle to see if - * it was successful. - */ -bool isotp_continue_send(IsoTpShims* shims, IsoTpSendHandle* handle, - const uint16_t arbitration_id, const uint8_t data[], - const uint8_t size); - -#ifdef __cplusplus -} -#endif - -#endif // __ISOTP_SEND_H__ |