- PD-SAP 物理层数据服务访问点
- PLME-SAP 物理层管理试题服务访问点
- MLDE-SAP MAC层数据实体SAP
- MLME-SAP MAC层管理实体SAP
- NLDE-SAP 网络层数据实体SAP，向APS层提供的服务接口
- NLME-SAP 网络层管理实体SAP，向ZDO管理面板提供的服务接口
- APSDE-SAP 应用支持子层（APS）数据实体SAP，向应用层和ZDO提供的服务接口
- APSME-SAP 应用支持子层（APS）管理实体SAP，向ZDO管理面板提供的服务接口
Beacon is a message with specific format that is used to synchronize the clocks of the nodes in the network.This is called a beacon-enabled PAN . The disadvantage of using beacons is that all the devices in the network must wake up on a regular basis, listen for the beacon, synchronize their clocks, and go back to sleep. This means that many of the devices in the network may wake up only for synchronization and not perform any other task while they are active.
A network in which the PAN coordinator does not transmit beacons is known as a nonbeacon network . A nonbeacon network cannot have GTSs and therefore contention-free periods because the devices cannot be synchronized with one another. The battery life in a nonbeacon network can be noticeably better than in a beacon-enabled network because in a nonbeacon network, the devices wake up less often.
The Network (NWK) layer of the ZigBee protocol assigns a 16-bit NWK address in addition to the IEEE address. A simple lookup table is used to map each 64-bit IEEE address to a unique NWK address. The NWK layer transactions require the use of the NWK address.
Binding is the task of creating logical links between the applications that are related. For example, a ZigBee device connected to a lamp is logically related to another ZigBee device connected to the switch that controls the lamp. The information regarding these logical links is stored in a binding table . The ZigBee standard, at the application layer, provides support for creating and maintaining binding tables. Devices logically related in a binding table are called bound devices .
The IEEE 802.15.4 defines four MAC frame structures:
The MAC acknowledgment frame is the simplest frame format and does not carry any MAC payload. The acknowledgment frame is sent by one device to another to confirm successful reception of a packet.
The MAC commands such as requesting association or disassociation with a network are transmitted using the MAC command frame
The NWK layer interfaces between the MAC and the APL and is responsible for managing the network formation and routing.
The application (APL) layer is the highest protocol layer in the ZigBee wireless network and hosts the application objects. Manufacturers develop the application objects to customize a device for various applications. Application objects control and manage the protocol layers in a ZigBee device. There can be up to 240 application objects in a single device.
In a wireless network, the transmitted messages can be received by any nearby device, including an intruder. There are two main security concerns in a wireless network. The first one is data confidentiality . The intruder device can gain sensitive information by simply listening to the transmitted messages. Encrypting the messages before transmission will solve the confidentiality problem. An encryption algorithm modifies a message using a string of bits known as the security key, and only the intended recipient will be able to recover the original message. The IEEE 802.15.4 standard supports the use of Advanced Encryption Standard (AES)  to encrypt their outgoing messages.
The second concern is that the intruder device may modify and resend one of the previous messages even if the messages are encrypted. Including a message integrity code (MIC) with each outgoing frame will allow the recipient to know whether the message has been changed in transit. This process is known as data authentication .
When a device plans to transmit a message, it first goes into the receive mode to detect and estimate the signal energy level in the desired channel. This task is known as energy detection (ED).
PPDU: PHY Protocol Data Unit
PLME: Physical Layer Management Entity. PLME also maintains the PHY PAN Information Base (PIB).
PD-SAP: PHY Data SAP
The data that needs to be transmitted is always provided as a MAC Protocol Data Unit (MPDU). The local MAC generates the request for transmission and provides the MPDU.
The PHY attempts the transmission and reports the result of the attempt (successful or unsuccessful) to the MAC.
* Radio transciever is disabled (first to be checked)
* Radio transciever is in receive mode. [Radio cannot transmit and receive simultaneously] (second)
* Radio transciever is busy (already engaged in transimiting) (third)
The PHY not only provides the MPDU to the MAC layer, it also delivers the LQI information.
On the receiver side, the data is passed upward from one layer to the next higher layer and the header and footers are removed until the DU reaches the intended layer at the destination.
PLME-SAP is utilized to transport commands between MLME and PLME. The services provided through the PLME-SAP are:
The IEEE 802.15.4 and ZigBee standards use the concept of primitives to describe the services that a layer provides to the service user in the next higher layer.
The communications between the adjacent protocol layers are managed by calling functions or passing messages, called primitives , between the layers.
Although each layer has a different role in the overall system, the way each layer operates has some similarities to other layers. Because of these similarities, service primitives are found to be useful in describing the capabilities of each standard protocol layer. Each primitive specifies the action to be performed or provides the result of a previously requested action. A primitive may also carry the parameters needed to perform its task.
The PHY layer is the closest layer to hardware and directly controls and communicates with the radio transceiver.
The IEEE 802.15.4 is not developed specifically for ZigBee applications, and the next higher layer can be any networking protocol layer. In this book, the MAC services are discussed in interfacing with the ZigBee NWK layer.
The MAC also has its own database, referred to as the MAC PAN Information Base (MAC-PIB). All the MAC constants have a general prefix of a . The MAC attributes have a general prefix of mac . The size of the MAC-PIB is larger than the PHY-PIB.
One of the advantages of a beacon-enabled network is the availability of guaranteed time slots (GTSs). The beacon frames are MAC frames that contain beacon information such as the time interval between the beacons and number of GTSs.
In beacon-enabled operation, it is possible to use a superframe structure. A superframe, shown in Figure 3.7 , is bounded by two beacon frames. The use of a superframe structure is optional in the IEEE 802.15.4 standard. There can be up to three types of periods in a superframe: the contention access period (CAP), the contention-free period (CFP), and the inactive period.
In transmitting data from one device to another, the transmitting device must wait briefly between its successive transmitted frames to allow the recipient device process a received frame before the next frame arrives. This is known as interframe spacing (IFS).
RTS/CTS handshake mechanism are suggested methods for overcoming the hidden or exposed node problem.
There are two types of service provided by MAC layer:
The MAC data service is accessed by the NWK Layer Data Entity (NLDE) through the MAC Common Part Sublayer SAP (MCPS-SAP). The MAC management service is accessed through MLME-SAP.
The NWK generates the request for the data transmission through MCPS-SAP and provides the NPDU.
To keep track of different MSDUs in a device, each MSDU is associated with a unique MSDU handle ( msduhandle ). The msduhandle is an integer number that identifies the MSDU.
The data sequence number (DSN) may be used as msduhandle . The DSN is a MAC attribute stored in the MAC-PIB ( macDSN ). The initial value of the macDSN is a random number. Each time a data frame or a MAC command frame is generated, the MAC sublayer copies the value of macDSN into the outgoing frame and increments the macDSN by one.
The MSDU can be purged from the transaction queue if requested by the NWK layer.
//to be continued