Sigfox library with integration of ATParser
Sigfox.cpp@1:93450d8b2540, 2017-04-18 (annotated)
- Committer:
- Raffaello
- Date:
- Tue Apr 18 15:05:57 2017 +0000
- Revision:
- 1:93450d8b2540
- Parent:
- 0:5e0ae613c18c
- Child:
- 2:d07e3b39ff74
Added new commands
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Raffaello | 0:5e0ae613c18c | 1 | |
Raffaello | 0:5e0ae613c18c | 2 | #include "Sigfox.h" |
Raffaello | 0:5e0ae613c18c | 3 | |
Raffaello | 0:5e0ae613c18c | 4 | bool Sigfox::ready() { |
Raffaello | 0:5e0ae613c18c | 5 | _at->send("AT"); |
Raffaello | 0:5e0ae613c18c | 6 | return _at->recv("OK"); |
Raffaello | 0:5e0ae613c18c | 7 | } |
Raffaello | 0:5e0ae613c18c | 8 | |
Raffaello | 0:5e0ae613c18c | 9 | bool Sigfox::send(const char *data) { |
Raffaello | 0:5e0ae613c18c | 10 | _at->send("AT$SF=%s", data); |
Raffaello | 0:5e0ae613c18c | 11 | return _at->recv("OK"); |
Raffaello | 1:93450d8b2540 | 12 | } |
Raffaello | 1:93450d8b2540 | 13 | |
Raffaello | 1:93450d8b2540 | 14 | bool Sigfox::setPowerMode(uint8_t power) { |
Raffaello | 1:93450d8b2540 | 15 | _at->send("AT$P=%d", power); |
Raffaello | 1:93450d8b2540 | 16 | return _at->recv("OK"); |
Raffaello | 1:93450d8b2540 | 17 | } |
Raffaello | 1:93450d8b2540 | 18 | |
Raffaello | 1:93450d8b2540 | 19 | void Sigfox::getID() { |
Raffaello | 1:93450d8b2540 | 20 | _at->send("AT$I=10"); |
Raffaello | 1:93450d8b2540 | 21 | // TODO add return value |
Raffaello | 1:93450d8b2540 | 22 | } |
Raffaello | 1:93450d8b2540 | 23 | |
Raffaello | 1:93450d8b2540 | 24 | void Sigfox::getPAC() { |
Raffaello | 1:93450d8b2540 | 25 | _at->send("AT$I=11"); |
Raffaello | 1:93450d8b2540 | 26 | // TODO add return value |
Raffaello | 0:5e0ae613c18c | 27 | } |