ibutton_key.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @file ibutton_key.h
  3. *
  4. * iButton key data holder
  5. */
  6. #pragma once
  7. #include <core/string.h>
  8. #include "protocols/protocol_common.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. typedef struct iButtonKey iButtonKey;
  13. /**
  14. * Allocate a key object
  15. * @param [in] data_size maximum data size held by the key
  16. * @return pointer to the key object
  17. */
  18. iButtonKey* ibutton_key_alloc(size_t data_size);
  19. /**
  20. * Destroy the key object, free resources
  21. * @param [in] key pointer to the key object
  22. */
  23. void ibutton_key_free(iButtonKey* key);
  24. /**
  25. * Get the protocol id held by the key
  26. * @param [in] key pointer to the key object
  27. * @return protocol id held by the key
  28. */
  29. iButtonProtocolId ibutton_key_get_protocol_id(const iButtonKey* key);
  30. /**
  31. * Set the protocol id held by the key
  32. * @param [in] key pointer to the key object
  33. * @param [in] protocol_id new protocol id
  34. */
  35. void ibutton_key_set_protocol_id(iButtonKey* key, iButtonProtocolId protocol_id);
  36. /**
  37. * Reset the protocol id and data held by the key
  38. * @param [in] key pointer to the key object
  39. */
  40. void ibutton_key_reset(iButtonKey* key);
  41. #ifdef __cplusplus
  42. }
  43. #endif