WPILibC++  2020.3.2
CanData.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include "NotifyListener.h"
11 #include "hal/Types.h"
12 #include "hal/Value.h"
13 
14 typedef void (*HAL_CAN_SendMessageCallback)(const char* name, void* param,
15  uint32_t messageID,
16  const uint8_t* data,
17  uint8_t dataSize, int32_t periodMs,
18  int32_t* status);
19 
20 typedef void (*HAL_CAN_ReceiveMessageCallback)(
21  const char* name, void* param, uint32_t* messageID, uint32_t messageIDMask,
22  uint8_t* data, uint8_t* dataSize, uint32_t* timeStamp, int32_t* status);
23 
24 typedef void (*HAL_CAN_OpenStreamSessionCallback)(
25  const char* name, void* param, uint32_t* sessionHandle, uint32_t messageID,
26  uint32_t messageIDMask, uint32_t maxMessages, int32_t* status);
27 
28 typedef void (*HAL_CAN_CloseStreamSessionCallback)(const char* name,
29  void* param,
30  uint32_t sessionHandle);
31 
32 typedef void (*HAL_CAN_ReadStreamSessionCallback)(
33  const char* name, void* param, uint32_t sessionHandle,
34  struct HAL_CANStreamMessage* messages, uint32_t messagesToRead,
35  uint32_t* messagesRead, int32_t* status);
36 
37 typedef void (*HAL_CAN_GetCANStatusCallback)(
38  const char* name, void* param, float* percentBusUtilization,
39  uint32_t* busOffCount, uint32_t* txFullCount, uint32_t* receiveErrorCount,
40  uint32_t* transmitErrorCount, int32_t* status);
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 void HALSIM_ResetCanData(void);
47 
48 int32_t HALSIM_RegisterCanSendMessageCallback(
49  HAL_CAN_SendMessageCallback callback, void* param);
50 void HALSIM_CancelCanSendMessageCallback(int32_t uid);
51 
52 int32_t HALSIM_RegisterCanReceiveMessageCallback(
53  HAL_CAN_ReceiveMessageCallback callback, void* param);
54 void HALSIM_CancelCanReceiveMessageCallback(int32_t uid);
55 
56 int32_t HALSIM_RegisterCanOpenStreamCallback(
57  HAL_CAN_OpenStreamSessionCallback callback, void* param);
58 void HALSIM_CancelCanOpenStreamCallback(int32_t uid);
59 
60 int32_t HALSIM_RegisterCanCloseStreamCallback(
61  HAL_CAN_CloseStreamSessionCallback callback, void* param);
62 void HALSIM_CancelCanCloseStreamCallback(int32_t uid);
63 
64 int32_t HALSIM_RegisterCanReadStreamCallback(
65  HAL_CAN_ReadStreamSessionCallback callback, void* param);
66 void HALSIM_CancelCanReadStreamCallback(int32_t uid);
67 
68 int32_t HALSIM_RegisterCanGetCANStatusCallback(
69  HAL_CAN_GetCANStatusCallback callback, void* param);
70 void HALSIM_CancelCanGetCANStatusCallback(int32_t uid);
71 
72 #ifdef __cplusplus
73 } // extern "C"
74 #endif
HAL_CANStreamMessage
Storage for CAN Stream Messages.
Definition: CAN.h:39