ENEL400
/
Aloha
Aloha implementation of LoRa technology
Fork of SX1276PingPong by
Aloha.h@16:c3c6b13c3c42, 2016-06-08 (annotated)
- Committer:
- rba90
- Date:
- Wed Jun 08 22:15:29 2016 +0000
- Revision:
- 16:c3c6b13c3c42
- Parent:
- 15:f790f35839db
random stuff
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rba90 | 15:f790f35839db | 1 | #ifndef ALOHA_H_ |
rba90 | 15:f790f35839db | 2 | #define ALOHA_H_ |
rba90 | 15:f790f35839db | 3 | |
rba90 | 15:f790f35839db | 4 | #include "mbed.h" |
rba90 | 15:f790f35839db | 5 | |
rba90 | 16:c3c6b13c3c42 | 6 | #define ALOHA_MAX_ATTEMPT 5 |
rba90 | 15:f790f35839db | 7 | |
rba90 | 15:f790f35839db | 8 | class Aloha |
rba90 | 15:f790f35839db | 9 | { |
rba90 | 15:f790f35839db | 10 | public: |
rba90 | 15:f790f35839db | 11 | typedef enum |
rba90 | 15:f790f35839db | 12 | { |
rba90 | 15:f790f35839db | 13 | IDLE = 0, |
rba90 | 15:f790f35839db | 14 | PENDING, |
rba90 | 15:f790f35839db | 15 | RETRANSMIT, |
rba90 | 16:c3c6b13c3c42 | 16 | EXPIRED, |
rba90 | 16:c3c6b13c3c42 | 17 | ACK_RESP |
rba90 | 15:f790f35839db | 18 | } AlohaState_t; |
rba90 | 15:f790f35839db | 19 | |
rba90 | 15:f790f35839db | 20 | public: |
rba90 | 15:f790f35839db | 21 | Timeout AlohaAckTimeout; |
rba90 | 16:c3c6b13c3c42 | 22 | float delay; |
rba90 | 15:f790f35839db | 23 | int attempts; |
rba90 | 15:f790f35839db | 24 | |
rba90 | 15:f790f35839db | 25 | AlohaState_t state; |
rba90 | 15:f790f35839db | 26 | |
rba90 | 15:f790f35839db | 27 | public: |
rba90 | 15:f790f35839db | 28 | Aloha() |
rba90 | 15:f790f35839db | 29 | { |
rba90 | 15:f790f35839db | 30 | attempts = 0; |
rba90 | 15:f790f35839db | 31 | state = Aloha::IDLE; |
rba90 | 15:f790f35839db | 32 | } |
rba90 | 15:f790f35839db | 33 | ~Aloha() |
rba90 | 15:f790f35839db | 34 | { |
rba90 | 15:f790f35839db | 35 | |
rba90 | 15:f790f35839db | 36 | } |
rba90 | 15:f790f35839db | 37 | }; |
rba90 | 15:f790f35839db | 38 | |
rba90 | 15:f790f35839db | 39 | #endif |