-
Notifications
You must be signed in to change notification settings - Fork 0
/
Com_Lib.c
executable file
·43 lines (38 loc) · 1.44 KB
/
Com_Lib.c
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
#include <stdio.h>
#include "Com_Lib.h"
#include "ReportStruct.h"
int sendMessage(Message *inMsg){
if (inMsg==0)
return 0;
switch (inMsg->type) {
case REPORTLIST :{
printf("The message type is: %s\n", "Report List");
int count = inMsg->dataCount;
struct Report *myList = (struct Report*)inMsg->data; // my list is pointing at an array of ReportInfo Structs
// call lstrsend and send the data to the station
for(int i=0; i< count; i++){
char *name = myList->name;
if ( 0 != name)
printf("The Report Name is: %s\n", name); // i want the contents of the pointer
myList++;
} // end for
printf("\n");
break;
}
case STATUS :{
StatusMsg *myStatus = (StatusMsg*)inMsg->data;
printf("The status message is: %s\n",myStatus->msg);
// call lstrsend and send the data to the station
break;
}
default:
printf("Not sure what this message type: %d is ", inMsg->type);
return 0;
} // end switch
return 1;
} // end Send Message