2.5.3 PRIME Management Protocol

Management Protocol (MNGP) is the standard protocol defined by the PRIME specification. The interface is defined in the mngLayerHost.h file.

To send a message using Management Protocol, follow these steps:

  1. Create a message: mngLay_NewMsg(uint8_tcmd);.
  2. Add one or more of these queries (of the same kind):
    • Get PIB: mngLay_AddGetPibQuery(uint16_t pib, uint8_t index);
    • Set PIB: mngLay_AddSetPib(uint16_t pib, uint16_t length, uint8_t* msg);
    • Reset Statistics: mngLay_AddResetStats(uint16_t pib, uint8_t index);
    • FW Upgrade Message: mngLay_AddFUMsg(uint16_t length, uint8_t* msg);
    • Bridge Message: mngLay_BridgeMsg(uint16_t length, uint8_t* msg);
  3. Send request message: mngLay_SendMsg();.

The command in mngLay_NewMsg must be one of the following:

    /// Protocol ID to serialize (USI)
    #define MNGP_PRIME                     0x00
    #define MNGP_PRIME_GETQRY              0x00
    #define MNGP_PRIME_GETRSP              0x01
    #define MNGP_PRIME_SET                 0x02
    #define MNGP_PRIME_RESET               0x03
    #define MNGP_PRIME_REBOOT              0x04
    #define MNGP_PRIME_FU                  0x05
    #define MNGP_PRIME_EN_PIBQRY           0x06
    #define MNGP_PRIME_EN_PIBRSP           0x07

The query must be consistent with the protocol ID selected in mngLay_NewMsg. An example for sending a MNGP_PRIME_GETQRY message is shown below:

    uint16_t pib_attrib;
    mngLay_NewMsg(MNGP_PRIME_GETQRY);
    mngLay_AddGetPibQuery(pib_attrib, 0);
    mngLay_SendMsg();

There is only one callback, which is set by the following function:

    void mngp_set_rsp_cb(void (*sap_handler)(uint8_t* ptrMsg, uint16_t len));

The only MNGP command sent by the device is MNGP_PRIME_GET_RESP. This callback will retrieve a buffer with the whole MNGP message (USI header and CRC are removed). The user must know the protocol and process the message.