![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
demo versie 16/05
Dependencies: EthernetInterface mbed-rto mbed
Fork of ProjectVLC by
Receiver.cpp@4:0d013b7e4dea, 2018-03-28 (annotated)
- Committer:
- KlaasGovaerts
- Date:
- Wed Mar 28 12:25:14 2018 +0000
- Revision:
- 4:0d013b7e4dea
- Child:
- 5:0413d42377d1
Work in progress
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
KlaasGovaerts | 4:0d013b7e4dea | 1 | #include "Receiver.h" |
KlaasGovaerts | 4:0d013b7e4dea | 2 | |
KlaasGovaerts | 4:0d013b7e4dea | 3 | Receiver::Receiver(int* LEDinput,Mutex* lockinput){ |
KlaasGovaerts | 4:0d013b7e4dea | 4 | LED=LEDinput; |
KlaasGovaerts | 4:0d013b7e4dea | 5 | lock=lockinput; |
KlaasGovaerts | 4:0d013b7e4dea | 6 | |
KlaasGovaerts | 4:0d013b7e4dea | 7 | } |
KlaasGovaerts | 4:0d013b7e4dea | 8 | |
KlaasGovaerts | 4:0d013b7e4dea | 9 | void Receiver::run(){ |
KlaasGovaerts | 4:0d013b7e4dea | 10 | //Recieve Packet. |
KlaasGovaerts | 4:0d013b7e4dea | 11 | char command[512]; |
KlaasGovaerts | 4:0d013b7e4dea | 12 | |
KlaasGovaerts | 4:0d013b7e4dea | 13 | bool inCommand=true; |
KlaasGovaerts | 4:0d013b7e4dea | 14 | |
KlaasGovaerts | 4:0d013b7e4dea | 15 | |
KlaasGovaerts | 4:0d013b7e4dea | 16 | char *ID=strtok(command,","); |
KlaasGovaerts | 4:0d013b7e4dea | 17 | char *direction=strtok(NULL," "); |
KlaasGovaerts | 4:0d013b7e4dea | 18 | while((ID!=NULL)&&(direction!=NULL)){ |
KlaasGovaerts | 4:0d013b7e4dea | 19 | |
KlaasGovaerts | 4:0d013b7e4dea | 20 | |
KlaasGovaerts | 4:0d013b7e4dea | 21 | if(){ |
KlaasGovaerts | 4:0d013b7e4dea | 22 | |
KlaasGovaerts | 4:0d013b7e4dea | 23 | } else { |
KlaasGovaerts | 4:0d013b7e4dea | 24 | |
KlaasGovaerts | 4:0d013b7e4dea | 25 | } |
KlaasGovaerts | 4:0d013b7e4dea | 26 | |
KlaasGovaerts | 4:0d013b7e4dea | 27 | |
KlaasGovaerts | 4:0d013b7e4dea | 28 | int IDNumber=atoi(ID); |
KlaasGovaerts | 4:0d013b7e4dea | 29 | int directionNumber=directionToNumber(direction); |
KlaasGovaerts | 4:0d013b7e4dea | 30 | if((IDNumber>=0)&&(IDNumber<=11)&&(directionNumber>=0)&&(directionNumber<=3)){ |
KlaasGovaerts | 4:0d013b7e4dea | 31 | LED[IDNumber]= |
KlaasGovaerts | 4:0d013b7e4dea | 32 | } |
KlaasGovaerts | 4:0d013b7e4dea | 33 | inCommand=false; |
KlaasGovaerts | 4:0d013b7e4dea | 34 | } |
KlaasGovaerts | 4:0d013b7e4dea | 35 | |
KlaasGovaerts | 4:0d013b7e4dea | 36 | } |
KlaasGovaerts | 4:0d013b7e4dea | 37 | |
KlaasGovaerts | 4:0d013b7e4dea | 38 | int Receiver::directionToNumber(char* direction){ |
KlaasGovaerts | 4:0d013b7e4dea | 39 | if(strcmp(direction,"links")==0) |
KlaasGovaerts | 4:0d013b7e4dea | 40 | return 0; |
KlaasGovaerts | 4:0d013b7e4dea | 41 | else if(strcmp(direction,"rechts")==0) |
KlaasGovaerts | 4:0d013b7e4dea | 42 | return 1; |
KlaasGovaerts | 4:0d013b7e4dea | 43 | else if(strcmp(direction,"boven")==0) |
KlaasGovaerts | 4:0d013b7e4dea | 44 | return 2; |
KlaasGovaerts | 4:0d013b7e4dea | 45 | else if(strcmp(direction,"onder")==0) |
KlaasGovaerts | 4:0d013b7e4dea | 46 | return 3; |
KlaasGovaerts | 4:0d013b7e4dea | 47 | else |
KlaasGovaerts | 4:0d013b7e4dea | 48 | return -1; |
KlaasGovaerts | 4:0d013b7e4dea | 49 | } |
KlaasGovaerts | 4:0d013b7e4dea | 50 | |
KlaasGovaerts | 4:0d013b7e4dea | 51 | |
KlaasGovaerts | 4:0d013b7e4dea | 52 | /* |
KlaasGovaerts | 4:0d013b7e4dea | 53 | in |
KlaasGovaerts | 4:0d013b7e4dea | 54 | |
KlaasGovaerts | 4:0d013b7e4dea | 55 | int Receiver::directionToNumber(char *direction){ |
KlaasGovaerts | 4:0d013b7e4dea | 56 | |
KlaasGovaerts | 4:0d013b7e4dea | 57 | }*/ |