License#

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

SPDX-License-Identifier: Zlib

The licensor of this software is Silicon Laboratories Inc.

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

  3. This notice may not be removed or altered from any source distribution.

/***************************************************************************/
#ifndef _MAILBOX_CLIENT_H_
#define _MAILBOX_CLIENT_H_

#include "mailbox/mailbox-protocol.h"
#include "mailbox/mailbox-types.h"

EmberAfMailboxStatus emberAfPluginMailboxClientMessageSubmit(EmberNodeId mailboxServer,
                                                             EmberNodeId messageDestination,
                                                             uint8_t *message,
                                                             EmberMessageLength messageLength,
                                                             uint8_t tag,
                                                             bool useSecurity);

EmberAfMailboxStatus emberAfPluginMailboxClientCheckInbox(EmberNodeId mailboxServer,
                                                          bool useSecurity);

//------------------------------------------------------------------------------
// Callbacks

void emberAfPluginMailboxClientMessageSubmitCallback(EmberAfMailboxStatus status,
                                                     EmberNodeId mailboxServer,
                                                     EmberNodeId messageDestination,
                                                     uint8_t tag);

void emberAfPluginMailboxClientMessageDeliveredCallback(EmberAfMailboxStatus status,
                                                        EmberNodeId mailboxServer,
                                                        EmberNodeId messageDestination,
                                                        uint8_t tag);

void emberAfPluginMailboxClientCheckInboxCallback(EmberAfMailboxStatus status,
                                                  EmberNodeId mailboxServer,
                                                  EmberNodeId messageSource,
                                                  uint8_t *message,
                                                  EmberMessageLength messageLength,
                                                  uint8_t tag,
                                                  bool moreMessages);

#endif // _MAILBOX_CLIENT_H_

Callbacks#

void
emberAfPluginMailboxClientMessageSubmitCallback(EmberAfMailboxStatus status, EmberNodeId mailboxServer, EmberNodeId messageDestination, uint8_t tag)

Mailbox Client Message Submit Callback.

void
emberAfPluginMailboxClientMessageDeliveredCallback(EmberAfMailboxStatus status, EmberNodeId mailboxServer, EmberNodeId messageDestination, uint8_t tag)

Mailbox Client Message Delivered Callback.

void
emberAfPluginMailboxClientCheckInboxCallback(EmberAfMailboxStatus status, EmberNodeId mailboxServer, EmberNodeId messageSource, uint8_t *message, EmberMessageLength messageLength, uint8_t tag, bool moreMessages)

Mailbox Client Check Inbox Callback.

Functions#

emberAfPluginMailboxClientMessageSubmit(EmberNodeId mailboxServer, EmberNodeId messageDestination, uint8_t *message, EmberMessageLength messageLength, uint8_t tag, bool useSecurity)

Submit a data message to a mailbox server. If this API returns an EmberAfMailboxStatus value of EMBER_MAILBOX_STATUS_SUCCESS, the corresponding asynchronous callback emberAfPluginMailboxClientMessageSubmitCallback() will be invoked to indicate whether the message was successfully submitted to the mailbox server or to inform the application of the reason of failure.

emberAfPluginMailboxClientCheckInbox(EmberNodeId mailboxServer, bool useSecurity)

Query a mailbox server for pending messages. If this API returns an EmberAfMailboxStatus value of EMBER_MAILBOX_STATUS_SUCCESS, the corresponding asynchronous callback emberAfPluginMailboxClientCheckInboxCallback() will be invoked either to provide the retrieved message or to indicate the reason for failure.

Callbacks Documentation#

emberAfPluginMailboxClientMessageSubmitCallback#

void emberAfPluginMailboxClientMessageSubmitCallback (EmberAfMailboxStatus status, EmberNodeId mailboxServer, EmberNodeId messageDestination, uint8_t tag)

Mailbox Client Message Submit Callback.

Parameters
[in]status

An EmberAfMailboxStatus value of:

[in]mailboxServer

The node ID of the mailbox server.

[in]messageDestination

The node ID of the destination.

N/Atag

The tag value passed in the emberAfPluginMailboxClientMessageSubmit() API.

A callback invoked when a message arrived to the mailbox server after a call of emberAfPluginMailboxClientMessageSubmit().

Note

  • Receiving this callback requires the reception of a mailbox command message, which is only possible by polling if the message was submitted on a EMBER_STAR_SLEEPY_END_DEVICE.


Definition at line 168 of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/mailbox/mailbox-client/mailbox-client.h

emberAfPluginMailboxClientMessageDeliveredCallback#

void emberAfPluginMailboxClientMessageDeliveredCallback (EmberAfMailboxStatus status, EmberNodeId mailboxServer, EmberNodeId messageDestination, uint8_t tag)

Mailbox Client Message Delivered Callback.

Parameters
[in]status

An EmberAfMailboxStatus value of:

[in]mailboxServer

The node ID of the mailbox server where the message was submitted to.

[in]messageDestination

The node ID of the destination.

[in]tag

The tag value passed in the emberAfPluginMailboxClientMessageSubmit() API.

A callback that may be invoked on the submitter of the message either if the message that was submitted to a mailbox server reached its final destination or it timed-out. Note that the callback is not always called. If the status message from the server is lost, the callback won't be called.

Note

  • Receiving this callback requires the reception of a mailbox command message, which is only possible by polling if the message was submitted on a EMBER_STAR_SLEEPY_END_DEVICE.


Definition at line 199 of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/mailbox/mailbox-client/mailbox-client.h

emberAfPluginMailboxClientCheckInboxCallback#

void emberAfPluginMailboxClientCheckInboxCallback (EmberAfMailboxStatus status, EmberNodeId mailboxServer, EmberNodeId messageSource, uint8_t * message, EmberMessageLength messageLength, uint8_t tag, bool moreMessages)

Mailbox Client Check Inbox Callback.

Parameters
[in]status

An EmberAfMailboxStatus value of:

[in]mailboxServer

The node id of the mailbox server responding.

[in]messageSource

The source node ID of the retrieved message. Note that this parameter is meaningful only if the status parameter has an EmberAfMailboxStatus value of EMBER_MAILBOX_STATUS_SUCCESS.

[in]message

A pointer to the retrieved message payload. Note that this parameter is meaningful only if the status parameter has an EmberAfMailboxStatus value of EMBER_MAILBOX_STATUS_SUCCESS.

[in]messageLength

The length in bytes of the retrieved message payload. Note that this parameter is meaningful only if the status parameter has an EmberAfMailboxStatus value of EMBER_MAILBOX_STATUS_SUCCESS.

[in]tag

The tag value passed in the emberAfPluginMailboxClientMessageSubmit() API. Note that this parameter is meaningful only if the status parameter has an EmberAfMailboxStatus value of EMBER_MAILBOX_STATUS_SUCCESS.

[in]moreMessages

This flag is true if the mailbox server has more pending messages for this mailbox client. Note that this parameter is meaningful only if the status parameter has an EmberAfMailboxStatus value of EMBER_MAILBOX_STATUS_SUCCESS.

This callback is invoked after a successful call to the emberAfPluginMailboxClientCheckInbox() API. If a message was retrieved from the mailbox server, this callback passes it to the application. Otherwise, it indicates the reason for failure to the application.

Note

  • Receiving this callback requires the reception of a mailbox command message, which is only possible by polling if the message was submitted on a EMBER_STAR_SLEEPY_END_DEVICE.


Definition at line 250 of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/mailbox/mailbox-client/mailbox-client.h

Function Documentation#

emberAfPluginMailboxClientMessageSubmit#

EmberAfMailboxStatus emberAfPluginMailboxClientMessageSubmit (EmberNodeId mailboxServer, EmberNodeId messageDestination, uint8_t * message, EmberMessageLength messageLength, uint8_t tag, bool useSecurity)

Submit a data message to a mailbox server. If this API returns an EmberAfMailboxStatus value of EMBER_MAILBOX_STATUS_SUCCESS, the corresponding asynchronous callback emberAfPluginMailboxClientMessageSubmitCallback() will be invoked to indicate whether the message was successfully submitted to the mailbox server or to inform the application of the reason of failure.

Parameters
[in]mailboxServer

The node ID of the mailbox server.

[in]messageDestination

The node ID of the destination for this data message.

[in]message

A pointer to the message to be sent.

[in]messageLength

The length in bytes of the message to be sent.

[in]tag

A tag value which will be returned in all of the corresponding callbacks: emberAfPluginMailboxClientMessageSubmitCallback(), emberAfPluginMailboxClientMessageDeliveredCallback() and emberAfPluginMailboxClientCheckInboxCallback(). The application can use it to match the callbacks with the call.

[in]useSecurity

Set it true if the data message should be sent to the server using security.

Returns

Note

See Also


Definition at line 92 of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/mailbox/mailbox-client/mailbox-client.h

emberAfPluginMailboxClientCheckInbox#

EmberAfMailboxStatus emberAfPluginMailboxClientCheckInbox (EmberNodeId mailboxServer, bool useSecurity)

Query a mailbox server for pending messages. If this API returns an EmberAfMailboxStatus value of EMBER_MAILBOX_STATUS_SUCCESS, the corresponding asynchronous callback emberAfPluginMailboxClientCheckInboxCallback() will be invoked either to provide the retrieved message or to indicate the reason for failure.

Parameters
[in]mailboxServer

The node ID of the mailbox server.

[in]useSecurity

Set it true if the request command and the responses to it should be sent secured. If a pending message was sent to a server securely, it will be always retrieved securely. This option only affects the request command and the pending messages that were sent without security to the server.

Returns

Note


Definition at line 128 of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/mailbox/mailbox-client/mailbox-client.h