appl_main.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * \file appl_main.c
  3. *
  4. * This File contains the "main" function for the Test Application
  5. * to test the Mindtree Mesh stack.
  6. */
  7. /*
  8. * Copyright (C) 2016. Mindtree Ltd.
  9. * All rights reserved.
  10. */
  11. /* ------------------------------- Header File Inclusion */
  12. #include "appl_main.h"
  13. void main_health_server_operations(/* IN */ UINT8 have_menu);
  14. /* ------------------------------- Global Variables */
  15. /* ------------------------------- Functions */
  16. void main_register_models(void)
  17. {
  18. MS_ACCESS_NODE_ID node_id;
  19. MS_ACCESS_ELEMENT_DESC element;
  20. MS_ACCESS_ELEMENT_HANDLE element_handle;
  21. MS_ACCESS_MODEL_HANDLE config_server_model_handle;
  22. MS_ACCESS_MODEL_HANDLE health_server_model_handle;
  23. API_RESULT retval;
  24. /* Create Node */
  25. retval = MS_access_create_node(&node_id);
  26. /* Register Element */
  27. /**
  28. * TBD: Define GATT Namespace Descriptions from
  29. * https://www.bluetooth.com/specifications/assigned-numbers/gatt-namespace-descriptors
  30. *
  31. * Using 'main' (0x0106) as Location temporarily.
  32. */
  33. element.loc = 0x0106;
  34. retval = MS_access_register_element
  35. (
  36. node_id,
  37. &element,
  38. &element_handle
  39. );
  40. if (API_SUCCESS == retval)
  41. {
  42. retval = MS_config_server_init(element_handle, &config_server_model_handle);
  43. }
  44. CONSOLE_OUT("Model Registration Status: 0x%04X\n", retval);
  45. #ifndef HSL_DONT_USE_MULTI_ELEMENTS
  46. /* Two additional elements are registerd for HSL Server */
  47. retval = MS_access_register_element
  48. (
  49. node_id,
  50. &element,
  51. &sec_element_handle
  52. );
  53. if (API_SUCCESS == retval)
  54. {
  55. CONSOLE_OUT("Secondary Element Handle Registered @: 0x%04X\n", sec_element_handle);
  56. }
  57. retval = MS_access_register_element
  58. (
  59. node_id,
  60. &element,
  61. &ter_element_handle
  62. );
  63. if (API_SUCCESS == retval)
  64. {
  65. CONSOLE_OUT("Tertiary Element Handle Registered @: 0x%04X\n", ter_element_handle);
  66. }
  67. #endif /* HSL_DONT_USE_MULTI_ELEMENTS */
  68. /* Health Server */
  69. main_health_server_operations(MS_FALSE);
  70. }