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
bt_control_t bt_control_iphone = {
.on = iphone_on,
.off = iphone_off,
.sleep = iphone_sleep,
.wake = iphone_wake,
.valid = iphone_valid,
.name = iphone_name,
.register_for_power_notifications = iphone_register_for_power_notifications
iphone_on, // on
iphone_off, // off
iphone_sleep, // sleep
iphone_wake, // wake
iphone_valid, // valid
iphone_name, // name
NULL, // baudrate_cmd
NULL, // next_cmd
iphone_register_for_power_notifications, // register_for_power_notifications
NULL // hw_error
};
int iphone_system_bt_enabled(void){

View File

@ -160,35 +160,38 @@ void parse(uint8_t eventByte){
case GET_ATTRIBUTE_VALUE_LENGTH:
attribute_bytes_received++;
{
sdp_parser_attribute_value_event_t attribute_value_event = {
.type = SDP_PARSER_ATTRIBUTE_VALUE,
.record_id = record_counter,
.attribute_id = attribute_id,
.attribute_length = attribute_value_size,
.data_offset = attribute_bytes_delivered++,
.data = eventByte
SDP_PARSER_ATTRIBUTE_VALUE,
record_counter,
attribute_id,
attribute_value_size,
attribute_bytes_delivered++,
eventByte
};
(*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;
state = GET_ATTRIBUTE_VALUE;
break;
case GET_ATTRIBUTE_VALUE:
case GET_ATTRIBUTE_VALUE:
attribute_bytes_received++;
sdp_parser_attribute_value_event_t attribute_value_event1 = {
.type = SDP_PARSER_ATTRIBUTE_VALUE,
.record_id = record_counter,
.attribute_id = attribute_id,
.attribute_length = attribute_value_size,
.data_offset = attribute_bytes_delivered++,
.data = eventByte
{
sdp_parser_attribute_value_event_t attribute_value_event = {
SDP_PARSER_ATTRIBUTE_VALUE,
record_counter,
attribute_id,
attribute_value_size,
attribute_bytes_delivered++,
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);
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){
sdp_parser_complete_event_t complete_event = {
.type = SDP_PARSER_COMPLETE,
.status = status
SDP_PARSER_COMPLETE,
status
};
(*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
if (data_offset == attribute_value_length - 1 && sdp_rfcom_channel_nr!=0){
sdp_query_rfcomm_service_event_t value_event = {
.type = SDP_QUERY_RFCOMM_SERVICE,
.service_name = (uint8_t *) sdp_service_name,
.channel_nr = sdp_rfcom_channel_nr
SDP_QUERY_RFCOMM_SERVICE,
sdp_rfcom_channel_nr,
(uint8_t *) sdp_service_name
};
printf("Service found %s\n", sdp_service_name);
(*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:
ce = (sdp_parser_complete_event_t*) event;
sdp_query_complete_event_t c_event = {
.type = SDP_QUERY_COMPLETE,
.status = ce->status
SDP_QUERY_COMPLETE,
ce->status
};
(*sdp_app_callback)((sdp_query_event_t*)&c_event, sdp_app_context);
break;