-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkeyTime.h
48 lines (43 loc) · 1.71 KB
/
keyTime.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* struct canInfoStruct stores all the data you would need in for use in the program.
* This was set up so that passing data to a function when using threads would work.
*
* sendIDinStruct - Stores the CAN ID you want to send to. In the form of a string as that's how parseFrame accepts them.
* receiveIDinStruct - Stores the CAN ID you want to receive from.
* sock - Stores the socket you created at an earlier time to then be able to send and receive data from the CAN bus network.
* beginTime - Stores the time when passed to the timer function.
* endTime - Stores the time when passed to the timer function.
* cdata - Stores the values of each byte from a CAN message received from the ECU.
* loop - Stores the amount of messages that you want to receive from the ECU. An optional counter.
*/
struct canInfoStruct {
char *sendIDinStruct;
int receiveIDinStruct;
int sock;
long *beginTime;
long *endTime;
int cdata[8];
int loop;
};
struct canInfoStruct myStruct;
/*
* timer function is responsible for getting a time values
* @param timer_val - take a long variable and sets the time equal to it
*/
void timer(long *timer_val);
/*
* createSocket function creates a socket on the CAN bus network
* so we're able to send and receive messages from it.
* @param interface - A string value naming the interface where you want to create the socket.
*/
int createSocket(char *interface);
/*
* receiveMsg function is made to receive a message from the CAN network
* @param ptr - a void pointer used to accept structs of data
*/
void *receiveMsg(void *ptr);
/*
* sendMsg function is made to send a message to the CAN network
* @param ptr - a void pointer used to accept structs of data
*/
void *sendMsg(void *ptr);