[mle] add enhanced keep-alive (#4325)

This commit introduces the first Thread 1.2 feature - enhanced keep
alive.

This commit also introduces the build config
OPENTHREAD_CONFIG_THREAD_VERSION to include/exclude Thread 1.2 code.
This commit is contained in:
Yakun Xu
2020-02-24 21:03:19 -08:00
committed by GitHub
parent ff3033f24f
commit b01754cabf
25 changed files with 725 additions and 30 deletions
+12
View File
@@ -354,6 +354,10 @@ class Message(object):
ipv6.UDPDatagram)
return self.ipv6_packet.upper_layer_protocol.header.dst_port
def is_data_poll(self):
return self._type == MessageType.COMMAND and \
self._mac_header.command_type == mac802154.MacHeader.CommandIdentifier.DATA_REQUEST
def __repr__(self):
if (self.type == MessageType.DTLS and
self.dtls.content_type == dtls.ContentType.HANDSHAKE):
@@ -375,6 +379,14 @@ class MessagesSet(object):
def commissioning_messages(self):
return self._commissioning_messages
def next_data_poll(self):
while True:
message = self.next_message_of(MessageType.COMMAND, False)
if not message:
break
elif message.is_data_poll():
return message
def next_coap_message(self, code, uri_path=None, assert_enabled=True):
message = None