tile_tdg_module.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * NOTICE
  3. *
  4. * Copyright 2020 Tile Inc. All Rights Reserved.
  5. * All code or other information included in the accompanying files ("Tile Source Material")
  6. * is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
  7. * is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
  8. * and may not be otherwise distributed or made available to others, including for commercial purposes.
  9. * Without limiting the foregoing , you understand and agree that no production use
  10. * of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
  11. * agreement with Tile.
  12. * You also understand and agree that Tile may terminate the limited rights granted under these terms
  13. * at any time in its discretion.
  14. * All Tile Source Material is provided AS-IS without warranty of any kind.
  15. * Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
  16. * Tile will not be liable for any damages resulting from your use of or inability to use
  17. * the Tile Source Material.
  18. *
  19. * Support: firmware_support@tile.com
  20. */
  21. /** @file tile_tdg_module.h
  22. ** @brief Tile GATT Server Driver interface
  23. */
  24. #ifndef TILE_TDG_MODULE_H_
  25. #define TILE_TDG_MODULE_H_
  26. #include <stdint.h>
  27. #include "modules/tile_toa_module.h"
  28. /**
  29. * @defgroup tile_tdg Tile Diagnostics module
  30. * @{
  31. * @ingroup TOA
  32. *
  33. * @brief Tile Diagnostics module.
  34. *
  35. * @details This module is used by Tile Lib to send diagnostic information to the Tile
  36. * data collection system. Consult with Tile for the proper format for
  37. * diagnostic data, if it is to be automatically parsed by the Tile backend.
  38. */
  39. struct tile_tdg_module {
  40. /**
  41. * Retrieve diagnostic information.
  42. *
  43. * This function should call @ref tdg_add_data for each diagnostic data
  44. * field to be added, and then @ref tdg_finish when all data has been added.
  45. */
  46. int (*get_diagnostics)(void);
  47. uint8_t buffer[TOA_MPS];
  48. uint8_t buffer_pos;
  49. };
  50. /**
  51. * Register the TDG module.
  52. */
  53. int tile_tdg_register(struct tile_tdg_module *module);
  54. /**
  55. * @brief Add diagnostic data.
  56. * @details Should be called during the call to get_diagnostics.
  57. * This function can be called multiple times, for each piece of diagnostic
  58. * info that is to be added.
  59. *
  60. * @param[in] data Data to add to diagnostics.
  61. * @param[in] length Length of data to add.
  62. */
  63. int tdg_add_data(void *data, uint8_t length);
  64. /**
  65. * @brief Finish adding diagnostic data.
  66. * @details Should be called during the call to
  67. * get_diagnostics, after all data has been added.
  68. */
  69. int tdg_finish(void);
  70. /**@}*/
  71. #endif