obex_srm_client: split init, add srm_is_active

This commit is contained in:
Matthias Ringwald 2024-08-09 10:34:46 +02:00
parent 50c752545e
commit 30f40b4a93
2 changed files with 24 additions and 1 deletions

View File

@ -45,6 +45,10 @@
void obex_srm_client_init(obex_srm_client_t * obex_srm){
obex_srm->srm_state = OBEX_SRM_CLIENT_STATE_DISABLED;
obex_srm_client_reset_fields(obex_srm);
}
void obex_srm_client_reset_fields(obex_srm_client_t * obex_srm){
obex_srm->srm_value = OBEX_SRM_DISABLE;
obex_srm->srmp_value = OBEX_SRMP_NEXT;
}
@ -91,3 +95,7 @@ void obex_srm_client_prepare_header(obex_srm_client_t *obex_srm, uint16_t goep_c
obex_srm->srm_state = OBEX_SRM_CLIENT_STATE_W4_CONFIRM;
}
}
bool obex_srm_client_is_srm_active(obex_srm_client_t *obex_srm){
return obex_srm->srm_state == OBEX_SRM_CLIENT_STATE_ENABLED;
}

View File

@ -39,6 +39,7 @@
#define OBEX_SRM_CLIENT_H
#include <stdint.h>
#include "btstack_bool.h"
#if defined __cplusplus
extern "C" {
@ -59,17 +60,31 @@ typedef struct {
} obex_srm_client_t;
/**
* Init SRM state
* Init SRM to disabled state
* SRM needs to be disabled for each new GET/PUT operation
* @param obex_srm
*/
void obex_srm_client_init(obex_srm_client_t * obex_srm);
/**
* Reset SRM/SRMP fields
* Needs to be called before parsing response
* @param obex_srm
*/
void obex_srm_client_reset_fields(obex_srm_client_t * obex_srm);
/**
* Update SRM state based on SRM headers
* @param obex_srm
*/
void obex_srm_client_handle_headers(obex_srm_client_t *obex_srm);
/**
* Check if SRM is active
* @param obex_srm
*/
bool obex_srm_client_is_srm_active(obex_srm_client_t *obex_srm);
/**
* Add SRM headers if
* @param obex_srm