AllWize Library
AllWize.h
Go to the documentation of this file.
1 /*
2 
3 AllWize Library
4 
5 Copyright (C) 2018-2021 by AllWize <github@allwize.io>
6 
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20 */
21 
27 #ifndef ALLWIZE_H
28 #define ALLWIZE_H
29 
30 #include <Arduino.h>
31 #include "RC1701HP.h"
32 #include "OMS.h"
33 #include <Stream.h>
34 #if not defined(ARDUINO_ARCH_SAMD) && not defined(ARDUINO_ARCH_ESP32)
35 #include <SoftwareSerial.h>
36 #endif
37 
38 // -----------------------------------------------------------------------------
39 // Types & definitions
40 // -----------------------------------------------------------------------------
41 
42 // General
43 #define MODEM_DEFAULT_BAUDRATE BAUDRATE_19200
44 #define GPIO_NONE 0x99
45 #define RX_BUFFER_SIZE 255
46 #define DEFAULT_TIMEOUT 100
47 #define HARDWARE_SERIAL_PORT 1
48 #define DEFAULT_MBUS_MODE MBUS_MODE_N1
49 
50 #ifndef USE_MEMORY_CACHE
51 #define USE_MEMORY_CACHE 1
52 #endif
53 
54 typedef struct {
55  uint8_t c;
56  uint8_t ci;
57  char man[4];
58  uint8_t type;
59  uint8_t version;
60  uint8_t address[4];
61  uint8_t len;
62  uint8_t data[RX_BUFFER_SIZE];
63  uint8_t rssi;
64  uint8_t wize_control;
65  uint8_t wize_network_id;
66  uint16_t wize_counter;
69 
70 // -----------------------------------------------------------------------------
71 // DEBUG
72 // -----------------------------------------------------------------------------
73 
74 // Uncomment this to the proper port
75 // or define it in your build settings if you want
76 // to get low level debug information via serial
77 //#define ALLWIZE_DEBUG_PORT Serial
78 
79 #if defined(ALLWIZE_DEBUG_PORT)
80  #define ALLWIZE_DEBUG_PRINT(...) ALLWIZE_DEBUG_PORT.print(__VA_ARGS__)
81  #define ALLWIZE_DEBUG_PRINTLN(...) ALLWIZE_DEBUG_PORT.println(__VA_ARGS__)
82 #else
83  #define ALLWIZE_DEBUG_PRINT(...)
84  #define ALLWIZE_DEBUG_PRINTLN(...)
85 #endif
86 
87 // -----------------------------------------------------------------------------
88 // Class prototype
89 // -----------------------------------------------------------------------------
90 
91 class AllWize {
92 
93  public:
94 
95  AllWize(HardwareSerial * serial, uint8_t reset_gpio = GPIO_NONE, uint8_t config_gpio = GPIO_NONE);
96  #if not defined(ARDUINO_ARCH_SAMD) && not defined(ARDUINO_ARCH_ESP32)
97  AllWize(SoftwareSerial * serial, uint8_t reset_gpio = GPIO_NONE, uint8_t config_gpio = GPIO_NONE);
98  #endif
99  AllWize(uint8_t rx, uint8_t tx, uint8_t reset_gpio = GPIO_NONE, uint8_t config_gpio = GPIO_NONE);
100 
101  void begin(uint8_t baudrate = MODEM_DEFAULT_BAUDRATE);
102  bool reset();
103  void softReset();
104  bool factoryReset();
105  void sleep();
106  void wakeup();
107  bool ready();
108  bool waitForReady(uint32_t timeout = DEFAULT_TIMEOUT);
109  void dump(Stream & debug);
110 
111  bool ack();
112  bool send(uint8_t * buffer, uint8_t len);
113  bool send(const char * buffer);
114  bool available();
115  bool enableRX(bool enable);
117  uint8_t * getBuffer();
118  uint8_t getLength();
119 
120  void setControlInformation(uint8_t ci);
121  uint8_t getControlInformation();
122 
123  void master();
124  void slave();
125  void repeater();
126 
127  void setChannel(uint8_t channel, bool persist = false);
128  void setPower(uint8_t power, bool persist = false);
129  void setDataRate(uint8_t dr);
130  void setMode(uint8_t mode, bool persist = false);
131  void setSleepMode(uint8_t mode);
132  void setAppendRSSI(bool value);
133  void setPreamble(uint8_t preamble);
134  void setTimeout(uint16_t ms);
135  void setNetworkRole(uint8_t role);
136  void setLEDControl(uint8_t value);
137  void setDataInterface(uint8_t value);
138  void setControlField(uint8_t value, bool persist = false);
139  void setInstallMode(uint8_t mode, bool persist = false);
140  void setMAC2CheckOnlyFlag(uint8_t flag);
141  void setEncryptFlag(uint8_t flag);
142  void setDecryptFlag(uint8_t flag);
143  void setKey(uint8_t reg, const uint8_t * key);
144  void setDefaultKey(const uint8_t * key);
145  void setAccessNumber(uint8_t value);
146  void setBaudRate(uint8_t baudrate);
147 
148  uint8_t getChannel();
149  uint8_t getPower();
150  uint8_t getDataRate();
151  uint8_t getMode();
152  uint8_t getSleepMode();
153  uint8_t getPreamble();
154  uint8_t getDataInterface();
155  uint8_t getControlField();
156  bool getAppendRSSI();
157  uint16_t getTimeout();
158  uint8_t getNetworkRole();
159  uint8_t getLEDControl();
160  uint8_t getInstallMode();
161  uint8_t getMAC2CheckOnlyFlag();
162  uint8_t getEncryptFlag();
163  uint8_t getDecryptFlag();
164  void getDefaultKey(uint8_t * key);
165  uint8_t getBaudRate();
166  uint32_t getBaudRateSpeed(uint8_t value);
167 
168  float getRSSI();
169  uint8_t getTemperature();
170  uint16_t getVoltage();
171  String getMID();
172  bool setMID(uint16_t mid);
173  String getUID();
174  bool setUID(uint32_t uid);
175  uint8_t getVersion();
176  void setVersion(uint8_t version);
177  uint8_t getDevice();
178  void setDevice(uint8_t type);
179  String getPartNumber();
181  String getFirmwareVersion();
182  String getSerialNumber();
183  double getFrequency(uint8_t channel);
184  uint16_t getDataRateSpeed(uint8_t dr);
185  uint8_t getModuleType();
186  String getModuleTypeName();
187 
188  // Wize specific
189  bool setWizeControl(uint8_t wize_control);
190  void setWizeOperatorId(uint8_t wize_network_id);
191  void setWizeNetworkId(uint8_t wize_network_id);
192  void setWizeApplication(uint8_t wize_application);
193  void setCounter(uint16_t counter);
194  uint16_t getCounter();
195 
196  protected:
197 
198  void _init();
199 
200  uint8_t _getAddress(uint8_t slot);
201  bool _setConfig(bool value);
202  int8_t _sendCommand(uint8_t command, uint8_t * data, uint8_t len);
203  int8_t _sendCommand(uint8_t command, uint8_t data);
204  int8_t _sendCommand(uint8_t command);
205 
206  bool _cacheMemory(uint8_t * buffer);
207  uint8_t _getMemory(uint8_t address);
208  uint8_t _getMemory(uint8_t address, uint8_t *buffer, uint8_t len);
209  bool _setMemory(uint8_t address, uint8_t data);
210  bool _setMemory(uint8_t address, uint8_t * data, uint8_t len);
211 
212  bool _setSlot(uint8_t slot, uint8_t data);
213  bool _setSlot(uint8_t slot, uint8_t * data, uint8_t len);
214  uint8_t _getSlot(uint8_t slot);
215  uint8_t _getSlot(uint8_t slot, uint8_t * buffer, uint8_t len);
216  String _getSlotAsHexString(uint8_t slot, uint8_t len);
217  String _getSlotAsString(uint8_t slot, uint8_t len);
218 
219  void _readModel();
220  bool _decode();
221 
222  void _flush();
223  void _resetSerial();
224  uint8_t _send(uint8_t * buffer, uint8_t len);
225  uint8_t _send(uint8_t ch);
226  int8_t _receive();
227  int8_t _sendAndReceive(uint8_t * buffer, uint8_t len);
228  int8_t _sendAndReceive(uint8_t ch);
229 
230  int _timedRead();
231  int _readBytes(char * buffer, uint16_t len);
232  int _readBytesUntil(char terminator, char * buffer, uint16_t len);
233  void _hex2bin(char * hex, uint8_t * bin, uint8_t len);
234  void _bin2hex(uint8_t * bin, char * hex, uint8_t len);
235 
236  void _niceDelay(uint32_t ms);
237 
238  private:
239 
240  // -------------------------------------------------------------------------
241 
242  protected:
243 
244  int8_t _rx = -1;
245  int8_t _tx = -1;
246 
247  Stream * _stream = NULL;
248  HardwareSerial * _hw_serial = NULL;
249  #if defined(ARDUINO_ARCH_SAMD)
250  // Uart * _sw_serial = NULL;
251  #elif defined(ARDUINO_ARCH_ESP32)
252  // Nothing
253  #else
254  SoftwareSerial * _sw_serial = NULL;
255  #endif
256 
259  bool _config = false;
261  uint32_t _baudrate = 19200;
262 
264  uint8_t _mbus_mode = 0xFF;
265  uint8_t _data_interface = 0xFF;
266  bool _append_rssi = false;
267  uint8_t _access_number = 0;
269 
270  // Memory buffer
271  #if USE_MEMORY_CACHE
272  bool _ready = false;
273  uint8_t _memory[0x100] = {0xFF};
274  #endif
275 
276  String _model;
277  String _hw;
278  String _fw;
279 
280  // Wize specific
281  uint8_t _wize_control = 0x40;
282  uint16_t _wize_network_id = 0;
283  uint8_t _wize_application = 0xFE;
284  uint16_t _counter = 0;
285 
286  // Message buffers
289  uint8_t _pointer = 0;
290  uint8_t _length = 0;
291 
292 };
293 
294 #endif // ALLWIZE_H
AllWize::getMode
uint8_t getMode()
Gets the MBus mode stored in non-volatile memory.
Definition: AllWize.cpp:703
AllWize::_setMemory
bool _setMemory(uint8_t address, uint8_t data)
Sets non-volatile memory contents starting from given address.
Definition: AllWize.cpp:1398
AllWize::getVersion
uint8_t getVersion()
Returns the device version from non-volatile memory.
Definition: AllWize.cpp:1085
allwize_message_t::wize_network_id
uint8_t wize_network_id
Definition: AllWize.h:65
AllWize::setDevice
void setDevice(uint8_t type)
Sets the device type.
Definition: AllWize.cpp:1109
AllWize::setWizeApplication
void setWizeApplication(uint8_t wize_application)
Sets the wize applicaton field in the transpoprt layer.
Definition: AllWize.cpp:557
AllWize::slave
void slave()
Sets the module in slave mode.
Definition: AllWize.cpp:249
AllWize::waitForReady
bool waitForReady(uint32_t timeout=DEFAULT_TIMEOUT)
Waits for timeout millis for the module to be ready.
Definition: AllWize.cpp:294
AllWize::setAccessNumber
void setAccessNumber(uint8_t value)
Sets new/specific access number.
Definition: AllWize.cpp:960
AllWize::_sw_serial
SoftwareSerial * _sw_serial
Definition: AllWize.h:254
AllWize::setMAC2CheckOnlyFlag
void setMAC2CheckOnlyFlag(uint8_t flag)
Sets the MAC 2 Check Only flag setting.
Definition: AllWize.cpp:879
AllWize::dump
void dump(Stream &debug)
Dumps the current memory configuration to the given stream.
Definition: AllWize.cpp:307
AllWize::_setSlot
bool _setSlot(uint8_t slot, uint8_t data)
Sets non-volatile memory contents starting from given address.
Definition: AllWize.cpp:1491
AllWize::getSerialNumber
String getSerialNumber()
Returns the module serial number.
Definition: AllWize.cpp:1141
allwize_message_t::type
uint8_t type
Definition: AllWize.h:58
MODEM_DEFAULT_BAUDRATE
#define MODEM_DEFAULT_BAUDRATE
Definition: AllWize.h:43
AllWize::getDefaultKey
void getDefaultKey(uint8_t *key)
Gets the default encryption key.
Definition: AllWize.cpp:952
AllWize::ready
bool ready()
Test whether the radio module is ready or not.
Definition: AllWize.cpp:285
AllWize::setSleepMode
void setSleepMode(uint8_t mode)
Sets the sleep mode.
Definition: AllWize.cpp:711
AllWize::getNetworkRole
uint8_t getNetworkRole()
Gets the current network role.
Definition: AllWize.cpp:793
AllWize::getEncryptFlag
uint8_t getEncryptFlag()
Gets the encrypt flag setting.
Definition: AllWize.cpp:907
AllWize::setDataInterface
void setDataInterface(uint8_t value)
Sets the data interface for receiving packets.
Definition: AllWize.cpp:818
AllWize::_wize_network_id
uint16_t _wize_network_id
Definition: AllWize.h:282
AllWize::_model
String _model
Definition: AllWize.h:276
AllWize::_getSlotAsString
String _getSlotAsString(uint8_t slot, uint8_t len)
Returns the contents of the memory from a certain address as a String object.
Definition: AllWize.cpp:1547
AllWize::_resetSerial
void _resetSerial()
Resets the serial object.
Definition: AllWize.cpp:120
CI_APP_RESPONSE_UP_SHORT
#define CI_APP_RESPONSE_UP_SHORT
Definition: OMS.h:34
AllWize::_reset_gpio
uint8_t _reset_gpio
Definition: AllWize.h:257
allwize_message_t::wize_counter
uint16_t wize_counter
Definition: AllWize.h:66
AllWize::_append_rssi
bool _append_rssi
Definition: AllWize.h:266
AllWize::sleep
void sleep()
Sets the radio module in sleep mode.
Definition: AllWize.cpp:268
AllWize::setPreamble
void setPreamble(uint8_t preamble)
Sets the preamble length frame format.
Definition: AllWize.cpp:748
AllWize::_readBytes
int _readBytes(char *buffer, uint16_t len)
Reads the stream buffer up to a number of bytes.
Definition: AllWize.cpp:1837
AllWize::_bin2hex
void _bin2hex(uint8_t *bin, char *hex, uint8_t len)
Converts a binary buffer to an hex c-string.
Definition: AllWize.cpp:1898
AllWize::getDecryptFlag
uint8_t getDecryptFlag()
Gets the decrypt flag setting.
Definition: AllWize.cpp:923
AllWize::_hw_serial
HardwareSerial * _hw_serial
Definition: AllWize.h:248
AllWize::getRequiredHardwareVersion
String getRequiredHardwareVersion()
Returns the minimum required hardware version to run the current firmware.
Definition: AllWize.cpp:1125
AllWize::getPreamble
uint8_t getPreamble()
Gets the preamble length frame format.
Definition: AllWize.cpp:758
AllWize::setWizeNetworkId
void setWizeNetworkId(uint8_t wize_network_id)
Sets the wize network ID field in the transpoprt layer.
Definition: AllWize.cpp:549
AllWize::_receive
int8_t _receive()
Listens to incoming data from the module until timeout or END_OF_RESPONSE.
Definition: AllWize.cpp:1769
AllWize::_sendCommand
int8_t _sendCommand(uint8_t command, uint8_t *data, uint8_t len)
Sends a command with the given data.
Definition: AllWize.cpp:1244
AllWize::setMode
void setMode(uint8_t mode, bool persist=false)
Sets the module in one of the available MBus modes.
Definition: AllWize.cpp:681
AllWize::_send
uint8_t _send(uint8_t *buffer, uint8_t len)
Sends a binary buffer to the module UART. Returns the number of bytes actually sent.
Definition: AllWize.cpp:1756
AllWize::setControlField
void setControlField(uint8_t value, bool persist=false)
Sets the control field value.
Definition: AllWize.cpp:838
AllWize::_hex2bin
void _hex2bin(char *hex, uint8_t *bin, uint8_t len)
Converts a hex c-string to a binary buffer.
Definition: AllWize.cpp:1885
AllWize::setLEDControl
void setLEDControl(uint8_t value)
Sets the LED control.
Definition: AllWize.cpp:801
AllWize::setCounter
void setCounter(uint16_t counter)
Sets the wize couonter field in the transpoprt layer.
Definition: AllWize.cpp:565
AllWize::_config_gpio
uint8_t _config_gpio
Definition: AllWize.h:258
AllWize::_module
uint8_t _module
Definition: AllWize.h:268
AllWize::_hw
String _hw
Definition: AllWize.h:277
allwize_message_t::rssi
uint8_t rssi
Definition: AllWize.h:63
AllWize::setPower
void setPower(uint8_t power, bool persist=false)
Sets the RF power.
Definition: AllWize.cpp:626
AllWize::_flush
void _flush()
Flushes the serial line to the module.
Definition: AllWize.cpp:1722
allwize_message_t
Definition: AllWize.h:54
AllWize::setWizeOperatorId
void setWizeOperatorId(uint8_t wize_network_id)
Use AllWize::setWizeNetworkId instead.
Definition: AllWize.cpp:541
AllWize::setBaudRate
void setBaudRate(uint8_t baudrate)
Sets the UART baud rate, requires reset to take effect.
Definition: AllWize.cpp:968
AllWize::getDataInterface
uint8_t getDataInterface()
Gets the data interface for receiving packets.
Definition: AllWize.cpp:829
AllWize::_readModel
void _readModel()
Searches for the module model.
Definition: AllWize.cpp:1308
AllWize::_fw
String _fw
Definition: AllWize.h:278
AllWize::_tx
int8_t _tx
Definition: AllWize.h:245
AllWize::_timeout
uint32_t _timeout
Definition: AllWize.h:260
AllWize::getModuleType
uint8_t getModuleType()
Returns the module type.
Definition: AllWize.cpp:1149
AllWize::read
allwize_message_t read()
Returns latest received message.
Definition: AllWize.cpp:505
AllWize::_getSlotAsHexString
String _getSlotAsHexString(uint8_t slot, uint8_t len)
Returns the contents of the memory from a certain address as an HEX String.
Definition: AllWize.cpp:1530
AllWize::getInstallMode
uint8_t getInstallMode()
Gets the install modevalue stored in non-volatile memory.
Definition: AllWize.cpp:871
AllWize::setControlInformation
void setControlInformation(uint8_t ci)
Sets the control information byte.
Definition: AllWize.cpp:585
AllWize::_ready
bool _ready
Definition: AllWize.h:272
AllWize::getBuffer
uint8_t * getBuffer()
Returns pointer to the last message raw data buffer Should be copied right away since any new incommi...
Definition: AllWize.cpp:514
AllWize::_data_interface
uint8_t _data_interface
Definition: AllWize.h:265
DEFAULT_TIMEOUT
#define DEFAULT_TIMEOUT
Definition: AllWize.h:46
AllWize::setDecryptFlag
void setDecryptFlag(uint8_t flag)
Sets the decrypt flag setting.
Definition: AllWize.cpp:915
AllWize::getPartNumber
String getPartNumber()
Returns the module part number.
Definition: AllWize.cpp:1117
AllWize::_wize_control
uint8_t _wize_control
Definition: AllWize.h:281
AllWize::getFrequency
double getFrequency(uint8_t channel)
Returns the frequency for the given channel.
Definition: AllWize.cpp:1172
AllWize::master
void master()
Sets the module in master mode.
Definition: AllWize.cpp:234
AllWize::getControlField
uint8_t getControlField()
Gets the control field value stored in non-volatile memory.
Definition: AllWize.cpp:849
AllWize::getFirmwareVersion
String getFirmwareVersion()
Returns the module firmware revision.
Definition: AllWize.cpp:1133
AllWize::_cacheMemory
bool _cacheMemory(uint8_t *buffer)
Reads and caches the module memory.
Definition: AllWize.cpp:1293
AllWize::setUID
bool setUID(uint32_t uid)
Saved the UID into the module memory.
Definition: AllWize.cpp:1072
AllWize::getControlInformation
uint8_t getControlInformation()
Gets the control information byte.
Definition: AllWize.cpp:593
AllWize::softReset
void softReset()
Cleans the RX/TX line.
Definition: AllWize.cpp:197
AllWize::_message
allwize_message_t _message
Definition: AllWize.h:287
AllWize::ack
bool ack()
Sends an ACK.
Definition: AllWize.cpp:432
AllWize::setKey
void setKey(uint8_t reg, const uint8_t *key)
Sets the default encryption key.
Definition: AllWize.cpp:932
AllWize::_baudrate
uint32_t _baudrate
Definition: AllWize.h:261
allwize_message_t::version
uint8_t version
Definition: AllWize.h:59
AllWize::_config
bool _config
Definition: AllWize.h:259
allwize_message_t::ci
uint8_t ci
Definition: AllWize.h:56
AllWize::setWizeControl
bool setWizeControl(uint8_t wize_control)
Sets the wize control field in the transport layer.
Definition: AllWize.cpp:531
AllWize::getTemperature
uint8_t getTemperature()
Returns the internal temperature of the module.
Definition: AllWize.cpp:1012
AllWize::getCounter
uint16_t getCounter()
Gets the current wize counter.
Definition: AllWize.cpp:573
AllWize::setVersion
void setVersion(uint8_t version)
Sets the device version.
Definition: AllWize.cpp:1093
AllWize::setTimeout
void setTimeout(uint16_t ms)
Sets the buffer timeout (also used for auto sleep modes)
Definition: AllWize.cpp:766
AllWize::getUID
String getUID()
Returns the Unique ID string.
Definition: AllWize.cpp:1064
AllWize::AllWize
AllWize(HardwareSerial *serial, uint8_t reset_gpio=GPIO_NONE, uint8_t config_gpio=GPIO_NONE)
AllWize object constructor.
Definition: AllWize.cpp:40
AllWize::available
bool available()
Returns true if a new message has been received and decoded This method has to be called in the main ...
Definition: AllWize.cpp:458
AllWize::setNetworkRole
void setNetworkRole(uint8_t role)
Sets the network role.
Definition: AllWize.cpp:785
AllWize::getDevice
uint8_t getDevice()
Returns the device type from non-volatile memory.
Definition: AllWize.cpp:1101
AllWize::_getAddress
uint8_t _getAddress(uint8_t slot)
Return the physical memory address for the given slot.
Definition: AllWize.cpp:1463
AllWize::_rx
int8_t _rx
Definition: AllWize.h:244
AllWize::getMID
String getMID()
Returns the Manufacturer ID.
Definition: AllWize.cpp:1045
AllWize::getBaudRateSpeed
uint32_t getBaudRateSpeed(uint8_t value)
Gets the UART baud rate speed in bps.
Definition: AllWize.cpp:988
allwize_message_t::wize_control
uint8_t wize_control
Definition: AllWize.h:64
RC1701HP.h
GPIO_NONE
#define GPIO_NONE
Definition: AllWize.h:44
AllWize::begin
void begin(uint8_t baudrate=MODEM_DEFAULT_BAUDRATE)
Inits the module communications.
Definition: AllWize.cpp:91
AllWize::send
bool send(uint8_t *buffer, uint8_t len)
Sends a byte array.
Definition: AllWize.cpp:366
AllWize::getLength
uint8_t getLength()
Returns the length of the last message raw data buffer.
Definition: AllWize.cpp:522
AllWize::_memory
uint8_t _memory[0x100]
Definition: AllWize.h:273
AllWize::getDataRate
uint8_t getDataRate()
Gets the data rate stored in non-volatile memory.
Definition: AllWize.cpp:672
allwize_message_t::len
uint8_t len
Definition: AllWize.h:61
AllWize::_pointer
uint8_t _pointer
Definition: AllWize.h:289
AllWize::_sendAndReceive
int8_t _sendAndReceive(uint8_t *buffer, uint8_t len)
Sends a binary buffer and waits for response. Returns the number of bytes received and stored in the ...
Definition: AllWize.cpp:1780
allwize_message_t::wize_application
uint8_t wize_application
Definition: AllWize.h:67
AllWize::factoryReset
bool factoryReset()
Resets the module to factory settings.
Definition: AllWize.cpp:212
AllWize::_ci
uint8_t _ci
Definition: AllWize.h:263
AllWize::_wize_application
uint8_t _wize_application
Definition: AllWize.h:283
AllWize::repeater
void repeater()
Sets the module in repeater mode.
Definition: AllWize.cpp:260
AllWize::getAppendRSSI
bool getAppendRSSI()
Gets the current RSSI mode value.
Definition: AllWize.cpp:740
AllWize::_timedRead
int _timedRead()
Reads a byte from the stream with a timeout.
Definition: AllWize.cpp:1801
AllWize::_buffer
uint8_t _buffer[RX_BUFFER_SIZE]
Definition: AllWize.h:288
AllWize::_getSlot
uint8_t _getSlot(uint8_t slot)
Returns the contents of single-byte memory slot.
Definition: AllWize.cpp:1517
AllWize::_length
uint8_t _length
Definition: AllWize.h:290
AllWize::_stream
Stream * _stream
Definition: AllWize.h:247
AllWize::reset
bool reset()
Resets the radio module.
Definition: AllWize.cpp:162
AllWize::_setConfig
bool _setConfig(bool value)
Sets or unsets config mode.
Definition: AllWize.cpp:1215
AllWize::setEncryptFlag
void setEncryptFlag(uint8_t flag)
Sets the encrypt flag setting.
Definition: AllWize.cpp:897
AllWize::getMAC2CheckOnlyFlag
uint8_t getMAC2CheckOnlyFlag()
Gets the MAC 2 Check Only flag setting.
Definition: AllWize.cpp:889
AllWize::getDataRateSpeed
uint16_t getDataRateSpeed(uint8_t dr)
Returns the speed for te given datarate.
Definition: AllWize.cpp:1197
OMS.h
AllWize::getLEDControl
uint8_t getLEDControl()
Gets the current LED control.
Definition: AllWize.cpp:810
RX_BUFFER_SIZE
#define RX_BUFFER_SIZE
Definition: AllWize.h:45
AllWize::_niceDelay
void _niceDelay(uint32_t ms)
Does a non-blocking delay.
Definition: AllWize.cpp:1909
AllWize
Definition: AllWize.h:91
AllWize::_counter
uint16_t _counter
Definition: AllWize.h:284
AllWize::_mbus_mode
uint8_t _mbus_mode
Definition: AllWize.h:264
allwize_message_t::c
uint8_t c
Definition: AllWize.h:55
AllWize::_init
void _init()
Definition: AllWize.cpp:75
AllWize::getVoltage
uint16_t getVoltage()
Returns the internal voltage of the module.
Definition: AllWize.cpp:1029
AllWize::getModuleTypeName
String getModuleTypeName()
Returns the module type.
Definition: AllWize.cpp:1157
AllWize::setMID
bool setMID(uint16_t mid)
Sets the Manufacturer ID.
Definition: AllWize.cpp:1053
AllWize::getRSSI
float getRSSI()
Returns the RSSI of the last valid packet received TODO: values do not seem right and are not the sam...
Definition: AllWize.cpp:1002
AllWize::_decode
bool _decode()
Decodes the current RX buffer contents.
Definition: AllWize.cpp:1586
AllWize::_readBytesUntil
int _readBytesUntil(char terminator, char *buffer, uint16_t len)
Reads the stream buffer up to a certain char or times out.
Definition: AllWize.cpp:1861
AllWize::_getMemory
uint8_t _getMemory(uint8_t address)
Returns the contents of memory address.
Definition: AllWize.cpp:1380
AllWize::wakeup
void wakeup()
Wakes up the radio from sleep mode.
Definition: AllWize.cpp:276
AllWize::getBaudRate
uint8_t getBaudRate()
Gets the UART baud rate.
Definition: AllWize.cpp:979
AllWize::setDefaultKey
void setDefaultKey(const uint8_t *key)
Sets the default encryption key.
Definition: AllWize.cpp:944
MODULE_UNKNOWN
@ MODULE_UNKNOWN
Definition: RC1701HP.h:12
AllWize::_access_number
uint8_t _access_number
Definition: AllWize.h:267
AllWize::getTimeout
uint16_t getTimeout()
Gets the current buffer timeout (also used for auto sleep modes)
Definition: AllWize.cpp:776
AllWize::setChannel
void setChannel(uint8_t channel, bool persist=false)
Sets the communications channel (for MBUS_MODE_R2 only)
Definition: AllWize.cpp:602
AllWize::setAppendRSSI
void setAppendRSSI(bool value)
Sets the RSSI mode value.
Definition: AllWize.cpp:727
AllWize::getChannel
uint8_t getChannel()
Gets the channel stored in non-volatile memory.
Definition: AllWize.cpp:617
AllWize::getSleepMode
uint8_t getSleepMode()
Gets the sleep mode stored in non-volatile memory.
Definition: AllWize.cpp:719
AllWize::getPower
uint8_t getPower()
Gets the RF power stored in non-volatile memory.
Definition: AllWize.cpp:639
AllWize::setInstallMode
void setInstallMode(uint8_t mode, bool persist=false)
Sets the module in one of the available operations modes.
Definition: AllWize.cpp:858
AllWize::enableRX
bool enableRX(bool enable)
Enables or disables RF recever.
Definition: AllWize.cpp:443
AllWize::setDataRate
void setDataRate(uint8_t dr)
Sets the data rate.
Definition: AllWize.cpp:647