Acknowledgements

Some message codes require an acknowledgement from the receiver. In this case, the receiver should send either an acknowledgement (ACK) or negative-acknowledgement (NAK) within 1 second of receiving the message.

Message Group Name Value
Acknowledgement 0xFF
Acknowledgement Code Name Value
ACK 0x01
NAK 0x02

Acknowledgments should be sent directly after message is received so that the sender can act accordingly. An acknowledgment should contain the message group , code and current state for the message that it is referencing. For example, if the Provider receives a message containing the ring action (0x04010002013C), it should acknowledge the action by sending back 0xFF0100040401013C where:

  • 0xFF: ACK event
  • 0x01: ACK code
  • 0x0004: Additional data length
  • 0x0401: The action message group and code
  • 0x013C: The current state of the action message group and code, ring right and 60 seconds timeout

For a NAK, the reason should also be included as the first byte of additional data. Reasons include:

  • 0x00: Not supported
  • 0x01: Device busy
  • 0x02: Not allowed due to current state
  • 0x03: Not allowed due to incorrect message authentication code
  • 0x04: Redundant device action

From the previous example, if the ring were to be NAK'ed instead due to the Provider being busy with another task, the returned packet should be set to 0xFF02000401040100 where

  • 0xFF: ACK event
  • 0x02: NAK code
  • 0x0004: Additional data length
  • 0x01: NAK reason, Device busy
  • 0x0401: The action message group and code
  • 0x00: The current state of the action message group and code, all components stop ringing

Example:

#define FP_MSG_ACK                                  0x01
#define FP_MSG_NAK                                  0x02
#define FP_MSG_GROUP_ACK                            0xFF


static void fp_msg_send_ack(uint8_t msgGroup, uint8_t msgCode)
{
    FP_MESSAGE_STREAM  req = {FP_MSG_GROUP_ACK, FP_MSG_ACK, 0, 2};

    req.data[0] = msgGroup;
    req.data[1] = msgCode;

   fp_send((uint8_t *)&req);
}

static void fp_msg_send_nak(uint8_t reason, uint8_t msgGroup, uint8_t msgCode)
{
//reason= 0x00: Not supported, 0x01: Device busy, or 0x02: Not allowed due to current state
    FP_MESSAGE_STREAM  req = {FP_MSG_GROUP_ACK, FP_MSG_NAK, 0, 3};

    req.data[0] = reason;
    req.data[1] = msgGroup;
    req.data[2] = msgCode;

   fp_send((uint8_t *)&req);
}