mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-21 21:41:13 +00:00
goep_client: rename functions
This commit is contained in:
parent
948b36425d
commit
c4e8cd112f
@ -427,7 +427,7 @@ void goep_client_request_can_send_now(uint16_t goep_cid){
|
||||
}
|
||||
}
|
||||
|
||||
void goep_client_create_connect_request(uint16_t goep_cid, uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length){
|
||||
void goep_client_request_create_connect(uint16_t goep_cid, uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
goep_client_packet_init(goep_cid, OBEX_OPCODE_CONNECT);
|
||||
@ -440,7 +440,7 @@ void goep_client_create_connect_request(uint16_t goep_cid, uint8_t obex_version_
|
||||
obex_message_builder_request_create_connect(buffer, buffer_len, obex_version_number, flags, maximum_obex_packet_length);
|
||||
}
|
||||
|
||||
void goep_client_create_get_request(uint16_t goep_cid){
|
||||
void goep_client_request_create_get(uint16_t goep_cid){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
goep_client_packet_init(goep_cid, OBEX_OPCODE_GET | OBEX_OPCODE_FINAL_BIT_MASK);
|
||||
@ -450,7 +450,7 @@ void goep_client_create_get_request(uint16_t goep_cid){
|
||||
obex_message_builder_request_create_get(buffer, buffer_len, context->obex_connection_id);
|
||||
}
|
||||
|
||||
void goep_client_create_put_request(uint16_t goep_cid){
|
||||
void goep_client_request_create_put(uint16_t goep_cid){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
goep_client_packet_init(goep_cid, OBEX_OPCODE_PUT | OBEX_OPCODE_FINAL_BIT_MASK);
|
||||
@ -460,7 +460,7 @@ void goep_client_create_put_request(uint16_t goep_cid){
|
||||
obex_message_builder_request_create_put(buffer, buffer_len, context->obex_connection_id);
|
||||
}
|
||||
|
||||
void goep_client_create_set_path_request(uint16_t goep_cid, uint8_t flags){
|
||||
void goep_client_request_create_set_path(uint16_t goep_cid, uint8_t flags){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
goep_client_packet_init(goep_cid, OBEX_OPCODE_SETPATH);
|
||||
@ -470,7 +470,7 @@ void goep_client_create_set_path_request(uint16_t goep_cid, uint8_t flags){
|
||||
obex_message_builder_request_create_set_path(buffer, buffer_len, flags, context->obex_connection_id);
|
||||
}
|
||||
|
||||
void goep_client_create_abort_request(uint16_t goep_cid){
|
||||
void goep_client_request_create_abort(uint16_t goep_cid){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
goep_client_packet_init(goep_cid, OBEX_OPCODE_ABORT);
|
||||
@ -480,7 +480,7 @@ void goep_client_create_abort_request(uint16_t goep_cid){
|
||||
obex_message_builder_request_create_abort(buffer, buffer_len, context->obex_connection_id);
|
||||
}
|
||||
|
||||
void goep_client_create_disconnect_request(uint16_t goep_cid){
|
||||
void goep_client_request_create_disconnect(uint16_t goep_cid){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
goep_client_packet_init(goep_cid, OBEX_OPCODE_DISCONNECT);
|
||||
@ -490,7 +490,7 @@ void goep_client_create_disconnect_request(uint16_t goep_cid){
|
||||
obex_message_builder_request_create_disconnect(buffer, buffer_len, context->obex_connection_id);
|
||||
}
|
||||
|
||||
void goep_client_add_byte_header(uint16_t goep_cid, uint8_t header_type, uint8_t value){
|
||||
void goep_client_header_add_byte(uint16_t goep_cid, uint8_t header_type, uint8_t value){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
@ -499,7 +499,7 @@ void goep_client_add_byte_header(uint16_t goep_cid, uint8_t header_type, uint8_t
|
||||
obex_message_builder_header_add_byte(buffer, buffer_len, header_type, value);
|
||||
}
|
||||
|
||||
void goep_client_add_word_header(uint16_t goep_cid, uint8_t header_type, uint32_t value){
|
||||
void goep_client_header_add_word(uint16_t goep_cid, uint8_t header_type, uint32_t value){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
@ -508,7 +508,7 @@ void goep_client_add_word_header(uint16_t goep_cid, uint8_t header_type, uint32_
|
||||
obex_message_builder_header_add_word(buffer, buffer_len, header_type, value);
|
||||
}
|
||||
|
||||
void goep_client_add_variable_header(uint16_t goep_cid, uint8_t header_type, uint16_t header_data_length, const uint8_t * header_data){
|
||||
void goep_client_header_add_variable(uint16_t goep_cid, uint8_t header_type, const uint8_t * header_data, uint16_t header_data_length){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
@ -517,7 +517,7 @@ void goep_client_add_variable_header(uint16_t goep_cid, uint8_t header_type, uin
|
||||
obex_message_builder_header_add_variable(buffer, buffer_len, header_type, header_data, header_data_length);
|
||||
}
|
||||
|
||||
void goep_client_add_header_srm_enable(uint16_t goep_cid){
|
||||
void goep_client_header_add_srm_enable(uint16_t goep_cid){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
@ -526,7 +526,7 @@ void goep_client_add_header_srm_enable(uint16_t goep_cid){
|
||||
obex_message_builder_header_add_srm_enable(buffer, buffer_len);
|
||||
}
|
||||
|
||||
void goep_client_add_header_target(uint16_t goep_cid, uint16_t length, const uint8_t * target){
|
||||
void goep_client_header_add_target(uint16_t goep_cid, const uint8_t * target, uint16_t length){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
@ -535,7 +535,7 @@ void goep_client_add_header_target(uint16_t goep_cid, uint16_t length, const uin
|
||||
obex_message_builder_header_add_target(buffer, buffer_len, target, length);
|
||||
}
|
||||
|
||||
void goep_client_add_header_application_parameters(uint16_t goep_cid, uint16_t length, const uint8_t * data){
|
||||
void goep_client_header_add_application_parameters(uint16_t goep_cid, const uint8_t * data, uint16_t length){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
@ -544,7 +544,7 @@ void goep_client_add_header_application_parameters(uint16_t goep_cid, uint16_t l
|
||||
obex_message_builder_header_add_application_parameters(buffer, buffer_len, data, length);
|
||||
}
|
||||
|
||||
void goep_client_add_header_challenge_response(uint16_t goep_cid, uint16_t length, const uint8_t * data){
|
||||
void goep_client_header_add_challenge_response(uint16_t goep_cid, const uint8_t * data, uint16_t length){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
@ -553,7 +553,7 @@ void goep_client_add_header_challenge_response(uint16_t goep_cid, uint16_t lengt
|
||||
obex_message_builder_header_add_challenge_response(buffer, buffer_len, data, length);
|
||||
}
|
||||
|
||||
void goep_client_add_body_static(uint16_t goep_cid, uint32_t length, const uint8_t * data){
|
||||
void goep_client_body_add_static(uint16_t goep_cid, const uint8_t * data, uint32_t length){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
@ -562,7 +562,7 @@ void goep_client_add_body_static(uint16_t goep_cid, uint32_t length, const uint
|
||||
obex_message_builder_body_add_static(buffer, buffer_len, data, length);
|
||||
}
|
||||
|
||||
void goep_client_add_header_name(uint16_t goep_cid, const char * name){
|
||||
void goep_client_header_add_name(uint16_t goep_cid, const char * name){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
@ -571,7 +571,7 @@ void goep_client_add_header_name(uint16_t goep_cid, const char * name){
|
||||
obex_message_builder_header_add_name(buffer, buffer_len, name);
|
||||
}
|
||||
|
||||
void goep_client_add_header_type(uint16_t goep_cid, const char * type){
|
||||
void goep_client_header_add_type(uint16_t goep_cid, const char * type){
|
||||
UNUSED(goep_cid);
|
||||
goep_client_t * context = goep_client;
|
||||
|
||||
|
@ -62,7 +62,7 @@ extern "C" {
|
||||
/**
|
||||
* Setup GOEP Client
|
||||
*/
|
||||
void goep_client_init(void);
|
||||
void goep_client_init(void);
|
||||
|
||||
/*
|
||||
* @brief Create GOEP connection to a GEOP server with specified UUID on a remote deivce.
|
||||
@ -76,7 +76,7 @@ uint8_t goep_client_create_connection(btstack_packet_handler_t handler, bd_addr_
|
||||
|
||||
/**
|
||||
* @brief Disconnects GOEP connection with given identifier.
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
* @return status
|
||||
*/
|
||||
uint8_t goep_client_disconnect(uint16_t goep_cid);
|
||||
@ -87,11 +87,11 @@ uint8_t goep_client_disconnect(uint16_t goep_cid);
|
||||
* so packet handler should be ready to handle it
|
||||
* @param goep_cid
|
||||
*/
|
||||
void goep_client_request_can_send_now(uint16_t goep_cid);
|
||||
void goep_client_request_can_send_now(uint16_t goep_cid);
|
||||
|
||||
/**
|
||||
* @brief Get Opcode from last created request, needed for parsing of OBEX response packet
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
* @return opcode
|
||||
*/
|
||||
uint8_t goep_client_get_request_opcode(uint16_t goep_cid);
|
||||
@ -103,131 +103,132 @@ uint32_t goep_client_get_pbap_supported_features(uint16_t goep_cid);
|
||||
|
||||
/**
|
||||
* @brief Set Connection ID used for newly created requests
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
*/
|
||||
void goep_client_set_connection_id(uint16_t goep_cid, uint32_t connection_id);
|
||||
void goep_client_set_connection_id(uint16_t goep_cid, uint32_t connection_id);
|
||||
|
||||
/**
|
||||
* @brief Start Connect request
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
* @param obex_version_number
|
||||
* @param flags
|
||||
* @param maximum_obex_packet_length
|
||||
*/
|
||||
void goep_client_create_connect_request(uint16_t goep_cid, uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length);
|
||||
void goep_client_request_create_connect(uint16_t goep_cid, uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length);
|
||||
|
||||
/**
|
||||
* @brief Start Disconnect request
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
*/
|
||||
void goep_client_create_disconnect_request(uint16_t goep_cid);
|
||||
void goep_client_request_create_disconnect(uint16_t goep_cid);
|
||||
|
||||
/**
|
||||
* @brief Create Get request
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
*/
|
||||
void goep_client_create_get_request(uint16_t goep_cid);
|
||||
void goep_client_request_create_get(uint16_t goep_cid);
|
||||
|
||||
/**
|
||||
* @brief Create Abort request
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
*/
|
||||
void goep_client_create_abort_request(uint16_t goep_cid);
|
||||
void goep_client_request_create_abort(uint16_t goep_cid);
|
||||
|
||||
/**
|
||||
* @brief Start Set Path request
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
*/
|
||||
void goep_client_create_set_path_request(uint16_t goep_cid, uint8_t flags);
|
||||
void goep_client_request_create_set_path(uint16_t goep_cid, uint8_t flags);
|
||||
|
||||
/**
|
||||
* @brief Create Put request
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
*/
|
||||
void goep_client_create_put_request(uint16_t goep_cid);
|
||||
void goep_client_request_create_put(uint16_t goep_cid);
|
||||
|
||||
/**
|
||||
* @brief Add SRM Enable
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
*/
|
||||
void goep_client_add_header_srm_enable(uint16_t goep_cid);
|
||||
void goep_client_header_add_srm_enable(uint16_t goep_cid);
|
||||
|
||||
/**
|
||||
* @brief Add header with single byte value (8 bit)
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
* @param header_type
|
||||
* @param value
|
||||
*/
|
||||
void goep_client_add_byte_header(uint16_t goep_cid, uint8_t header_type, uint8_t value);
|
||||
void goep_client_header_add_byte(uint16_t goep_cid, uint8_t header_type, uint8_t value);
|
||||
|
||||
/**
|
||||
* @brief Add header with word value (32 bit)
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
* @param header_type
|
||||
* @param value
|
||||
*/
|
||||
void goep_client_add_word_header(uint16_t goep_cid, uint8_t header_type, uint32_t value);
|
||||
void goep_client_header_add_word(uint16_t goep_cid, uint8_t header_type, uint32_t value);
|
||||
|
||||
/**
|
||||
* @brief Add header with variable size
|
||||
* @param gope_cid
|
||||
* @param goep_cid
|
||||
* @param header_type
|
||||
* @param value
|
||||
* @param header_data
|
||||
* @param header_data_length
|
||||
*/
|
||||
void goep_client_add_variable_header(uint16_t goep_cid, uint8_t header_type, uint16_t header_data_length, const uint8_t * header_data);
|
||||
void goep_client_header_add_variable(uint16_t goep_cid, uint8_t header_type, const uint8_t * header_data, uint16_t header_data_length);
|
||||
|
||||
/**
|
||||
* @brief Add name header to current request
|
||||
* @param goep_cid
|
||||
* @param name
|
||||
*/
|
||||
void goep_client_add_header_name(uint16_t goep_cid, const char * name);
|
||||
void goep_client_header_add_name(uint16_t goep_cid, const char * name);
|
||||
|
||||
/**
|
||||
* @brief Add target header to current request
|
||||
* @param goep_cid
|
||||
* @param target
|
||||
* @param length of target
|
||||
*/
|
||||
void goep_client_add_header_target(uint16_t goep_cid, uint16_t length, const uint8_t * target);
|
||||
void goep_client_header_add_target(uint16_t goep_cid, const uint8_t * target, uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief Add type header to current request
|
||||
* @param goep_cid
|
||||
* @param type
|
||||
*/
|
||||
void goep_client_add_header_type(uint16_t goep_cid, const char * type);
|
||||
void goep_client_header_add_type(uint16_t goep_cid, const char * type);
|
||||
|
||||
/**
|
||||
* @brief Add count header to current request
|
||||
* @param goep_cid
|
||||
* @param count
|
||||
*/
|
||||
void goep_client_add_header_count(uint16_t goep_cid, uint32_t count);
|
||||
void goep_client_header_add_count(uint16_t goep_cid, uint32_t count);
|
||||
|
||||
/**
|
||||
* @brief Add application parameters header to current request
|
||||
* @param goep_cid
|
||||
* @param lenght of application parameters
|
||||
* @param data
|
||||
* @param lenght of application parameters
|
||||
*/
|
||||
void goep_client_add_header_application_parameters(uint16_t goep_cid, uint16_t length, const uint8_t * data);
|
||||
void goep_client_header_add_application_parameters(uint16_t goep_cid, const uint8_t * data, uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief Add application parameters header to current request
|
||||
* @param goep_cid
|
||||
* @param lenght of challenge response
|
||||
* @param data
|
||||
* @param lenght of challenge response
|
||||
*/
|
||||
void goep_client_add_header_challenge_response(uint16_t goep_cid, uint16_t length, const uint8_t * data);
|
||||
void goep_client_header_add_challenge_response(uint16_t goep_cid, const uint8_t * data, uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief Add body
|
||||
* @param goep_cid
|
||||
* @param lenght
|
||||
* @param data
|
||||
* @param lenght
|
||||
*/
|
||||
void goep_client_add_body_static(uint16_t goep_cid, uint32_t length, const uint8_t * data);
|
||||
// int goep_client_add_body_dynamic(uint16_t goep_cid, uint32_t length, void (*data_callback)(uint32_t offset, uint8_t * buffer, uint32_t len));
|
||||
void goep_client_body_add_static(uint16_t goep_cid, const uint8_t * data, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief Execute prepared request
|
||||
@ -238,6 +239,8 @@ int goep_client_execute(uint16_t goep_cid);
|
||||
|
||||
/* API_END */
|
||||
|
||||
// int goep_client_body_add_dynamic(uint16_t goep_cid, uint32_t length, void (*data_callback)(uint32_t offset, uint8_t * buffer, uint32_t len));
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -273,28 +273,28 @@ static void pbap_handle_can_send_now(void){
|
||||
if (pbap_client->abort_operation){
|
||||
pbap_client->abort_operation = 0;
|
||||
pbap_client->state = PBAP_CONNECTED;
|
||||
goep_client_create_abort_request(pbap_client->goep_cid);
|
||||
goep_client_request_create_abort(pbap_client->goep_cid);
|
||||
goep_client_execute(pbap_client->goep_cid);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (pbap_client->state){
|
||||
case PBAP_W2_SEND_CONNECT_REQUEST:
|
||||
goep_client_create_connect_request(pbap_client->goep_cid, OBEX_VERSION, 0, OBEX_MAX_PACKETLEN_DEFAULT);
|
||||
goep_client_add_header_target(pbap_client->goep_cid, 16, pbap_uuid);
|
||||
goep_client_request_create_connect(pbap_client->goep_cid, OBEX_VERSION, 0, OBEX_MAX_PACKETLEN_DEFAULT);
|
||||
goep_client_header_add_target(pbap_client->goep_cid, pbap_uuid, 18);
|
||||
// Mandatory if the PSE advertises a PbapSupportedFeatures attribute in its SDP record, else excluded.
|
||||
if (goep_client_get_pbap_supported_features(pbap_client->goep_cid) != PBAP_FEATURES_NOT_PRESENT){
|
||||
application_parameters[0] = PBAP_APPLICATION_PARAMETER_PBAP_SUPPORTED_FEATURES;
|
||||
application_parameters[1] = 4;
|
||||
big_endian_store_32(application_parameters, 2, pbap_supported_features);
|
||||
goep_client_add_header_application_parameters(pbap_client->goep_cid, 6, &application_parameters[0]);
|
||||
goep_client_header_add_application_parameters(pbap_client->goep_cid, &application_parameters[0], 6);
|
||||
}
|
||||
pbap_client->state = PBAP_W4_CONNECT_RESPONSE;
|
||||
goep_client_execute(pbap_client->goep_cid);
|
||||
break;
|
||||
case PBAP_W2_SEND_AUTHENTICATED_CONNECT:
|
||||
goep_client_create_connect_request(pbap_client->goep_cid, OBEX_VERSION, 0, OBEX_MAX_PACKETLEN_DEFAULT);
|
||||
goep_client_add_header_target(pbap_client->goep_cid, 16, pbap_uuid);
|
||||
goep_client_request_create_connect(pbap_client->goep_cid, OBEX_VERSION, 0, OBEX_MAX_PACKETLEN_DEFAULT);
|
||||
goep_client_header_add_target(pbap_client->goep_cid, pbap_uuid, 16);
|
||||
// setup authentication challenge response
|
||||
i = 0;
|
||||
challenge_response[i++] = 0; // Tag Digest
|
||||
@ -310,25 +310,25 @@ static void pbap_handle_can_send_now(void){
|
||||
challenge_response[i++] = 16; // Len
|
||||
memcpy(&challenge_response[i], pbap_client->authentication_nonce, 16);
|
||||
i += 16;
|
||||
goep_client_add_header_challenge_response(pbap_client->goep_cid, i, challenge_response);
|
||||
goep_client_header_add_challenge_response(pbap_client->goep_cid, challenge_response, i);
|
||||
pbap_client->state = PBAP_W4_CONNECT_RESPONSE;
|
||||
goep_client_execute(pbap_client->goep_cid);
|
||||
break;
|
||||
case PBAP_W2_SEND_DISCONNECT_REQUEST:
|
||||
goep_client_create_disconnect_request(pbap_client->goep_cid);
|
||||
goep_client_request_create_disconnect(pbap_client->goep_cid);
|
||||
pbap_client->state = PBAP_W4_DISCONNECT_RESPONSE;
|
||||
goep_client_execute(pbap_client->goep_cid);
|
||||
return;
|
||||
case PBAP_W2_PULL_PHONEBOOK:
|
||||
case PBAP_W2_GET_PHONEBOOK_SIZE:
|
||||
goep_client_create_get_request(pbap_client->goep_cid);
|
||||
goep_client_request_create_get(pbap_client->goep_cid);
|
||||
if (pbap_client->request_number == 0){
|
||||
if (!pbap_client->flow_control_enabled){
|
||||
goep_client_add_header_srm_enable(pbap_client->goep_cid);
|
||||
goep_client_header_add_srm_enable(pbap_client->goep_cid);
|
||||
pbap_client->srm_state = SRM_W4_CONFIRM;
|
||||
}
|
||||
goep_client_add_header_name(pbap_client->goep_cid, pbap_client->phonebook_path);
|
||||
goep_client_add_header_type(pbap_client->goep_cid, pbap_phonebook_type);
|
||||
goep_client_header_add_name(pbap_client->goep_cid, pbap_client->phonebook_path);
|
||||
goep_client_header_add_type(pbap_client->goep_cid, pbap_phonebook_type);
|
||||
i = 0;
|
||||
if (pbap_client->vcard_selector_supported){
|
||||
// vCard Selector
|
||||
@ -355,7 +355,7 @@ static void pbap_handle_can_send_now(void){
|
||||
i += 2;
|
||||
}
|
||||
if (i){
|
||||
goep_client_add_header_application_parameters(pbap_client->goep_cid, i, application_parameters);
|
||||
goep_client_header_add_application_parameters(pbap_client->goep_cid, application_parameters, i);
|
||||
}
|
||||
}
|
||||
if (pbap_client->state == PBAP_W2_GET_PHONEBOOK_SIZE){
|
||||
@ -370,14 +370,14 @@ static void pbap_handle_can_send_now(void){
|
||||
goep_client_execute(pbap_client->goep_cid);
|
||||
break;
|
||||
case PBAP_W2_GET_CARD_LIST:
|
||||
goep_client_create_get_request(pbap_client->goep_cid);
|
||||
goep_client_request_create_get(pbap_client->goep_cid);
|
||||
if (pbap_client->request_number == 0){
|
||||
if (!pbap_client->flow_control_enabled){
|
||||
goep_client_add_header_srm_enable(pbap_client->goep_cid);
|
||||
goep_client_header_add_srm_enable(pbap_client->goep_cid);
|
||||
pbap_client->srm_state = SRM_W4_CONFIRM;
|
||||
}
|
||||
goep_client_add_header_name(pbap_client->goep_cid, pbap_client->phonebook_path);
|
||||
goep_client_add_header_type(pbap_client->goep_cid, pbap_vcard_listing_type);
|
||||
goep_client_header_add_name(pbap_client->goep_cid, pbap_client->phonebook_path);
|
||||
goep_client_header_add_type(pbap_client->goep_cid, pbap_vcard_listing_type);
|
||||
i = 0;
|
||||
if (pbap_client->vcard_selector_supported){
|
||||
// vCard Selector
|
||||
@ -408,7 +408,7 @@ static void pbap_handle_can_send_now(void){
|
||||
application_parameters[i++] = 0x01; // Number
|
||||
}
|
||||
if (i){
|
||||
goep_client_add_header_application_parameters(pbap_client->goep_cid, i, &application_parameters[0]);
|
||||
goep_client_header_add_application_parameters(pbap_client->goep_cid, &application_parameters[0], i);
|
||||
}
|
||||
}
|
||||
// send packet
|
||||
@ -417,19 +417,19 @@ static void pbap_handle_can_send_now(void){
|
||||
goep_client_execute(pbap_client->goep_cid);
|
||||
break;
|
||||
case PBAP_W2_GET_CARD_ENTRY:
|
||||
goep_client_create_get_request(pbap_client->goep_cid);
|
||||
goep_client_request_create_get(pbap_client->goep_cid);
|
||||
if (pbap_client->request_number == 0){
|
||||
if (!pbap_client->flow_control_enabled){
|
||||
goep_client_add_header_srm_enable(pbap_client->goep_cid);
|
||||
goep_client_header_add_srm_enable(pbap_client->goep_cid);
|
||||
pbap_client->srm_state = SRM_W4_CONFIRM;
|
||||
}
|
||||
goep_client_add_header_name(pbap_client->goep_cid, pbap_client->vcard_name);
|
||||
goep_client_add_header_type(pbap_client->goep_cid, pbap_vcard_entry_type);
|
||||
goep_client_header_add_name(pbap_client->goep_cid, pbap_client->vcard_name);
|
||||
goep_client_header_add_type(pbap_client->goep_cid, pbap_vcard_entry_type);
|
||||
i = 0;
|
||||
if (i){
|
||||
// TODO: support property selector
|
||||
// TODO: support format
|
||||
goep_client_add_header_application_parameters(pbap_client->goep_cid, i, &application_parameters[0]);
|
||||
goep_client_header_add_application_parameters(pbap_client->goep_cid, &application_parameters[0], i);
|
||||
}
|
||||
pbap_client->state = PBAP_W4_GET_CARD_ENTRY_COMPLETE;
|
||||
}
|
||||
@ -438,8 +438,8 @@ static void pbap_handle_can_send_now(void){
|
||||
goep_client_execute(pbap_client->goep_cid);
|
||||
break;
|
||||
case PBAP_W2_SET_PATH_ROOT:
|
||||
goep_client_create_set_path_request(pbap_client->goep_cid, 1 << 1); // Don’t create directory
|
||||
goep_client_add_header_name(pbap_client->goep_cid, "");
|
||||
goep_client_request_create_set_path(pbap_client->goep_cid, 1 << 1); // Don’t create directory
|
||||
goep_client_header_add_name(pbap_client->goep_cid, "");
|
||||
// state
|
||||
pbap_client->state = PBAP_W4_SET_PATH_ROOT_COMPLETE;
|
||||
// send packet
|
||||
@ -467,8 +467,8 @@ static void pbap_handle_can_send_now(void){
|
||||
// status
|
||||
log_info("Path element '%s', done %u", path_element, done);
|
||||
|
||||
goep_client_create_set_path_request(pbap_client->goep_cid, 1 << 1); // Don’t create directory
|
||||
goep_client_add_header_name(pbap_client->goep_cid, (const char *) path_element); // next element
|
||||
goep_client_request_create_set_path(pbap_client->goep_cid, 1 << 1); // Don’t create directory
|
||||
goep_client_header_add_name(pbap_client->goep_cid, (const char *) path_element); // next element
|
||||
// state
|
||||
pbap_client->state = PBAP_W4_SET_PATH_ELEMENT_COMPLETE;
|
||||
// send packet
|
||||
|
@ -182,14 +182,14 @@ static void map_handle_can_send_now(void){
|
||||
|
||||
switch (map_client->state){
|
||||
case MAP_W2_SEND_CONNECT_REQUEST:
|
||||
goep_client_create_connect_request(map_client->goep_cid, OBEX_VERSION, 0, OBEX_MAX_PACKETLEN_DEFAULT);
|
||||
goep_client_add_header_target(map_client->goep_cid, 16, map_client_access_service_uuid);
|
||||
goep_client_request_create_connect(map_client->goep_cid, OBEX_VERSION, 0, OBEX_MAX_PACKETLEN_DEFAULT);
|
||||
goep_client_header_add_target(map_client->goep_cid, map_client_access_service_uuid, 16);
|
||||
// Mandatory if the PSE advertises a PbapSupportedFeatures attribute in its SDP record, else excluded.
|
||||
// if (goep_client_get_map_supported_features(map_client->goep_cid) != MAP_FEATURES_NOT_PRESENT){
|
||||
application_parameters[0] = 0x29; // MAP_APPLICATION_PARAMETER_MAP_SUPPORTED_FEATURES;
|
||||
application_parameters[1] = 4;
|
||||
big_endian_store_32(application_parameters, 2, map_supported_features);
|
||||
goep_client_add_header_application_parameters(map_client->goep_cid, 6, &application_parameters[0]);
|
||||
goep_client_header_add_application_parameters(map_client->goep_cid, &application_parameters[0], 6);
|
||||
|
||||
// }
|
||||
map_client->state = MAP_W4_CONNECT_RESPONSE;
|
||||
@ -197,14 +197,14 @@ static void map_handle_can_send_now(void){
|
||||
break;
|
||||
|
||||
case MAP_W2_SEND_DISCONNECT_REQUEST:
|
||||
goep_client_create_disconnect_request(map_client->goep_cid);
|
||||
goep_client_request_create_disconnect(map_client->goep_cid);
|
||||
map_client->state = MAP_W4_DISCONNECT_RESPONSE;
|
||||
goep_client_execute(map_client->goep_cid);
|
||||
break;
|
||||
|
||||
case MAP_W2_SET_PATH_ROOT:
|
||||
goep_client_create_set_path_request(map_client->goep_cid, 1 << 1); // Don’t create directory
|
||||
goep_client_add_header_name(map_client->goep_cid, "");
|
||||
goep_client_request_create_set_path(map_client->goep_cid, 1 << 1); // Don’t create directory
|
||||
goep_client_header_add_name(map_client->goep_cid, "");
|
||||
// state
|
||||
map_client->state = MAP_W4_SET_PATH_ROOT_COMPLETE;
|
||||
// send packet
|
||||
@ -232,8 +232,8 @@ static void map_handle_can_send_now(void){
|
||||
// status
|
||||
log_info("Path element '%s', done %u", path_element, done);
|
||||
|
||||
goep_client_create_set_path_request(map_client->goep_cid, 1 << 1); // Don’t create directory
|
||||
goep_client_add_header_name(map_client->goep_cid, (const char *) path_element); // next element
|
||||
goep_client_request_create_set_path(map_client->goep_cid, 1 << 1); // Don’t create directory
|
||||
goep_client_header_add_name(map_client->goep_cid, (const char *) path_element); // next element
|
||||
// state
|
||||
map_client->state = MAP_W4_SET_PATH_ELEMENT_COMPLETE;
|
||||
// send packet
|
||||
@ -241,27 +241,27 @@ static void map_handle_can_send_now(void){
|
||||
break;
|
||||
|
||||
case MAP_W2_SEND_GET_FOLDERS:
|
||||
goep_client_create_get_request(map_client->goep_cid);
|
||||
goep_client_add_header_type(map_client->goep_cid, "x-obex/folder-listing");
|
||||
goep_client_request_create_get(map_client->goep_cid);
|
||||
goep_client_header_add_type(map_client->goep_cid, "x-obex/folder-listing");
|
||||
map_client->state = MAP_W4_FOLDERS;
|
||||
goep_client_execute(map_client->goep_cid);
|
||||
break;
|
||||
|
||||
case MAP_W2_SEND_GET_MESSAGES_FOR_FOLDER:
|
||||
goep_client_create_get_request(map_client->goep_cid);
|
||||
goep_client_add_header_type(map_client->goep_cid, "x-bt/MAP-msg-listing");
|
||||
goep_client_add_header_name(map_client->goep_cid, map_client->folder_name);
|
||||
goep_client_request_create_get(map_client->goep_cid);
|
||||
goep_client_header_add_type(map_client->goep_cid, "x-bt/MAP-msg-listing");
|
||||
goep_client_header_add_name(map_client->goep_cid, map_client->folder_name);
|
||||
map_client->state = MAP_W4_MESSAGES_IN_FOLDER;
|
||||
goep_client_execute(map_client->goep_cid);
|
||||
break;
|
||||
|
||||
case MAP_W2_SEND_GET_MESSAGE_WITH_HANDLE:
|
||||
goep_client_create_get_request(map_client->goep_cid);
|
||||
goep_client_request_create_get(map_client->goep_cid);
|
||||
|
||||
map_message_handle_to_str(map_message_handle_to_str_buffer, map_client->message_handle);
|
||||
goep_client_add_header_name(map_client->goep_cid, map_message_handle_to_str_buffer);
|
||||
goep_client_header_add_name(map_client->goep_cid, map_message_handle_to_str_buffer);
|
||||
|
||||
goep_client_add_header_type(map_client->goep_cid, "x-bt/message");
|
||||
goep_client_header_add_type(map_client->goep_cid, "x-bt/message");
|
||||
|
||||
application_parameters[pos++] = 0x0A; // attachment
|
||||
application_parameters[pos++] = 1;
|
||||
@ -270,22 +270,22 @@ static void map_handle_can_send_now(void){
|
||||
application_parameters[pos++] = 0x14; // Charset
|
||||
application_parameters[pos++] = 1;
|
||||
application_parameters[pos++] = 1; // UTF-8
|
||||
goep_client_add_header_application_parameters(map_client->goep_cid, 6, &application_parameters[0]);
|
||||
goep_client_header_add_application_parameters(map_client->goep_cid, &application_parameters[0], 6);
|
||||
|
||||
map_client->state = MAP_W4_MESSAGE;
|
||||
goep_client_execute(map_client->goep_cid);
|
||||
break;
|
||||
|
||||
case MAP_W2_SET_NOTIFICATION:
|
||||
goep_client_create_put_request(map_client->goep_cid);
|
||||
goep_client_add_header_type(map_client->goep_cid, "x-bt/MAP-NotificationRegistration");
|
||||
goep_client_request_create_put(map_client->goep_cid);
|
||||
goep_client_header_add_type(map_client->goep_cid, "x-bt/MAP-NotificationRegistration");
|
||||
|
||||
application_parameters[pos++] = 0x0E; // NotificationStatus
|
||||
application_parameters[pos++] = 1;
|
||||
application_parameters[pos++] = map_client->notifications_enabled;
|
||||
|
||||
goep_client_add_header_application_parameters(map_client->goep_cid, pos, &application_parameters[0]);
|
||||
goep_client_add_body_static(map_client->goep_cid, 1, (uint8_t *) "0");
|
||||
goep_client_header_add_application_parameters(map_client->goep_cid, &application_parameters[0], pos);
|
||||
goep_client_body_add_static(map_client->goep_cid, (uint8_t *) "0", 1);
|
||||
map_client->state = MAP_W4_MESSAGE;
|
||||
goep_client_execute(map_client->goep_cid);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user