aps_groups.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /**************************************************************************************************
  2. Filename: aps_groups.h
  3. Revised: $Date: 2007-10-28 18:41:49 -0700 (Sun, 28 Oct 2007) $
  4. Revision: $Revision: 15799 $
  5. Description: Application Support Sub Layer group management functions.
  6. Copyright 2006-2007 Texas Instruments Incorporated. All rights reserved.
  7. IMPORTANT: Your use of this Software is limited to those specific rights
  8. granted under the terms of a software license agreement between the user
  9. who downloaded the software, his/her employer (which must be your employer)
  10. and Texas Instruments Incorporated (the "License"). You may not use this
  11. Software unless you agree to abide by the terms of the License. The License
  12. limits your use, and you acknowledge, that the Software may not be modified,
  13. copied or distributed unless embedded on a Texas Instruments microcontroller
  14. or used solely and exclusively in conjunction with a Texas Instruments radio
  15. frequency transceiver, which is integrated into your product. Other than for
  16. the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  17. works of, modify, distribute, perform, display or sell this Software and/or
  18. its documentation for any purpose.
  19. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  20. PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  21. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  22. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  23. TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  24. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  25. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  26. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  27. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  28. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  29. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  30. Should you have any questions regarding your right to use this Software,
  31. contact Texas Instruments Incorporated at www.TI.com.
  32. **************************************************************************************************/
  33. #ifndef APSGROUPS_H
  34. #define APSGROUPS_H
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. /*********************************************************************
  39. * INCLUDES
  40. */
  41. #include "ZComDef.h"
  42. /*********************************************************************
  43. * MACROS
  44. */
  45. #define aps_GroupsRemaingCapacity() ( APS_MAX_GROUPS - aps_CountAllGroups() )
  46. /*********************************************************************
  47. * CONSTANTS
  48. */
  49. #define APS_GROUPS_FIND_FIRST 0xFE
  50. #define APS_GROUPS_EP_NOT_FOUND 0xFE
  51. #define APS_GROUP_NAME_LEN 16
  52. /*********************************************************************
  53. * TYPEDEFS
  54. */
  55. // Group Table Element
  56. typedef struct
  57. {
  58. uint16 ID; // Unique to this table
  59. uint8 name[APS_GROUP_NAME_LEN]; // Human readable name of group
  60. } aps_Group_t;
  61. typedef struct apsGroupItem
  62. {
  63. struct apsGroupItem *next;
  64. uint8 endpoint;
  65. aps_Group_t group;
  66. } apsGroupItem_t;
  67. /*********************************************************************
  68. * GLOBAL VARIABLES
  69. */
  70. extern apsGroupItem_t *apsGroupTable;
  71. /*********************************************************************
  72. * FUNCTIONS
  73. */
  74. /*
  75. * Add a group for an endpoint
  76. */
  77. extern ZStatus_t aps_AddGroup( uint8 endpoint, aps_Group_t *group );
  78. /*
  79. * Find a group with endpoint and groupID
  80. * - returns a pointer to the group information, NULL if not found
  81. */
  82. extern aps_Group_t *aps_FindGroup( uint8 endpoint, uint16 groupID );
  83. /*
  84. * Find a group for an endpoint
  85. * - returns endpoint found, or 0xFF for not found
  86. */
  87. extern uint8 aps_FindGroupForEndpoint( uint16 groupID, uint8 lastEP );
  88. /*
  89. * Find all groups for an endpoint
  90. * - returns number of groups copied to groupList
  91. */
  92. extern uint8 aps_FindAllGroupsForEndpoint( uint8 endpoint, uint16 *groupList );
  93. /*
  94. * Remove a group with endpoint and groupID
  95. * - returns TRUE if removed, FALSE if not found
  96. */
  97. extern uint8 aps_RemoveGroup( uint8 endpoint, uint16 groupID );
  98. /*
  99. * Remove all groups for endpoint
  100. */
  101. extern void aps_RemoveAllGroup( uint8 endpoint );
  102. /*
  103. * Count the number of groups for an endpoint
  104. */
  105. extern uint8 aps_CountGroups( uint8 endpoint );
  106. /*
  107. * Count the number of groups
  108. */
  109. extern uint8 aps_CountAllGroups( void );
  110. /*
  111. * Initialize the Group Table NV Space
  112. */
  113. extern uint8 aps_GroupsInitNV( void );
  114. /*
  115. * Initialize the Group Table NV Space to default (no entries)
  116. */
  117. extern void aps_GroupsSetDefaultNV( void );
  118. /*
  119. * Write the group table to NV
  120. */
  121. extern void aps_GroupsWriteNV( void );
  122. /*
  123. * Read the group table from NV
  124. */
  125. extern uint16 aps_GroupsRestoreFromNV( void );
  126. /*********************************************************************
  127. *********************************************************************/
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif /* APSGROUPS_H */