2022-03-29 13:01:56 +00:00
|
|
|
/**
|
|
|
|
* @file ibutton_key.h
|
|
|
|
*
|
|
|
|
* iButton key data holder
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2023-03-02 13:23:33 +00:00
|
|
|
|
|
|
|
#include <core/string.h>
|
|
|
|
|
|
|
|
#include "protocols/protocol_common.h"
|
2022-03-29 13:01:56 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct iButtonKey iButtonKey;
|
|
|
|
|
|
|
|
/**
|
2023-03-02 13:23:33 +00:00
|
|
|
* Allocate a key object
|
|
|
|
* @param [in] data_size maximum data size held by the key
|
|
|
|
* @return pointer to the key object
|
2022-03-29 13:01:56 +00:00
|
|
|
*/
|
2023-03-02 13:23:33 +00:00
|
|
|
iButtonKey* ibutton_key_alloc(size_t data_size);
|
2022-03-29 13:01:56 +00:00
|
|
|
|
|
|
|
/**
|
2023-03-02 13:23:33 +00:00
|
|
|
* Destroy the key object, free resources
|
|
|
|
* @param [in] key pointer to the key object
|
2022-03-29 13:01:56 +00:00
|
|
|
*/
|
|
|
|
void ibutton_key_free(iButtonKey* key);
|
|
|
|
|
|
|
|
/**
|
2023-03-02 13:23:33 +00:00
|
|
|
* Get the protocol id held by the key
|
|
|
|
* @param [in] key pointer to the key object
|
|
|
|
* @return protocol id held by the key
|
2022-03-29 13:01:56 +00:00
|
|
|
*/
|
2023-03-02 13:23:33 +00:00
|
|
|
iButtonProtocolId ibutton_key_get_protocol_id(const iButtonKey* key);
|
2022-03-29 13:01:56 +00:00
|
|
|
|
|
|
|
/**
|
2023-03-02 13:23:33 +00:00
|
|
|
* Set the protocol id held by the key
|
|
|
|
* @param [in] key pointer to the key object
|
|
|
|
* @param [in] protocol_id new protocol id
|
2022-03-29 13:01:56 +00:00
|
|
|
*/
|
2023-03-02 13:23:33 +00:00
|
|
|
void ibutton_key_set_protocol_id(iButtonKey* key, iButtonProtocolId protocol_id);
|
2022-03-29 13:01:56 +00:00
|
|
|
|
|
|
|
/**
|
2023-03-02 13:23:33 +00:00
|
|
|
* Reset the protocol id and data held by the key
|
|
|
|
* @param [in] key pointer to the key object
|
2022-03-29 13:01:56 +00:00
|
|
|
*/
|
2023-03-02 13:23:33 +00:00
|
|
|
void ibutton_key_reset(iButtonKey* key);
|
2022-03-29 13:01:56 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2022-05-06 13:37:10 +00:00
|
|
|
#endif
|