mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 06:35:20 +00:00
obex_message_builder: add connect respose
This commit is contained in:
parent
ab8ccfd9f9
commit
1f6020d50e
@ -63,6 +63,10 @@ static uint8_t obex_message_builder_packet_append(uint8_t * buffer, uint16_t buf
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
uint16_t obex_message_builder_get_message_length(uint8_t * buffer){
|
||||
return big_endian_read_16(buffer, 1);
|
||||
}
|
||||
|
||||
uint8_t obex_message_builder_header_add_byte(uint8_t * buffer, uint16_t buffer_len, uint8_t header_type, uint8_t value){
|
||||
uint8_t header[2];
|
||||
header[0] = header_type;
|
||||
@ -94,8 +98,9 @@ static uint8_t obex_message_builder_header_add_connection_id(uint8_t * buffer, u
|
||||
return obex_message_builder_header_add_word(buffer, buffer_len, OBEX_HEADER_CONNECTION_ID, obex_connection_id);
|
||||
}
|
||||
|
||||
uint8_t obex_message_builder_request_create_connect(uint8_t * buffer, uint16_t buffer_len, uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length){
|
||||
uint8_t status = obex_message_builder_packet_init(buffer, buffer_len, OBEX_OPCODE_CONNECT);
|
||||
static inline uint8_t obex_message_builder_create_connect(uint8_t * buffer, uint16_t buffer_len, uint8_t opcode,
|
||||
uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length){
|
||||
uint8_t status = obex_message_builder_packet_init(buffer, buffer_len, opcode);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
uint8_t fields[4];
|
||||
@ -105,6 +110,20 @@ uint8_t obex_message_builder_request_create_connect(uint8_t * buffer, uint16_t b
|
||||
return obex_message_builder_packet_append(buffer, buffer_len, &fields[0], sizeof(fields));
|
||||
}
|
||||
|
||||
uint8_t obex_message_builder_request_create_connect(uint8_t * buffer, uint16_t buffer_len,
|
||||
uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length){
|
||||
|
||||
return obex_message_builder_create_connect(buffer, buffer_len, OBEX_OPCODE_CONNECT, obex_version_number, flags, maximum_obex_packet_length);
|
||||
}
|
||||
|
||||
uint8_t obex_message_builder_response_create_connect(uint8_t * buffer, uint16_t buffer_len, uint8_t obex_version_number,
|
||||
uint8_t flags, uint16_t maximum_obex_packet_length, uint32_t obex_connection_id){
|
||||
|
||||
uint8_t status = obex_message_builder_create_connect(buffer, buffer_len, OBEX_RESP_SUCCESS, obex_version_number, flags, maximum_obex_packet_length);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
return obex_message_builder_header_add_connection_id(buffer, buffer_len, obex_connection_id);
|
||||
}
|
||||
|
||||
uint8_t obex_message_builder_request_create_get(uint8_t * buffer, uint16_t buffer_len, uint32_t obex_connection_id){
|
||||
uint8_t status = obex_message_builder_packet_init(buffer, buffer_len, OBEX_OPCODE_GET | OBEX_OPCODE_FINAL_BIT_MASK);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
@ -158,6 +177,10 @@ uint8_t obex_message_builder_header_add_challenge_response(uint8_t * buffer, uin
|
||||
return obex_message_builder_header_add_variable(buffer, buffer_len, OBEX_HEADER_AUTHENTICATION_RESPONSE, data, length);
|
||||
}
|
||||
|
||||
uint8_t obex_message_builder_header_add_who(uint8_t * buffer, uint16_t buffer_len, const uint8_t * who){
|
||||
return obex_message_builder_header_add_variable(buffer, buffer_len, OBEX_HEADER_WHO, who, 16);
|
||||
}
|
||||
|
||||
uint8_t obex_message_builder_body_add_static(uint8_t * buffer, uint16_t buffer_len, const uint8_t * data, uint32_t length){
|
||||
return obex_message_builder_header_add_variable(buffer, buffer_len, OBEX_HEADER_END_OF_BODY, data, length);
|
||||
}
|
||||
|
@ -60,6 +60,12 @@ extern "C" {
|
||||
// buffer is too small.
|
||||
|
||||
/* API_START */
|
||||
/**
|
||||
* @brief Get message lenght
|
||||
* @param buffer
|
||||
* @return buffer_length
|
||||
*/
|
||||
uint16_t obex_message_builder_get_message_length(uint8_t * buffer);
|
||||
|
||||
/**
|
||||
* @brief Start Connect request
|
||||
@ -72,6 +78,18 @@ extern "C" {
|
||||
*/
|
||||
uint8_t obex_message_builder_request_create_connect(uint8_t * buffer, uint16_t buffer_len, uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length);
|
||||
|
||||
/**
|
||||
* @brief Start Connect response
|
||||
* @param buffer
|
||||
* @param buffer_len
|
||||
* @param obex_version_number
|
||||
* @param flags
|
||||
* @param maximum_obex_packet_length
|
||||
* @param connection_id
|
||||
* @return status
|
||||
*/
|
||||
uint8_t obex_message_builder_response_create_connect(uint8_t * buffer, uint16_t buffer_len, uint8_t obex_version_number, uint8_t flags, uint16_t maximum_obex_packet_length, uint32_t connection_id);
|
||||
|
||||
/**
|
||||
* @brief Start Disconnect request
|
||||
* @param buffer
|
||||
@ -186,6 +204,16 @@ uint8_t obex_message_builder_header_add_name_prefix(uint8_t * buffer, uint16_t b
|
||||
*/
|
||||
uint8_t obex_message_builder_header_add_target(uint8_t * buffer, uint16_t buffer_len, const uint8_t * target, uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief Add target header to current request
|
||||
* @param buffer
|
||||
* @param buffer_len
|
||||
* @param who fixed len of 16 bytes
|
||||
* @return status
|
||||
*/
|
||||
uint8_t obex_message_builder_header_add_who(uint8_t * buffer, uint16_t buffer_len, const uint8_t * who);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Add type header to current request
|
||||
* @param buffer
|
||||
@ -209,7 +237,7 @@ uint8_t obex_message_builder_header_add_count(uint8_t * buffer, uint16_t buffer_
|
||||
* @param buffer
|
||||
* @param buffer_len
|
||||
* @param data
|
||||
* @param lenght of application parameters
|
||||
* @param length of application parameters
|
||||
* @return status
|
||||
*/
|
||||
uint8_t obex_message_builder_header_add_application_parameters(uint8_t * buffer, uint16_t buffer_len, const uint8_t * data, uint16_t length);
|
||||
@ -219,7 +247,7 @@ uint8_t obex_message_builder_header_add_application_parameters(uint8_t * buffer,
|
||||
* @param buffer
|
||||
* @param buffer_len
|
||||
* @param data
|
||||
* @param lenght of challenge response
|
||||
* @param length of challenge response
|
||||
* @return status
|
||||
*/
|
||||
uint8_t obex_message_builder_header_add_challenge_response(uint8_t * buffer, uint16_t buffer_len, const uint8_t * data, uint16_t length);
|
||||
@ -229,7 +257,7 @@ uint8_t obex_message_builder_header_add_challenge_response(uint8_t * buffer, uin
|
||||
* @param buffer
|
||||
* @param buffer_len
|
||||
* @param data
|
||||
* @param lenght
|
||||
* @param length
|
||||
* @return status
|
||||
*/
|
||||
uint8_t obex_message_builder_body_add_static(uint8_t * buffer, uint16_t buffer_len, const uint8_t * data, uint32_t length);
|
||||
|
Loading…
x
Reference in New Issue
Block a user