removed struct initialization with designated initializer, instead the elements of an initializer to appear in a fixed order

This commit is contained in:
matthias.ringwald@gmail.com 2013-05-24 11:52:51 +00:00
parent 95b6ea6e1e
commit ae83e88440
3 changed files with 38 additions and 32 deletions

View File

@ -707,13 +707,16 @@ int bt_control_iphone_power_management_enabled(void){
// single instance // single instance
bt_control_t bt_control_iphone = { bt_control_t bt_control_iphone = {
.on = iphone_on, iphone_on, // on
.off = iphone_off, iphone_off, // off
.sleep = iphone_sleep, iphone_sleep, // sleep
.wake = iphone_wake, iphone_wake, // wake
.valid = iphone_valid, iphone_valid, // valid
.name = iphone_name, iphone_name, // name
.register_for_power_notifications = iphone_register_for_power_notifications NULL, // baudrate_cmd
NULL, // next_cmd
iphone_register_for_power_notifications, // register_for_power_notifications
NULL // hw_error
}; };
int iphone_system_bt_enabled(void){ int iphone_system_bt_enabled(void){

View File

@ -160,35 +160,38 @@ void parse(uint8_t eventByte){
case GET_ATTRIBUTE_VALUE_LENGTH: case GET_ATTRIBUTE_VALUE_LENGTH:
attribute_bytes_received++; attribute_bytes_received++;
{
sdp_parser_attribute_value_event_t attribute_value_event = { sdp_parser_attribute_value_event_t attribute_value_event = {
.type = SDP_PARSER_ATTRIBUTE_VALUE, SDP_PARSER_ATTRIBUTE_VALUE,
.record_id = record_counter, record_counter,
.attribute_id = attribute_id, attribute_id,
.attribute_length = attribute_value_size, attribute_value_size,
.data_offset = attribute_bytes_delivered++, attribute_bytes_delivered++,
.data = eventByte eventByte
}; };
(*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&attribute_value_event); (*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&attribute_value_event);
}
if (!de_state_size(eventByte, &de_header_state)) break; if (!de_state_size(eventByte, &de_header_state)) break;
attribute_value_size = de_header_state.de_size + attribute_bytes_received; attribute_value_size = de_header_state.de_size + attribute_bytes_received;
state = GET_ATTRIBUTE_VALUE; state = GET_ATTRIBUTE_VALUE;
break; break;
case GET_ATTRIBUTE_VALUE: case GET_ATTRIBUTE_VALUE:
attribute_bytes_received++; attribute_bytes_received++;
{
sdp_parser_attribute_value_event_t attribute_value_event1 = { sdp_parser_attribute_value_event_t attribute_value_event = {
.type = SDP_PARSER_ATTRIBUTE_VALUE, SDP_PARSER_ATTRIBUTE_VALUE,
.record_id = record_counter, record_counter,
.attribute_id = attribute_id, attribute_id,
.attribute_length = attribute_value_size, attribute_value_size,
.data_offset = attribute_bytes_delivered++, attribute_bytes_delivered++,
.data = eventByte eventByte
}; };
(*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&attribute_value_event1);
(*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&attribute_value_event);
}
// printf("paser: attribute_bytes_received %u, attribute_value_size %u\n", attribute_bytes_received, attribute_value_size); // printf("paser: attribute_bytes_received %u, attribute_value_size %u\n", attribute_bytes_received, attribute_value_size);
if (attribute_bytes_received < attribute_value_size) break; if (attribute_bytes_received < attribute_value_size) break;
@ -235,8 +238,8 @@ void sdp_parser_handle_chunk(uint8_t * data, uint16_t size){
void sdp_parser_handle_done(uint8_t status){ void sdp_parser_handle_done(uint8_t status){
sdp_parser_complete_event_t complete_event = { sdp_parser_complete_event_t complete_event = {
.type = SDP_PARSER_COMPLETE, SDP_PARSER_COMPLETE,
.status = status status
}; };
(*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&complete_event); (*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&complete_event);
} }

View File

@ -229,9 +229,9 @@ void handleServiceNameData(uint32_t attribute_value_length, uint32_t data_offset
// notify on last char // notify on last char
if (data_offset == attribute_value_length - 1 && sdp_rfcom_channel_nr!=0){ if (data_offset == attribute_value_length - 1 && sdp_rfcom_channel_nr!=0){
sdp_query_rfcomm_service_event_t value_event = { sdp_query_rfcomm_service_event_t value_event = {
.type = SDP_QUERY_RFCOMM_SERVICE, SDP_QUERY_RFCOMM_SERVICE,
.service_name = (uint8_t *) sdp_service_name, sdp_rfcom_channel_nr,
.channel_nr = sdp_rfcom_channel_nr (uint8_t *) sdp_service_name
}; };
printf("Service found %s\n", sdp_service_name); printf("Service found %s\n", sdp_service_name);
(*sdp_app_callback)((sdp_query_event_t*)&value_event, sdp_app_context); (*sdp_app_callback)((sdp_query_event_t*)&value_event, sdp_app_context);
@ -267,8 +267,8 @@ static void handle_sdp_parser_event(sdp_parser_event_t * event){
case SDP_PARSER_COMPLETE: case SDP_PARSER_COMPLETE:
ce = (sdp_parser_complete_event_t*) event; ce = (sdp_parser_complete_event_t*) event;
sdp_query_complete_event_t c_event = { sdp_query_complete_event_t c_event = {
.type = SDP_QUERY_COMPLETE, SDP_QUERY_COMPLETE,
.status = ce->status ce->status
}; };
(*sdp_app_callback)((sdp_query_event_t*)&c_event, sdp_app_context); (*sdp_app_callback)((sdp_query_event_t*)&c_event, sdp_app_context);
break; break;