Nol.A SDK Library
24.7.1
For IoT System Software Development
|
Public Member Functions | |
LoRaMacEU863 (LoRaRadioChip &, uint16_t radioWakeupTime=1) | |
error_t | addChannel (uint8_t id, ChannelParams_t params) |
Add a channel. More... | |
error_t | removeChannel (uint8_t id) |
LoRaMAC channel remove service. More... | |
const ChannelParams_t * | getChannel (uint8_t index) |
채널 정보를 가져옵니다. More... | |
uint8_t | getMaxPayload (uint8_t dr, bool repeater=false) override |
최대 application payload 길이(N)를 가져옵니다. More... | |
virtual uint32_t | getRx1Frequency () override |
Rx1에서 사용할 주파수를 가져옵니다. | |
Public Member Functions inherited from LoRaMac | |
LoRaMac (LoRaRadioChip &, int8_t defTxPower, int8_t defDatarate, bool dutyCycleOn, uint8_t numChannels, const DatarateParams_t *drTable, uint8_t maxDatarate, uint8_t minTxPower, uint8_t maxTxPower, uint8_t adrAckLimit, uint8_t adrAckDelay, uint32_t maxFCntGap, uint16_t radioWakeupTime=1) | |
virtual error_t | begin (uint8_t(*getBatteryLevel)()=NULL) |
LoRaMAC layer initialization. More... | |
error_t | linkMulticastChannel (MulticastParams_t *channelParam) |
LoRaMAC multicast channel link service. More... | |
error_t | unlinkMulticastChannel (MulticastParams_t *channelParam) |
LoRaMAC multicast channel unlink service. More... | |
virtual error_t | beginJoining (const uint8_t *devEui, const uint8_t *appEui, const uint8_t *appKey) |
Over-the-Air Activation (OTAA) 방식의 join을 시도합니다. More... | |
error_t | beginJoining (const uint8_t *devEui, const uint8_t *appKey) |
bool | isJoining () |
현재 OTAA Join 중인지 확인합니다. More... | |
void | onJoin (void(*func)(LoRaMac &mac, bool result, const uint8_t *devEui, const uint8_t *appEui, const uint8_t *appKey, const uint8_t *nwkSKey, const uint8_t *appSKey, uint32_t devAddr, const RadioPacket &frame, uint32_t airTime)) |
Join이 완료되었을 때 호출될 콜백함수를 지정합니다. More... | |
void | onJoinRequested (void(*func)(LoRaMac &, uint32_t frequencyHz, const DatarateParams_t &)) |
JoinRequest 메시지를 보낼 때 호출될 콜백함수를 지정합니다. More... | |
virtual void | setABP (const uint8_t *nwkSKey, const uint8_t *appSKey, uint32_t devAddr) |
ABP를 사용하도록 설정합니다. More... | |
void | setPublicNetwork (bool enable) |
공용 LoRaWAN 네트워크를 사용할지 설정합니다. More... | |
DeviceClass_t | getDeviceClass () |
Device class를 가져옵니다. More... | |
error_t | setDeviceClass (DeviceClass_t c) |
Device class를 설정합니다. More... | |
error_t | setDeviceClass (DeviceClass_t c, bool sendDeviceModeInd, void(*func)(LoRaMac &, DeviceClass_t)) |
const DatarateParams_t * | getDatarate (uint8_t index) |
Datarate 정보를 가져옵니다. More... | |
uint8_t | getRx2Datarate () |
Rx2에서 사용할 DR을 가져옵니다. | |
void | setRx2Datarate (uint8_t dr) |
Rx2에서 사용할 DR을 임의로 설정합니다. | |
uint32_t | getRx2Frequency () |
Rx2에서 사용할 주파수를 가져옵니다. | |
void | setRx2Frequency (uint32_t f) |
Rx2에서 사용할 주파수를 임의로 설정합니다. | |
uint8_t | getRx1DrOffset () |
Rx1에 적용될 DR offset을 가져옵니다. | |
virtual uint8_t | getRx1Datarate () |
Rx1에 사용될, DR offset이 적용된 DR을 가져옵니다. More... | |
int32_t | getNetworkID () |
Network ID를 가져옵니다. More... | |
uint32_t | getDeviceAddress () |
Device address를 가져옵니다. | |
uint16_t | getRx1Delay () |
Tx 종료 후 Rx1 window가 열릴 때까지의 지연 시간(단위: 밀리초)을 가져옵니다. | |
uint16_t | getRx2Delay () |
Tx 종료 후 Rx2 window가 열릴 때까지의 지연 시간(단위: 밀리초)을 가져옵니다. | |
uint16_t | getJoinAcceptDelay1 () |
JoinRequest 송신 후 Rx1 window가 열릴 때까지의 지연 시간(단위: 밀리초)을 가져옵니다. | |
uint16_t | getJoinAcceptDelay2 () |
JoinRequest 송신 후 Rx2 window가 열릴 때까지의 지연 시간(단위: 밀리초)을 가져옵니다. | |
uint8_t | getCurrentDatarateIndex () |
현재 설정된 기본 datarate 인덱스를 가져옵니다. More... | |
error_t | setCurrentDatarateIndex (uint8_t index) |
기본 datarate를 설정합니다. More... | |
uint8_t | getCurrentTxPowerIndex () |
기본 Tx power index를 가져옵니다. More... | |
error_t | setCurrentTxPowerIndex (uint8_t index) |
기본 Tx power를 설정합니다. More... | |
uint32_t | getUpLinkCounter () |
Uplink용 frame counter (fCntUp) 를 가져옵니다. More... | |
virtual void | setUpLinkCounter (uint32_t) |
Uplink용 frame counter (fCntUp) 를 설정합니다. More... | |
uint32_t | getDownLinkCounter () |
Downlink용 frame counter (fCntDown) 를 가져옵니다. More... | |
virtual void | setDownLinkCounter (uint32_t) |
Downlink용 frame counter (fCntDown) 를 설정합니다. More... | |
uint8_t | getNumRepetitions () |
현재 설정된 unconfirmed uplink frame에 적용되는 반복 전송 횟수를 가져옵니다. | |
uint8_t | getMaxDutyCycle () |
현재의 최대 duty cycle을 가져옵니다. | |
error_t | send (LoRaMacFrame *frame) |
frame 을 전송합니다. More... | |
error_t | cancelSend (LoRaMacFrame *frame) |
frame 전송을 취소합니다. More... | |
void | onSendDone (void(*sendDoneHandler)(LoRaMac &, LoRaMacFrame *)) |
전송이 완료될 때 호출될 함수를 지정합니다. More... | |
void | onReceive (void(*receiveHandler)(LoRaMac &radio, const LoRaMacFrame *frame)) |
수신이 완료될 때 호출될 함수를 지정합니다. More... | |
void | onReceiveErrorFrame (void(*receiveHandler)(LoRaMac &radio, const RadioPacket &frame)) |
비정상 프레임 수신시 호출될 함수를 지정합니다. More... | |
uint8_t | getPendingMacCommandsLength () |
현재 송신 대기 중인 MAC commands의 길이를 가져옵니다. More... | |
std::array< uint8_t, 8 > | getDevEui () |
Device EUI를 가져옵니다. More... | |
std::array< uint8_t, 8 > | getAppEui () |
Application EUI를 가져옵니다. More... | |
std::array< uint8_t, 16 > | getAppKey () |
AppKey를 가져옵니다. More... | |
std::array< uint8_t, 16 > | getNwkSKey () |
NwkSKey를 가져옵니다. More... | |
std::array< uint8_t, 16 > | getAppSKey () |
AppSKey를 가져옵니다. More... | |
virtual error_t | requestLinkCheck () |
LinkCheckReq MAC command를 요청합니다. More... | |
error_t | requestLinkCheck (void(*func)(LoRaMac &)) |
LinkCheckReq MAC command를 요청합니다. More... | |
void | onLinkChecked (void(*func)(LoRaMac &, uint8_t demodMargin, uint8_t numGateways)) |
LinkCheckReq MAC command에 대한 응답(LinkCheckAns)이 올 경우 호출될 콜백함수를 지정합니다. More... | |
error_t | requestDeviceTime (RTCCalendar *rtc) |
DeviceTimeReq MAC command를 요청합니다. More... | |
error_t | requestDeviceTime (RTCCalendar *rtc, void(*func)(LoRaMac &)) |
DeviceTimeReq MAC command를 요청합니다. More... | |
error_t | requestDeviceTime (void(*func)(LoRaMac &)=nullptr) |
DeviceTimeReq MAC command를 요청합니다. More... | |
void | onDeviceTimeAnswered (void(*func)(LoRaMac &, bool success, uint32_t tSeconds, uint8_t tFracSeconds), RTCCalendar *rtc) |
DeviceTimeReq MAC command에 대한 응답(DeviceTimeAns)이 올 경우 호출될 콜백함수와 RTCCalendar 를 지정합니다. More... | |
void | onLinkADRReqReceived (void(*func)(LoRaMac &, const uint8_t *)) |
LinkADRReq MAC command를 수신시 호출될 콜백함수를 지정합니다. More... | |
void | onLinkADRAnsSent (void(*func)(LoRaMac &, uint8_t status)) |
LinkADRAns MAC command를 송신시 호출될 콜백함수를 지정합니다. More... | |
void | onDutyCycleReqReceived (void(*func)(LoRaMac &, const uint8_t *)) |
DutyCycleReq MAC command를 수신시 호출될 콜백함수를 지정합니다. More... | |
void | onDutyCycleAnsSent (void(*func)(LoRaMac &)) |
DutyCycleAns MAC command를 송신시 호출될 콜백함수를 지정합니다. More... | |
void | onRxParamSetupReqReceived (void(*func)(LoRaMac &, const uint8_t *)) |
RxParamSetupReq MAC command를 수신시 호출될 콜백함수를 지정합니다. More... | |
void | onRxParamSetupAnsSent (void(*func)(LoRaMac &, uint8_t status)) |
RxParamSetupAns MAC command를 송신시 호출될 콜백함수를 지정합니다. More... | |
void | onDevStatusReqReceived (void(*func)(LoRaMac &)) |
DevStatusReq MAC command를 수신시 호출될 콜백함수를 지정합니다. More... | |
void | onDevStatusAnsSent (void(*func)(LoRaMac &, uint8_t bat, uint8_t margin)) |
DevStatusAns MAC command를 송신시 호출될 콜백함수를 지정합니다. More... | |
void | onNewChannelReqReceived (void(*func)(LoRaMac &, const uint8_t *)) |
NewChannelReq MAC command를 수신시 호출될 콜백함수를 지정합니다. More... | |
void | onNewChannelAnsSent (void(*func)(LoRaMac &, uint8_t status)) |
NewChannelAns MAC command를 송신시 호출될 콜백함수를 지정합니다. More... | |
void | onRxTimingSetupReqReceived (void(*func)(LoRaMac &, const uint8_t *)) |
RxTimingSetupReq MAC command를 수신시 호출될 콜백함수를 지정합니다. More... | |
void | onRxTimingSetupAnsSent (void(*func)(LoRaMac &)) |
RxTimingSetupReq MAC command를 수신시 호출될 콜백함수를 지정합니다. More... | |
Public Member Functions inherited from PacketRadio | |
error_t | send (RadioPacket *frame) |
frame 을 전송합니다. More... | |
error_t | cancelSend (RadioPacket *frame) |
frame 전송을 취소합니다. More... | |
void | onSendDone (void(*sendDoneHandler)(PacketRadio &, RadioPacket *)) |
전송이 완료될 때 호출될 함수를 지정합니다. More... | |
uint8_t | getNumPendingSendFrames () |
전송 대기 중인 프레임 갯수를 구합니다. More... | |
void | onReceive (void(*receiveHandler)(PacketRadio &, const RadioPacket *)) |
수신이 완료될 때 호출될 함수를 지정합니다. More... | |
void | setEventListener (PacketRadioEventListener &) |
전송 완료 및 수신 이벤트에 대해 PacketRadioEventListener 를 구현한 클래스로 콜백합니다. More... | |
Additional Inherited Members | |
Public Types inherited from LoRaMac | |
enum | DeviceClass_t { CLASS_A = 0 , CLASS_B = 1 , CLASS_C = 2 } |
enum | BatteryLevel_t { BAT_LEVEL_EXT_SRC = 0x00 , BAT_LEVEL_EMPTY = 0x01 , BAT_LEVEL_FULL = 0xFE , BAT_LEVEL_NO_MEASURE = 0xFF } |
enum | { ERROR_INVALID_FREQUENCY = -100 , ERROR_INVALID_DATARATE = -101 , ERROR_INVALID_FREQ_AND_DR = -102 } |
enum | MacCmd_t { MAC_CMD_LINK_CHECK = 0x02 , MAC_CMD_LINK_ADR = 0x03 , MAC_CMD_DUTY_CYCLE = 0x04 , MAC_CMD_RX_PARAM_SETUP = 0x05 , MAC_CMD_DEV_STATUS = 0x06 , MAC_CMD_NEW_CHANNEL = 0x07 , MAC_CMD_RX_TIMING_SETUP = 0x08 , MAC_CMD_TX_PARAM_SETUP = 0x09 , MAC_CMD_DL_CHANNEL = 0x0A , MAC_CMD_DEV_TIME = 0x0D } |
Public Types inherited from PacketRadio | |
enum | { TX_FIFO_SIZE = 10 , RX_FIFO_SIZE = 10 , TX_DONE_FIFO_SIZE = 10 } |
Public Attributes inherited from LoRaMac | |
uint8_t const | MaxNumChannels |
최대 채널 수 | |
const DatarateParams_t * | DR_TABLE |
uint8_t const | MaxDatarate |
최대 datarate index | |
uint8_t const | MinTxPower |
Minimum Tx power index. | |
uint8_t const | MaxTxPower |
Maximum Tx power index. | |
uint8_t const | AdrAckLimit |
ADR_ACK_LIMIT. | |
uint8_t const | AdrAckDelay |
ADR_ACK_DELAY. | |
uint32_t const | MAX_FCNT_GAP |
uint16_t const | RadioWakeupTime |
bool | useADR = true |
ADR 사용여부를 설정합니다. More... | |
bool | receivesDuplicate = false |
중복 프레임을 수신 여부를 설정합니다. More... | |
bool | framePending = false |
Frame pending. More... | |
void(* | onMACCommandReceived )(LoRaMac &mac, MacCmd_t cid, const uint8_t *reqData, int16_t reqLen, const uint8_t *ansData, int16_t ansLen) = nullptr |
MAC command 수신시 호출될 함수 포인터 More... | |
void(* | onMACCommandSend )(LoRaMac &mac, MacCmd_t cid, const uint8_t *data, uint8_t len) = nullptr |
MAC command 송신시 호출될 함수 포인터 More... | |
Protected Types inherited from LoRaMac | |
enum | FrameType_t { FRAME_TYPE_JOIN_REQ = 0x00 , FRAME_TYPE_JOIN_ACCEPT = 0x01 , FRAME_TYPE_DATA_UNCONFIRMED_UP = 0x02 , FRAME_TYPE_DATA_UNCONFIRMED_DOWN = 0x03 , FRAME_TYPE_DATA_CONFIRMED_UP = 0x04 , FRAME_TYPE_DATA_CONFIRMED_DOWN = 0x05 , FRAME_TYPE_RFU = 0x06 , FRAME_TYPE_PROPRIETARY = 0x07 } |
enum | { ADR_ACK_LIMIT = 64 , ADR_ACK_DELAY = 32 , PHY_PAYLOAD_MAX_LENGTH = 255 , MAC_COMMAND_MAX_LENGTH = 15 , FRM_PAYLOAD_MAX_LENGTH = 242 } |
enum | EventInfoStatus_t { EVENT_INFO_STATUS_OK = 0 , EVENT_INFO_STATUS_ERROR , EVENT_INFO_STATUS_TX_TIMEOUT , EVENT_INFO_STATUS_RX1_TIMEOUT , EVENT_INFO_STATUS_RX2_TIMEOUT , EVENT_INFO_STATUS_JOIN_FAIL , EVENT_INFO_STATUS_DOWNLINK_REPEATED , EVENT_INFO_STATUS_ADDRESS_FAIL , EVENT_INFO_STATUS_MIC_FAIL , EVENT_INFO_STATUS_CHANNEL_BUSY } |
enum | { MAC_IDLE = 0x00000000ul , MAC_TX_RUNNING = 0x00000001ul , MAC_RX = 0x00000002ul , MAC_ACK_REQ = 0x00000004ul , MAC_ACK_RETRY = 0x00000008ul , MAC_TX_DELAYED = 0x00000010ul , MAC_TX_CONFIG = 0x00000020ul } |
enum | FCntDownStatus_t { NEW_FCNT_OK = 0 , NEW_FCNT_DUPLICATE , NEW_FCNT_MAX_GAP_EXCEEDED } |
Protected Member Functions inherited from LoRaMac | |
virtual void | applyTxParamSetup (uint8_t payload) |
virtual bool | checkTxFrame (LoRaMacFrame *frame) |
virtual void | sendDone (RadioPacket *frame, RadioPacket::Result_t) |
virtual void | receive (LoRaMacFrame *frame) |
virtual void | notifyJoin () |
int8_t | getChannelIndex (uint32_t frequency) |
int8_t | getDatarateIndex (DatarateParams_t &dr) |
int8_t | getDatarateIndex (LoRaMacFrame &f) |
int8_t | getDatarateIndex (LoRaMacFrame *f) |
bool | checkTxFrame (RadioPacket *frame) |
void | handleRxFrame (RadioPacket *frame) |
void | log (const char *name, const char *msg) |
void | logTx (const char *name, uint32_t freq, uint8_t drIndex, int8_t power) |
void | logRx (const char *name, uint32_t freq, uint8_t drIndex, uint8_t window) |
error_t | setupRxWindow (uint8_t slot) |
void | onRxWindow2TimerEvent () |
virtual FCntDownStatus_t | getFCntDown (uint16_t fCntFHDR, uint32_t &newFCnt) |
bool | requestsAck () |
virtual void | eventTxDelayed () |
void | computeRxWindowParameters (uint8_t drIndex, uint16_t *timeout, int16_t *offset, uint8_t minRxSymbols=6, uint32_t systemMaxRxError=10) |
Protected Member Functions inherited from PacketRadio | |
virtual void | receive (RadioPacket *frame) |
RadioPacket * | getNextTxFrame () |
error_t | enqueueTxFrame (RadioPacket *frame) |
virtual void | notifySendDone (RadioPacket *frame) |
virtual void | notifyReceive (RadioPacket *frame) |
Static Protected Member Functions inherited from LoRaMac | |
static void | OnTxDelayedTimerEvent (void *) |
static void | OnMacStateCheckTimerEvent (void *) |
Protected Attributes inherited from LoRaMac | |
bool | PublicNetwork = true |
bool | RepeaterSupport = false |
bool | joining = false |
bool | isLinkCheckRequested = false |
bool | isDeviceTimeRequested = false |
bool | serverAckRequested = false |
bool | DutyCycleOn |
bool | ackTimeoutRetry = false |
bool | stateCheckerPosted = false |
bool | isOptNegSet = false |
LoRaRadioChip & | Radio |
std::array< uint8_t, 8 > | devEui |
std::array< uint8_t, 8 > | appEui |
std::array< uint8_t, 16 > | appKey |
std::array< uint8_t, 16 > | nwkSKey |
std::array< uint8_t, 16 > | appSKey |
uint16_t | LoRaMacDevNonce |
int32_t | netID = -1 |
uint32_t | LoRaMacDevAddr |
MulticastParams_t * | MulticastChannels = NULL |
DeviceClass_t | deviceClass = CLASS_A |
uint8_t | Buffer [PHY_PAYLOAD_MAX_LENGTH] |
uint16_t | BufferPktLen = 0 |
uint8_t | LoRaMacPayload [PHY_PAYLOAD_MAX_LENGTH] |
uint32_t | UpLinkCounter = 1 |
uint32_t | DownLinkCounter = 0 |
uint32_t | AdrAckCounter = 0 |
uint8_t | MacCommandsBufferIndex = 0 |
uint8_t | MacCommandsBuffer [MAC_COMMAND_MAX_LENGTH] |
struct { | |
uint32_t Frequency | |
uint8_t Datarate | |
} | Rx2Channel |
uint8_t | Rx1DrOffset = 0 |
int8_t | ChannelsTxPower |
int8_t | ChannelsDatarate |
int8_t | ChannelsDefaultDatarate |
uint8_t | ChannelsNbRepDefault = 1 |
uint8_t | ChannelsNbRep |
uint8_t | ChannelsNbRepCounter = 0 |
uint8_t | MaxDCycle = 0 |
uint16_t | AggregatedDCycle = 1 |
uint32_t | AggregatedLastTxDoneTime = 0 |
uint32_t | AggregatedTimeOff = 0 |
uint8_t | currentCH |
uint32_t | LoRaMacState = MAC_IDLE |
Timer | MacStateCheckTimer |
uint8_t(* | getBatteryLevel )() |
Timer | TxDelayedTimer |
Timer | RxWindowTimer1 |
Timer | RxWindowTimer2 |
Timer | TxTimeoutTimer |
uint16_t | ReceiveDelay1 |
uint16_t | ReceiveDelay2 |
uint16_t | JoinAcceptDelay1 |
uint16_t | JoinAcceptDelay2 |
uint16_t | rxWindow1Delay |
uint16_t | rxWindow2Delay |
uint16_t | rxWindow1Timeout |
uint16_t | rxWindow2Timeout |
int16_t | rxWindow1Offset |
int16_t | rxWindow2Offset |
Timer | AckTimeoutTimer |
uint8_t | AckTimeoutRetries = 1 |
uint8_t | AckTimeoutRetriesCounter = 1 |
uint32_t | TxTimeOnAir |
struct { | |
EventInfoStatus_t Status | |
} | McpsIndication |
struct { | |
EventInfoStatus_t Status | |
bool AckReceived | |
uint32_t UpLinkCounter | |
} | McpsConfirm |
struct timeval | tDevTimeRequested |
RTCCalendar * | rtc = NULL |
uint8_t | RxSlot = 0 |
bool | isMcpsReq = false |
bool | isMcpsInd = false |
bool | isMacDone = false |
LoRaMacFrame * | txFrame = NULL |
LoRaMacFrame * | rxFrame = NULL |
void(* | joinHandler )(LoRaMac &, bool result, const uint8_t *devEui, const uint8_t *appEui, const uint8_t *appKey, const uint8_t *nwkSKey, const uint8_t *appSKey, uint32_t devAddr, const RadioPacket &frame, uint32_t airTime) = NULL |
void(* | receiveErrorFrameHandler )(LoRaMac &, const RadioPacket &frame) = nullptr |
Protected Attributes inherited from PacketRadio | |
Queue< RadioPacket * > | txFifo |
Queue< RadioPacket * > | rxFifo |
Queue< RadioPacket * > | txDoneFifo |
void(* | callbackSendDone )(PacketRadio &, RadioPacket *) |
void(* | callbackReceive )(PacketRadio &, const RadioPacket *) |
PacketRadioEventListener * | eventListener |
|
virtual |
Add a channel.
Adds a new channel to the channel list and activates the id in the channel mask. The frequency and DR specified in the params
MUST be valid values for each regional parameters specification.
[IN] | id - Id of the channel. |
[IN] | params - Channel parameters to set. |
Implements LoRaMac.
|
virtual |
채널 정보를 가져옵니다.
index | 채널 번호 (0 ~ MaxNumChannels) |
다음 예제와 같이 현재 설정된 채널 정보들을 출력할 수 있습니다.
Implements LoRaMac.
|
overridevirtual |
최대 application payload 길이(N)를 가져옵니다.
dr | DR index |
repeater | Repeater mode 사용 여부 |
최대 application payload 길이(N)는 최대 payload 길이(M)에서 FOpt 길이를 뺀 값입니다. FOpt의 길이는 최소 8-byte 이며 더 커질 수도 있습니다.
Implements LoRaMac.
|
virtual |
LoRaMAC channel remove service.
Deactivates the id in the channel mask.
[IN] | id - Id of the channel. |
Implements LoRaMac.