C++ Wrapper around the IBM LMiC LoRaWAN implementation
Node.h@10:9bf05e9b4cde, 2016-11-22 (annotated)
- Committer:
- Sille Van Landschoot
- Date:
- Tue Nov 22 20:43:03 2016 +0100
- Revision:
- 10:9bf05e9b4cde
- Parent:
- 9:cfe697b53d71
Add reset pin support with define directive
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sillevl | 1:7cfc59ba0797 | 1 | /* The MIT License (MIT) |
sillevl | 2:6fac10decfb3 | 2 | * |
sillevl | 1:7cfc59ba0797 | 3 | * Copyright (c) 2016 Sille Van Landschoot |
sillevl | 2:6fac10decfb3 | 4 | * |
sillevl | 1:7cfc59ba0797 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
sillevl | 1:7cfc59ba0797 | 6 | * of this software and associated documentation files (the "Software"), to deal |
sillevl | 1:7cfc59ba0797 | 7 | * in the Software without restriction, including without limitation the rights |
sillevl | 1:7cfc59ba0797 | 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
sillevl | 1:7cfc59ba0797 | 9 | * copies of the Software, and to permit persons to whom the Software is |
sillevl | 1:7cfc59ba0797 | 10 | * furnished to do so, subject to the following conditions: |
sillevl | 2:6fac10decfb3 | 11 | * |
sillevl | 1:7cfc59ba0797 | 12 | * The above copyright notice and this permission notice shall be included in all |
sillevl | 1:7cfc59ba0797 | 13 | * copies or substantial portions of the Software. |
sillevl | 2:6fac10decfb3 | 14 | * |
sillevl | 1:7cfc59ba0797 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
sillevl | 1:7cfc59ba0797 | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
sillevl | 1:7cfc59ba0797 | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
sillevl | 1:7cfc59ba0797 | 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
sillevl | 1:7cfc59ba0797 | 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
sillevl | 1:7cfc59ba0797 | 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
sillevl | 1:7cfc59ba0797 | 21 | * SOFTWARE. |
sillevl | 1:7cfc59ba0797 | 22 | */ |
sillevl | 1:7cfc59ba0797 | 23 | |
sillevl | 1:7cfc59ba0797 | 24 | #ifndef SIMPLE_LORAWAN_NODE_H_ |
sillevl | 1:7cfc59ba0797 | 25 | #define SIMPLE_LORAWAN_NODE_H_ |
sillevl | 1:7cfc59ba0797 | 26 | |
Sille Van Landschoot |
10:9bf05e9b4cde | 27 | #define RFM95_RESET_CONNECTED 1 // define if p15 is connected to RFM95W reset |
Sille Van Landschoot |
10:9bf05e9b4cde | 28 | |
sillevl | 1:7cfc59ba0797 | 29 | #include "lmic.h" |
sillevl | 1:7cfc59ba0797 | 30 | #include "stdint.h" |
sillevl | 1:7cfc59ba0797 | 31 | |
Sille Van Landschoot |
10:9bf05e9b4cde | 32 | #ifdef RFM95_RESET_CONNECTED |
Sille Van Landschoot |
10:9bf05e9b4cde | 33 | #include "mbed.h" |
Sille Van Landschoot |
10:9bf05e9b4cde | 34 | #endif |
Sille Van Landschoot |
10:9bf05e9b4cde | 35 | |
sillevl | 2:6fac10decfb3 | 36 | namespace SimpleLoRaWAN |
sillevl | 2:6fac10decfb3 | 37 | { |
sillevl | 1:7cfc59ba0797 | 38 | |
sillevl | 2:6fac10decfb3 | 39 | class Node |
sillevl | 2:6fac10decfb3 | 40 | { |
sillevl | 1:7cfc59ba0797 | 41 | public: |
sillevl | 1:7cfc59ba0797 | 42 | Node(); |
sillevl | 1:7cfc59ba0797 | 43 | virtual ~Node(); |
sillevl | 1:7cfc59ba0797 | 44 | void send(char* data, int size); |
Sille Van Landschoot |
10:9bf05e9b4cde | 45 | void send(uint8_t* data, int size); |
sillevl | 1:7cfc59ba0797 | 46 | static void onEvent(ev_t ev); |
sillevl | 1:7cfc59ba0797 | 47 | void process(); |
sillevl | 1:7cfc59ba0797 | 48 | |
Sille Van Landschoot |
9:cfe697b53d71 | 49 | void enableLinkCheck(); |
Sille Van Landschoot |
9:cfe697b53d71 | 50 | void disableLinkCheck(); |
Sille Van Landschoot |
9:cfe697b53d71 | 51 | void setLinkCheck(int state); |
Sille Van Landschoot |
9:cfe697b53d71 | 52 | |
Sille Van Landschoot |
10:9bf05e9b4cde | 53 | void setSpreadFactor(int spreadfactor); |
Sille Van Landschoot |
10:9bf05e9b4cde | 54 | |
sillevl | 2:6fac10decfb3 | 55 | private: |
sillevl | 2:6fac10decfb3 | 56 | void init(); |
Sille Van Landschoot |
9:cfe697b53d71 | 57 | void setLinkCheck(); |
Sille Van Landschoot |
10:9bf05e9b4cde | 58 | #ifdef RFM95_RESET_CONNECTED |
Sille Van Landschoot |
10:9bf05e9b4cde | 59 | DigitalOut rfm95wReset; |
Sille Van Landschoot |
10:9bf05e9b4cde | 60 | #endif |
sillevl | 1:7cfc59ba0797 | 61 | }; |
sillevl | 1:7cfc59ba0797 | 62 | |
sillevl | 1:7cfc59ba0797 | 63 | } /* namespace SimpleLoRaWAN */ |
sillevl | 1:7cfc59ba0797 | 64 | |
sillevl | 2:6fac10decfb3 | 65 | #endif /* SIMPLE_LORAWAN_NODE_H_ */ |