Skip to content

05. Layer L7

Sinisha Djukic edited this page Oct 30, 2016 · 4 revisions

L7 Message Port

The reserved message port for L7 Meshwork layer is 0x88 (136 dec).

L7 Payload Structure

Byte Parameter Description
0 Command sequence number
1 Command identifier
2-N Command-specific data

Command Seq notes:

  • Values [0-127] signify a command sequence number
  • Bit 7 set to high to denote that more response will follow. Bit 7 will further be referred to as MCFLAG (Multi-Command Flag)
  • When bit 7 set to low means this was a last response to the specified command sequence

Command ID notes:

  • Values [0-127] signify a valid command ID
  • Bit 7 set to high to denote that the request is related to the command's meta information. Bit 7 will further be referred to as METAFLAG
  • For the Meshwork-defined commands, the METAFLAG is only valid for PROPERTY_GET and PROPERTY_REP commands. Its usage elsewhere must result in ACK(Invalid)
  • Command ID values [0-31] are reserved for Meshwork.

L7 Payload Commands

Only the following commands are defined by Meshwork. Custom commands can be added and handled by subclasses, as long as they reside outside of the Meshwork-reserved command range.

Generic Commands - Required

  • ACK: mandatory immediate response to PROPERTY_GET, PROPERTY_SET, and META_XXX_GET

PROPERTY Commands - Required

  • PROPERTY_GET
  • PROPERTY_REP
  • PROPERTY_SET

META Commands - Recommended

These are not mandatory, but highly recommended:

  • META_DEVICE_GET
  • META_DEVICE_REP
  • META_CLUSTER_GET
  • META_CLUSTER_REP
  • META_ENDPOINT_GET
  • META_ENDPOINT_REP

The reason why these are not required is to reduce the code size in wall-gardened environments, where cluster definitions and IDs are hard-coded at both the data producer and the consumer.

Command Specification

Generic Commands

ACK Command

Byte Parameter Description
0 Command sequence number
1 ACK Message acknowledge
2 Message status
3-N Status-specific data (optional)

Status:

  • Processed. MCFLAG must be low, since no further response is expected
  • Data: N/A
  • Invalid. MCFLAG must be low, since no further response is expected
  • Data: N/A
  • Forbidden. MCFLAG must be low, since no further response is expected
  • Data: N/A
  • Scheduled: scheduled for processing. MCFLAG must be high, as the sender should expect a response
  • Data: approx. millis (16-bit) after which the message will be processed
  • Not supported. MCFLAG must be low, since no further response is expected <<< TODO
  • Data: N/A

PROPERTY Commands

PROPERTY_GET Command

Byte Parameter Description
0 Command sequence number
1 PROPERTY_GET Get a property value
2 Cluster number
3 Endpoint number

PROPERTY_REP Command

Byte Parameter Description
0 Command sequence number
1 PROPERTY_REP Report a property value
2 Cluster number
3 Endpoint number
4-N Endpoint type/subtype-specific data

PROPERTY_SET Command

Byte Parameter Description
0 Command sequence number
1 PROPERTY_SET Set a property value
2 Cluster number
3 Endpoint number
4-N Endpoint type/subtype-specific data

META Commands

Note that Cluster=0xFF and Endpoint=0xFF are reserved.

META_DEVICE_GET Command

Byte Parameter Description
0 Command sequence number
1 META_DEVICE_GET Device metadata information
2 Additional request flags

Flags:

  • 7b: Return information for all Endpoints (only if 0b set). Each META_CLUSTER_REP will be followed by META_ENDPOINT_REP for all contained endpoints
  • 6b: Return information for all Clusters. META_DEVICE_REP will be followed by META_CLUSTER_REP for all contained clusters
  • 0-5b: Reserved/ignored

META_DEVICE_REP Command

Byte Parameter Description
0 Command sequence number
1 META_DEVICE_REP Report device metadata information
2 Device type
3 Device subtype
4 Number of clusters
5-N Additional device data. Reserved

MCFLAG must be set for all but the last message in the series if META_DEVICE_GET has Flags 7b and/or 6b set.

META_CLUSTER_GET Command

Byte Parameter Description
0 Command sequence number
1 META_CLUSTER_GET Required metadata information
2 Additional request flags
3 Cluster number

Cluster:

  • 0xFF: Return information for all Clusters. META_DEVICE_REP will be followed by META_CLUSTER_REP for all contained clusters. Flag 6b must be set
  • 0x00-0xFE: A valid cluster number

Flags:

  • 7b: Return information for all Endpoints (only if 0b set). Each META_CLUSTER_REP will be followed by META_ENDPOINT_REP for all contained endpoints
  • 6b: Return information for all Clusters
  • 0-6b: Reserved/ignored

META_CLUSTER_REP Command

Byte Parameter Description
0 Command sequence number
1 META_CLUSTER_REP Report metadata information
2 Cluster number
3 Cluster type
4 Cluster subtype
5 Total number of endpoints

MCFLAG must be set for all but the last message in the series if META_CLUSTER_REP has Flags 7b and/or 6b set.

META_ENDPOINT_GET Command

Byte Parameter Description
0 Command sequence number
1 META_ENDPOINT_GET Required metadata information
2 Additional request flags
3 Cluster number
4 Endpoint number

Cluster:

  • 0x00-0xFE: A valid cluster number

Flags:

  • 7b: Return information for all Endpoints (only if 0b set)
  • 0-6b: Reserved/ignored

META_ENDPOINT_REP Command

Byte Parameter Description
0 Command sequence number
1 META_ENDPOINT_REP Report metadata information
2 Cluster number
3 Endpoint number
4-5 Endpoint type
6-7 Unit type for the endpoint values

MCFLAG must be set for all but the last message in the series if META_ENDPOINT_REP has Flags 7b and/or 6b set.

Endpoint Type values [0x0000-0x7FFF] are reserved for Meshwork. Unit Type values [0x0000-0x7FFF] are reserved for Meshwork.