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:
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.
Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
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#
Mailbox Client Message Submit Callback.
Mailbox Client Message Delivered Callback.
Mailbox Client Check Inbox Callback.
Functions#
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.
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.
[in] | status | An EmberAfMailboxStatus value of:
|
[in] | mailboxServer | The node ID of the mailbox server. |
[in] | messageDestination | The node ID of the destination. |
N/A | tag | 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.
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.
[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.
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.
[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.
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.
[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
An EmberAfMailboxStatus value of:
EMBER_MAILBOX_STATUS_SUCCESS if the message was successfully passed to the network layer to be transmitted to the mailbox server.
EMBER_MAILBOX_STATUS_INVALID_CALL if the passed data message is invalid.
EMBER_MAILBOX_STATUS_INVALID_ADDRESS if the server ID or the destination ID is an invalid address.
EMBER_MAILBOX_STATUS_MESSAGE_TOO_LONG if the passed message does not fit in a single mailbox data message.
EMBER_MAILBOX_STATUS_BUSY if the client is still performing a submit message or a query for message action.
EMBER_MAILBOX_STATUS_STACK_ERROR if the network layer refused the message (the outgoing queue is currently full).
Note
Receiving the emberAfPluginMailboxClientMessageSubmitCallback() 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.
See Also
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.
[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
An EmberAfMailboxStatus value of:
EMBER_MAILBOX_STATUS_SUCCESS if the query command was successfully passed to the network layer to be transmitted to the mailbox server.
EMBER_MAILBOX_STATUS_INVALID_ADDRESS if the passed mailbox server short ID is an invalid address.
EMBER_MAILBOX_STATUS_BUSY if the client is still performing a submit message or a query for message action.
EMBER_MAILBOX_STATUS_STACK_ERROR if the network layer refused the command (the outgoing queue is currently full).
Note
Receiving the emberAfPluginMailboxClientCheckInboxCallback() 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.
128
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/mailbox/mailbox-client/mailbox-client.h