Skip to content

Add capability status #278

Description

@HoussemEBM

To be able to get PD capability, the app needs to call osdp_cp_get_capability()
But this API provide the cached capability in the ctx (if already requested and cached)
no information is provided by the lib for the status of the cap (if it is already cached and ready or not)

I suggest to add a Status flag to inform if the capabilities is cached and ready or not.
example:

enum cap_flag_e {
/**
* Reader capabilities have not been retrieved yet
/
OSDP_CAP_FLAG_NOT_READY = 0,
/
*
* Reader capabilities retrieved and cached in ctx
*/
OSDP_CAP_FLAG_READY,
};

/* Set capability flag ready after receiving from readers /
void osdp_set_cap_flag_ready( void );
/
Reset capability flag ready after receiving from readers /
void osdp_reset_cap_flag_ready( void );
/
Get capability flag */
uint8_t osdp_get_cap_flag_ready( void );

void osdp_set_cap_flag_ready( void )
{
cap_flag = OSDP_CAP_FLAG_READY;
}

void osdp_reset_cap_flag_ready( void )
{
cap_flag = OSDP_CAP_FLAG_NOT_READY;
}

uint8_t osdp_get_cap_flag_ready( void )
{
return cap_flag;
}

enum cap_flag_e cap_flag;

in osdp_cp.c, cp_decode_response API, the end of the REPLY_PDCAP case add
/* Set capability flag ready */
osdp_set_cap_flag_ready();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions