Go to the documentation of this file.
39 #ifndef ALLWIZE_LORAWAN_REDUCE_SIZE
40 #define ALLWIZE_LORAWAN_REDUCE_SIZE 1
45 #define LORAWAN_C_FIELD_MASK 0x20
51 #define LORAWAN_MAC_HEADER 0x40
56 #define LORAWAN_DIRECTION 0x00
64 #define LORAWAN_FRAME_CONTROL 0x00
71 #if not defined(ARDUINO_ARCH_SAMD) && not defined(ARDUINO_ARCH_ESP32)
77 bool joinABP(uint8_t *DevAddr, uint8_t *AppSKey, uint8_t * NwkSKey);
78 bool send(uint8_t *Data, uint8_t Data_Length, uint8_t Frame_Port = 0x01);
89 void Encrypt_Payload(uint8_t *Data, uint8_t Data_Length, uint16_t Frame_Counter, uint8_t Direction);
90 void Calculate_MIC(uint8_t *Data, uint8_t *Final_MIC, uint8_t Data_Length, uint16_t Frame_Counter, uint8_t Direction);
93 void XOR(uint8_t *New_Data, uint8_t *Old_Data);
95 void AES_Encrypt(uint8_t *Data,
const uint8_t *Key);
uint8_t AES_Sub_Byte(uint8_t Byte)
Function performs AES SubBytes step.
uint16_t getFrameCounter()
void AES_Encrypt(uint8_t *Data, const uint8_t *Key)
Function used to perform AES encryption.
void AES_Calculate_Round_Key(uint8_t Round, uint8_t *Round_Key)
Function performs AES Round Key Calculation.
static const uint8_t S_Table[16][16]
AllWize_LoRaWAN(HardwareSerial *serial, uint8_t reset_gpio=GPIO_NONE, uint8_t config_gpio=GPIO_NONE)
void Generate_Keys(uint8_t *K1, uint8_t *K2)
Function used to generate keys for the MIC calculation.
void Calculate_MIC(uint8_t *Data, uint8_t *Final_MIC, uint8_t Data_Length, uint16_t Frame_Counter, uint8_t Direction)
Function used to calculate the validity of data messages.
AllWize_LoRaWAN(uint8_t rx, uint8_t tx, uint8_t reset_gpio=GPIO_NONE, uint8_t config_gpio=GPIO_NONE)
void setFrameCounter(uint16_t value)
void Shift_Left(uint8_t *Data)
Round-shifts data to the left.
void AES_Add_Round_Key(uint8_t *Round_Key, uint8_t(*State)[4])
Function performs AES AddRoundKey step.
void AES_Shift_Rows(uint8_t(*State)[4])
Function performs AES ShiftRows step.
allwize_message_t read()
Returns latest received message (rebuilds LoRaWan header if necessary)
bool send(uint8_t *Data, uint8_t Data_Length, uint8_t Frame_Port=0x01)
Function to assemble and send a LoRaWAN package.
void Encrypt_Payload(uint8_t *Data, uint8_t Data_Length, uint16_t Frame_Counter, uint8_t Direction)
Function used to encrypt and decrypt the data in a LoRaWAN data packet.
bool joinABP(uint8_t *DevAddr, uint8_t *AppSKey, uint8_t *NwkSKey)
Stores the application and network keys for ABP activation.
void XOR(uint8_t *New_Data, uint8_t *Old_Data)
Function to XOR two character arrays.
void AES_Mix_Collums(uint8_t(*State)[4])
Function performs AES MixColumns step.