Nol.A SDK Library
24.11.0
For IoT System Software Development
|
IEEE 802.15.4e TSCH (Time Slotted Channel Hopping) mode MAC. More...
#include <TSCHMac.hpp>
Public Types | |
enum | { LINK_TRANSMIT = (1 << 0) , LINK_RECEIVE = (1 << 1) , LINK_SHARED = (1 << 2) , LINK_TIMEKEEPING = (1 << 3) } |
Public Member Functions | |
virtual void | begin (PacketRadioChip &chip, uint16_t panId, uint16_t nodeId, const uint8_t *eui64=nullptr, bool isCoordinator=false) |
TSCHMac 을 초기화합니다. More... | |
void | setHoppingSequence (uint8_t hopSeqId, uint16_t hopSeqListLen, const uint16_t *hopSeqList, int32_t(*channelConverter)(uint16_t channel)) |
채널 hopping sequence를 설정합니다. More... | |
error_t | run () |
Run the TSCH MAC. More... | |
void | reset () |
Reset the TSCH MAC. | |
void | stop () |
Stop the TSCH MAC. | |
error_t | setSlotframe (uint16_t size) |
Set a slotframe. More... | |
uint16_t | getSlotframeSize () |
Get a number of slots in the slotframe. | |
uint16_t | getTimeslotLength () |
Get a timeslot length in unit of usec. | |
error_t | setLink (uint16_t timeslot, uint16_t chOffset, uint8_t linkOpt, IEEE802_15_4Address nodeAddr, bool adv=false) |
Set a link. More... | |
error_t | deleteLink (uint16_t timeslot) |
Delete a link. | |
error_t | getLink (uint16_t timeslot, uint16_t *chOffset, uint8_t *linkOpt, IEEE802_15_4Address *addr, bool *advertising) |
Get a link. | |
void | setTimeslotLength (uint16_t usec) |
Set a timeslot length. More... | |
error_t | sendEnhancedBeacon (IEEE802_15_4Address addr=IEEE802_15_4Address(0xFFFF), bool includeIEs=false) |
Send an Enhanced Beacon. More... | |
error_t | sendEnhancedBeaconRequest () |
Send an Enhanced Beacon Request. | |
error_t | sendKeepaliveRequest (const uint8_t *dstEui64, uint16_t dstShort) |
Send a Keep-Alive request. | |
void | setTimesyncEventHandler (bool(*handler)(TSCHMac &tsch, uint16_t panId, const uint8_t *eui64, uint16_t shortId)) |
Set TSCH time sync information reception event handler to handler to be called when the event is occurred at the radio device. The callee must distinguish whether it is from time source neighbors, or not, and return the result. | |
int64_t | getAsn () |
Get the ASN number. | |
void | setJoinPriority (uint8_t priority) |
Set the join priority. More... | |
void | setListenOnIdle (bool listen) |
Set listen on idle state. | |
bool | isWorking () |
void | onSendDone (void(*sendDoneHandler)(TSCHMac &radio, IEEE802_15_4Frame *frame)) |
void | onReceive (void(*receiveHandler)(TSCHMac &radio, const IEEE802_15_4Frame *frame)) |
Public Member Functions inherited from IEEE802_15_4Mac | |
error_t | send (IEEE802_15_4Frame *frame) |
frame 을 전송합니다. More... | |
error_t | cancelSend (IEEE802_15_4Frame *frame) |
frame 전송을 취소합니다. More... | |
virtual void | onSendDone (void(*sendDoneHandler)(IEEE802_15_4Mac &, IEEE802_15_4Frame *)) |
전송이 완료될 때 호출될 함수를 지정합니다. More... | |
void | onReceive (void(*receiveHandler)(IEEE802_15_4Mac &, const IEEE802_15_4Frame *)) |
수신이 완료될 때 호출될 함수를 지정합니다. More... | |
Static Public Member Functions | |
static TSCHMac * | Create () |
TSCHMac 을 생성합니다. More... | |
Static Public Member Functions inherited from IEEE802_15_4Mac | |
static int32_t | ConvertChToFreq2450MHz (uint16_t channelNumber) |
IEEE 802.15.4-2015 2450MHz 대역 채널번호-주파수 변환 함수 More... | |
static int32_t | ConvertChToFreq917MHzSUN_FSK1 (uint16_t channelNumber) |
IEEE 802.15.4-2015 917~923.5 MHz 대역 SUN FSK operating mode #1 채널번호-주파수 변환 함수 More... | |
Public Attributes | |
void(* | onEBRReceive )(TSCHMac &, IEEE802_15_4Address src, IEEE802_15_4Frame::EnhancedBeaconRequestInfo_t &) = nullptr |
The callback function pointer that is called when EBR reception event is occurred. More... | |
bool(* | onJoin )(TSCHMac &mac, uint16_t panId) = nullptr |
The callback function pointer that is called when join event is occurred. | |
bool(* | onTimesynced )(TSCHMac &mac, IEEE802_15_4Address src) = nullptr |
The callback function pointer that is called when time sync information reception event is occurred. More... | |
IEEE802_15_4Address | src |
int16_t | correction |
bool | confirmed |
Public Attributes inherited from IEEE802_15_4Mac | |
bool | useForceNoAckRequest = false |
전송할 프레임에 대해 강제로 Ack를 요청하지 않게 합니다. More... | |
Protected Member Functions | |
virtual void | signalRxStarted (uint32_t) |
void | signalRxDone (uint32_t) |
void | signalTxDone (bool success, uint32_t) |
void | signalChannelBusy (uint32_t) |
bool | checkTxFrame (IEEE802_15_4Frame *frame) override |
void | handleRxFrame (IEEE802_15_4Frame *frame) override |
virtual uint16_t | eventOnTimeslot (uint16_t maxSkipSlot, uint32_t tickStart) override |
virtual void | eventOnTimeout (uint32_t tickEvent) override |
virtual void | startTimeslotTimer ()=0 |
Start a timeslot timer. More... | |
virtual void | stopTimeslotTimer ()=0 |
Stop a timeslot timer. More... | |
virtual void | correctTimeslot (int16_t timeCorrection)=0 |
Correct timeslot timing. More... | |
virtual void | enableTimeoutTimer (uint32_t)=0 |
virtual void | disableTimeoutTimer ()=0 |
virtual void | debugTxStarted () |
virtual void | debugTxStopped () |
virtual void | debugRxStarted () |
virtual void | debugRxStopped () |
Protected Member Functions inherited from IEEE802_15_4Mac | |
bool | checkTxFrame (RadioPacket *frame) |
void | handleRxFrame (RadioPacket *frame) |
IEEE802_15_4Frame * | getNextTxFrame () |
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) |
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... | |
Protected Member Functions inherited from TSCHMacRunnable | |
virtual bool | isOkToSleep ()=0 |
Protected Attributes | |
uint16_t | devTxDelay = 0 |
uint8_t | macTimeslotTemplateId = 0 |
uint16_t | macTsCcaOffset = 1800 |
uint16_t | macTsCca = 128 |
uint16_t | macTsTxOffset = 2120 |
uint16_t | macTsRxOffset = 1120 |
uint16_t | macTsRxAckDelay = 800 |
uint16_t | macTsTxAckDelay = 1000 |
uint16_t | macTsRxWait = 2200 |
uint16_t | macTsAckWait = 400 |
uint16_t | macTsRxTx = 192 |
uint16_t | macTsMaxAck = 2400 |
uint16_t | macTsMaxTx = 4256 |
uint16_t | macTsTimeslotLength = 10000 |
uint8_t | macSlotframeHandle |
uint16_t | macSlotframeSize |
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 |
Additional Inherited Members | |
Static Public Attributes inherited from IEEE802_15_4Mac | |
static uint16_t | HoppingSequenceList2450MHz [16] |
IEEE 802.15.4-2015 2450 MHz 대역을 위한 macHoppingSequenceList. | |
static uint16_t | HoppingSequenceList917MHzSUN_FSK1 [32] |
IEEE 802.15.4-2015 917~923.5 MHz 대역 SUN FSK operating mode #1 을 위한 macHoppingSequenceList. | |
Protected Types inherited from PacketRadio | |
enum | { TX_FIFO_SIZE = 10 , RX_FIFO_SIZE = 10 , TX_DONE_FIFO_SIZE = 10 } |
IEEE 802.15.4e TSCH (Time Slotted Channel Hopping) mode MAC.
|
virtual |
TSCHMac 을 초기화합니다.
chip | TSCH MAC에서 사용할 PacketRadioChip. |
panId | IEEE 802.15.4 PAN ID |
nodeId | IEEE 802.15.4 2-byte short ID |
eui64 | IEEE 802.15.4 EUI-64 |
isCoordinator | TSCH coordinator로 동작 여부 |
|
protectedpure virtual |
Correct timeslot timing.
timeCorrection | Time correction value in unit of microseconds. |
|
static |
error_t TSCHMac::run | ( | ) |
Run the TSCH MAC.
If the node is a coordinator, TSCH will be started immediately. If the node is a non-coordinator, listening for EBs to join a network will be started. ASN will be reset to 0.
error_t TSCHMac::sendEnhancedBeacon | ( | IEEE802_15_4Address | addr = IEEE802_15_4Address(0xFFFF) , |
bool | includeIEs = false |
||
) |
Send an Enhanced Beacon.
addr | Destination node address |
includeIEs | Include all TSCH IEs in the Enhanced Beacon frame if true. |
void TSCHMac::setHoppingSequence | ( | uint8_t | hopSeqId, |
uint16_t | hopSeqListLen, | ||
const uint16_t * | hopSeqList, | ||
int32_t(*)(uint16_t channel) | channelConverter | ||
) |
채널 hopping sequence를 설정합니다.
hopSeqId | Hopping sequence ID (macHoppingSequenceId). |
hopSeqListLen | Hopping sequence의 길이. |
hopSeqList | Hopping sequence. IEEE802_15_4Mac::HoppingSequenceList2450MHz, IEEE802_15_4Mac::HoppingSequenceList917MHzSUN_FSK1 등을 참고하시기 바랍니다. |
channelConverter | 16-bit 채널 번호를 Hz 단위의 주파수로 변경하기 위한 함수 포인터. 변환함수는 IEEE802_15_4Mac::ConvertChToFreq2450MHz(), IEEE802_15_4Mac::ConvertChToFreq917MHzSUN_FSK1() 등을 참고하시기 바랍니다. |
channelConverter
가 nullptr 인 경우, 16-bit 채널 번호가 PacketRadioChip::setChannel() 에 그대로 적용되므로 채널 호핑이 의도한대로 동작하지 않을 수 있습니다. void TSCHMac::setJoinPriority | ( | uint8_t | priority | ) |
Set the join priority.
error_t TSCHMac::setLink | ( | uint16_t | timeslot, |
uint16_t | chOffset, | ||
uint8_t | linkOpt, | ||
IEEE802_15_4Address | nodeAddr, | ||
bool | adv = false |
||
) |
Set a link.
slotframe | |
timeslot | |
chOffset | |
linkOpt | IEEE 802.15.4e-2012 compatible TSCH link options (macLinkOptions) |
nodeAddr | Address of the node connected to this link (macNodeAddress). Currently, only 16-bit address is supported. |
adv | (Coordinators only) Whether the link is for transmitting unsolicited EBs, or not. |
error_t TSCHMac::setSlotframe | ( | uint16_t | size | ) |
void TSCHMac::setTimeslotLength | ( | uint16_t | usec | ) |
|
protectedpure virtual |
Start a timeslot timer.
The timeslot timer is used to notify start of a timeslot to TSCH MAC layer.
The platform that supports TSCH MAC should implement this function to start the timeslot timer to call tsch_event_on_timeslot() when the timer is expired.
|
protectedpure virtual |
Stop a timeslot timer.
The platform that supports TSCH MAC should implement this function to stop the timeslot timer.
void(* TSCHMac::onEBRReceive) (TSCHMac &, IEEE802_15_4Address src, IEEE802_15_4Frame::EnhancedBeaconRequestInfo_t &) = nullptr |
The callback function pointer that is called when EBR reception event is occurred.
On this callback, the Enhanced Beacon can be sent as a response by calling sendEnhancedBeacon().
bool(* TSCHMac::onTimesynced) (TSCHMac &mac, IEEE802_15_4Address src) = nullptr |
The callback function pointer that is called when time sync information reception event is occurred.
On this callback, a boolean value whether it's ok to sync with the src
or not should be returned.