mac_mlme_poll.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /**
  2. * Copyright (c) 2016 - 2020 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh.
  3. *
  4. * All Rights Reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. *
  10. * 1. Redistributions of source code must retain the above copyright notice, this
  11. * list of conditions and the following disclaimer.
  12. *
  13. * 2. Redistributions in binary form, except as embedded into a Nordic
  14. * Semiconductor ASA integrated circuit in a product or a software update for
  15. * such product, must reproduce the above copyright notice, this list of
  16. * conditions and the following disclaimer in the documentation and/or other
  17. * materials provided with the distribution.
  18. *
  19. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * 4. This software, with or without modification, must only be used with a
  24. * Nordic Semiconductor ASA integrated circuit.
  25. *
  26. * 5. Any software provided in binary form under this license must not be reverse
  27. * engineered, decompiled, modified and/or disassembled.
  28. *
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  31. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  32. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  33. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  34. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  35. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  36. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  38. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  39. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. *
  41. */
  42. #ifndef MAC_MLME_POLL_H_INCLUDED
  43. #define MAC_MLME_POLL_H_INCLUDED
  44. #include <stdint.h>
  45. #include "mac_common.h"
  46. #include "mac_task_scheduler.h"
  47. /** @file
  48. * The MAC MLME Poll module declares the MAC Poll primitives and necessary types
  49. * according to the MAC specification.
  50. *
  51. * @defgroup mac_poll MAC MLME Poll API
  52. * @ingroup mac_15_4
  53. * @{
  54. * @brief Module to declare MAC MLME Poll API.
  55. * @details The MAC Poll module declares MLME Poll primitives and necessary types according to
  56. * the MAC specification. More specifically, MLME Poll request aka mlme_poll_req(), MLME Poll
  57. * indicaton aka mlme_poll_ind(), and MLME Poll confirm callback typedef aka mlme_poll_conf_cb_t
  58. * primitives are declared.
  59. */
  60. /**@brief MLME-POLL.confirm
  61. *
  62. * @details The MLME-POLL.confirm primitive reports the results of a request
  63. * to poll the coordinator for data.
  64. *
  65. * In accordance with IEEE Std 802.15.4-2006, section 7.1.16.2
  66. */
  67. typedef struct
  68. {
  69. mac_status_t status; /**< Status of operation. */
  70. } mlme_poll_conf_t;
  71. /**@brief MLME-POLL.request
  72. *
  73. * @details The MLME-POLL.request primitive prompts the device
  74. * to request data from the coordinator.
  75. *
  76. * In accordance with IEEE Std 802.15.4-2006, section 7.1.16.1
  77. */
  78. typedef struct
  79. {
  80. /** Do not edit this field. */
  81. mac_abstract_req_t service;
  82. /** Confirm to this request. */
  83. mlme_poll_conf_t confirm;
  84. mac_addr_mode_t coord_addr_mode; /**< Coordinator address mode. */
  85. uint16_t coord_pan_id; /**< Coordinator PAN ID. */
  86. mac_addr_t coord_address; /**< Coordinator address. */
  87. #if (CONFIG_SECURE == 1)
  88. uint8_t security_level; /**< Security level. */
  89. uint8_t key_id_mode; /**< Key ID mode. */
  90. uint64_t key_source; /**< Key source. */
  91. uint8_t key_index; /**< Key index. */
  92. #endif
  93. } mlme_poll_req_t;
  94. /** @brief MLME-Poll.indication
  95. *
  96. * @details The MLME-POLL.indication primitive indicates the reception
  97. * of a Data request command frame by the MAC sub-layer and issued to
  98. * the local SSCS (service specific convergence sublayer).
  99. */
  100. typedef struct
  101. {
  102. mac_addr_mode_t src_addr_mode; /**< Source address mode. */
  103. mac_addr_t src_address; /**< Source address. */
  104. } mlme_poll_ind_t;
  105. /**@brief Prototype of the user-implemented MLME-POLL.confirm callback function.
  106. *
  107. * @details The MLME-POLL.confirm primitive is generated by the MLME and issued
  108. * to its next higher layer in response to an MLME-POLL.request primitive.
  109. * If the request was successful, the status parameter will be equal to SUCCESS,
  110. * indicating a successful poll for data. Otherwise, the status parameter indicates the
  111. * appropriate error code. The status values are fully described in 7.1.16.1.3 and
  112. * the subclauses referenced by 7.1.16.1.3.
  113. *
  114. * @param pointer to a confirmation primitive.
  115. */
  116. typedef void (* mlme_poll_conf_cb_t)(mlme_poll_conf_t *);
  117. /**@brief MLME-POLL.request
  118. *
  119. * @details The MLME-POLL.request primitive is generated by the next higher layer and
  120. * issued to its MLME when data are to be requested from a coordinator.
  121. *
  122. * @param[in] req MLME-POLL.request parameters
  123. * @param[in] conf_cb User-implemented callback function, which will be
  124. * called by MLME in order to pass MLME-POLL.confirm to the user.
  125. */
  126. void mlme_poll_req(mlme_poll_req_t * req, mlme_poll_conf_cb_t conf_cb);
  127. /**@brief MLME-POLL.indication
  128. *
  129. * @details The MLME-Poll.indication primitive notifies the next higher level that
  130. * a request for data has been received.
  131. *
  132. * @param[in] p_ind pointer to a poll indication structure
  133. */
  134. extern void mlme_poll_ind(mlme_poll_ind_t * p_ind);
  135. /** @} */
  136. #endif // MAC_MLME_POLL_H_INCLUDED