Skinny: reindent using vim's =G

This commit is contained in:
Mathieu Parent 2011-05-13 00:32:57 +02:00
parent 5f6c469e44
commit ff08ea68ce
8 changed files with 1832 additions and 1843 deletions

View File

@ -50,58 +50,58 @@ skinny_globals_t globals;
/* SQL TABLES */ /* SQL TABLES */
/*****************************************************************************/ /*****************************************************************************/
static char devices_sql[] = static char devices_sql[] =
"CREATE TABLE skinny_devices (\n" "CREATE TABLE skinny_devices (\n"
" name VARCHAR(16),\n" " name VARCHAR(16),\n"
" user_id INTEGER,\n" " user_id INTEGER,\n"
" instance INTEGER,\n" " instance INTEGER,\n"
" ip VARCHAR(15),\n" " ip VARCHAR(15),\n"
" type INTEGER,\n" " type INTEGER,\n"
" max_streams INTEGER,\n" " max_streams INTEGER,\n"
" port INTEGER,\n" " port INTEGER,\n"
" codec_string VARCHAR(255),\n" " codec_string VARCHAR(255),\n"
" headset INTEGER,\n" " headset INTEGER,\n"
" handset INTEGER,\n" " handset INTEGER,\n"
" speaker INTEGER\n" " speaker INTEGER\n"
");\n"; ");\n";
static char lines_sql[] = static char lines_sql[] =
"CREATE TABLE skinny_lines (\n" "CREATE TABLE skinny_lines (\n"
" device_name VARCHAR(16),\n" " device_name VARCHAR(16),\n"
" device_instance INTEGER,\n" " device_instance INTEGER,\n"
" position INTEGER,\n" " position INTEGER,\n"
" line_instance INTEGER,\n" " line_instance INTEGER,\n"
" label VARCHAR(40),\n" " label VARCHAR(40),\n"
" value VARCHAR(24),\n" " value VARCHAR(24),\n"
" caller_name VARCHAR(44),\n" " caller_name VARCHAR(44),\n"
" ring_on_idle INTEGER,\n" " ring_on_idle INTEGER,\n"
" ring_on_active INTEGER,\n" " ring_on_active INTEGER,\n"
" busy_trigger INTEGER,\n" " busy_trigger INTEGER,\n"
" forward_all VARCHAR(255),\n" " forward_all VARCHAR(255),\n"
" forward_busy VARCHAR(255),\n" " forward_busy VARCHAR(255),\n"
" forward_noanswer VARCHAR(255),\n" " forward_noanswer VARCHAR(255),\n"
" noanswer_duration INTEGER\n" " noanswer_duration INTEGER\n"
");\n"; ");\n";
static char buttons_sql[] = static char buttons_sql[] =
"CREATE TABLE skinny_buttons (\n" "CREATE TABLE skinny_buttons (\n"
" device_name VARCHAR(16),\n" " device_name VARCHAR(16),\n"
" device_instance INTEGER,\n" " device_instance INTEGER,\n"
" position INTEGER,\n" " position INTEGER,\n"
" type INTEGER,\n" " type INTEGER,\n"
" label VARCHAR(40),\n" " label VARCHAR(40),\n"
" value VARCHAR(255),\n" " value VARCHAR(255),\n"
" settings VARCHAR(44)\n" " settings VARCHAR(44)\n"
");\n"; ");\n";
static char active_lines_sql[] = static char active_lines_sql[] =
"CREATE TABLE skinny_active_lines (\n" "CREATE TABLE skinny_active_lines (\n"
" device_name VARCHAR(16),\n" " device_name VARCHAR(16),\n"
" device_instance INTEGER,\n" " device_instance INTEGER,\n"
" line_instance INTEGER,\n" " line_instance INTEGER,\n"
" channel_uuid VARCHAR(256),\n" " channel_uuid VARCHAR(256),\n"
" call_id INTEGER,\n" " call_id INTEGER,\n"
" call_state INTEGER\n" " call_state INTEGER\n"
");\n"; ");\n";
/*****************************************************************************/ /*****************************************************************************/
/* PROFILES FUNCTIONS */ /* PROFILES FUNCTIONS */
@ -340,7 +340,7 @@ switch_status_t skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_
status = switch_cache_db_execute_sql(dbh, sql, NULL); status = switch_cache_db_execute_sql(dbh, sql, NULL);
end: end:
switch_cache_db_release_db_handle(&dbh); switch_cache_db_release_db_handle(&dbh);
@ -374,7 +374,7 @@ switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile, switch_mute
free(errmsg); free(errmsg);
} }
end: end:
switch_cache_db_release_db_handle(&dbh); switch_cache_db_release_db_handle(&dbh);
@ -571,7 +571,7 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
} }
*/ */
end: end:
if (resetting) { if (resetting) {
switch_core_session_unlock_codec_write(tech_pvt->session); switch_core_session_unlock_codec_write(tech_pvt->session);
switch_core_session_unlock_codec_read(tech_pvt->session); switch_core_session_unlock_codec_read(tech_pvt->session);
@ -600,7 +600,7 @@ void tech_init(private_t *tech_pvt, skinny_profile_t *profile, switch_core_sessi
State methods they get called when the state changes to the specific state State methods they get called when the state changes to the specific state
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
*/ */
switch_status_t channel_on_init(switch_core_session_t *session) switch_status_t channel_on_init(switch_core_session_t *session)
{ {
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
@ -1020,7 +1020,7 @@ switch_status_t channel_receive_message(switch_core_session_t *session, switch_c
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool! that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/ */
switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile, switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause) switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
@ -1116,7 +1116,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
cause = SWITCH_CAUSE_SUCCESS; cause = SWITCH_CAUSE_SUCCESS;
goto done; goto done;
error: error:
if (nsession) { if (nsession) {
switch_core_session_destroy(&nsession); switch_core_session_destroy(&nsession);
} }
@ -1126,7 +1126,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
} }
done: done:
if (profile) { if (profile) {
if (cause == SWITCH_CAUSE_SUCCESS) { if (cause == SWITCH_CAUSE_SUCCESS) {
@ -1559,7 +1559,7 @@ new_socket:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket up listening on %s:%u\n", profile->ip, profile->port); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket up listening on %s:%u\n", profile->ip, profile->port);
break; break;
sock_fail: sock_fail:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", profile->ip, profile->port); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", profile->ip, profile->port);
switch_yield(100000); switch_yield(100000);
} }
@ -1622,7 +1622,7 @@ new_socket:
} }
end: end:
close_socket(&profile->sock, profile); close_socket(&profile->sock, profile);
@ -1635,7 +1635,7 @@ new_socket:
} }
fail: fail:
return NULL; return NULL;
} }

View File

@ -290,8 +290,7 @@ switch_status_t skinny_session_process_dest(switch_core_session_t *session, list
SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, 0xffff); SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, 0xffff);
} }
} else { } else {
tech_pvt->caller_profile->destination_number = switch_core_strdup(tech_pvt->caller_profile->pool, tech_pvt->caller_profile->destination_number = switch_core_strdup(tech_pvt->caller_profile->pool, dest);
dest);
switch_set_flag_locked(tech_pvt, TFLAG_FORCE_ROUTE); switch_set_flag_locked(tech_pvt, TFLAG_FORCE_ROUTE);
} }
@ -598,10 +597,8 @@ switch_status_t skinny_session_ring_out(switch_core_session_t *session, listener
send_start_tone(listener, SKINNY_TONE_ALERT, 0, line_instance, tech_pvt->call_id); send_start_tone(listener, SKINNY_TONE_ALERT, 0, line_instance, tech_pvt->call_id);
skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_RING_OUT); skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_RING_OUT);
send_select_soft_keys(listener, line_instance, tech_pvt->call_id, send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_RING_OUT, 0xffff);
SKINNY_KEY_SET_RING_OUT, 0xffff); send_display_prompt_status(listener, 0, SKINNY_DISP_RING_OUT, line_instance, tech_pvt->call_id);
send_display_prompt_status(listener, 0, SKINNY_DISP_RING_OUT,
line_instance, tech_pvt->call_id);
skinny_session_send_call_info(session, listener, line_instance); skinny_session_send_call_info(session, listener, line_instance);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
@ -1776,17 +1773,14 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
switch(request->data.soft_key_event.event) { switch(request->data.soft_key_event.event) {
case SOFTKEY_REDIAL: case SOFTKEY_REDIAL:
status = skinny_create_incoming_session(listener, &line_instance, &session); status = skinny_create_incoming_session(listener, &line_instance, &session);
skinny_session_process_dest(session, listener, line_instance, "redial", '\0', 0); skinny_session_process_dest(session, listener, line_instance, "redial", '\0', 0);
break; break;
case SOFTKEY_NEWCALL: case SOFTKEY_NEWCALL:
status = skinny_create_incoming_session(listener, &line_instance, &session); status = skinny_create_incoming_session(listener, &line_instance, &session);
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0); skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
break; break;
case SOFTKEY_HOLD: case SOFTKEY_HOLD:
session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id); session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
if(session) { if(session) {
status = skinny_session_hold_line(session, listener, line_instance); status = skinny_session_hold_line(session, listener, line_instance);
} }
@ -1800,30 +1794,25 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
break; break;
case SOFTKEY_BACKSPACE: case SOFTKEY_BACKSPACE:
session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id); session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
if(session) { if(session) {
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 1); skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 1);
} }
break; break;
case SOFTKEY_ENDCALL: case SOFTKEY_ENDCALL:
session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id); session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
if(session) { if(session) {
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
} }
break; break;
case SOFTKEY_RESUME: case SOFTKEY_RESUME:
session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id); session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
if(session) { if(session) {
status = skinny_session_unhold_line(session, listener, line_instance); status = skinny_session_unhold_line(session, listener, line_instance);
} }
break; break;
case SOFTKEY_ANSWER: case SOFTKEY_ANSWER:
session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id); session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
if(session) { if(session) {
status = skinny_session_answer(session, listener, line_instance); status = skinny_session_answer(session, listener, line_instance);
} }

View File

@ -108,10 +108,10 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
{XML_ALARM_MESSAGE, "XMLAlarmMessage"}, {XML_ALARM_MESSAGE, "XMLAlarmMessage"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage") SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage")
SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1) SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1)
struct skinny_table SKINNY_DEVICE_TYPES[] = { struct skinny_table SKINNY_DEVICE_TYPES[] = {
{1, "Cisco 30 SP+"}, {1, "Cisco 30 SP+"},
{2, "Cisco 12 SP+"}, {2, "Cisco 12 SP+"},
{3, "Cisco 12 SP"}, {3, "Cisco 12 SP"},
@ -128,29 +128,29 @@ struct skinny_table SKINNY_DEVICE_TYPES[] = {
{30018, "Cisco IP Phone CP-7961G"}, {30018, "Cisco IP Phone CP-7961G"},
{30019, "Cisco IP Phone 7936"}, {30019, "Cisco IP Phone 7936"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType") SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType")
SKINNY_DECLARE_STR2ID(skinny_str2device_type, SKINNY_DEVICE_TYPES, -1) SKINNY_DECLARE_STR2ID(skinny_str2device_type, SKINNY_DEVICE_TYPES, -1)
struct skinny_table SKINNY_RING_TYPES[] = { struct skinny_table SKINNY_RING_TYPES[] = {
{SKINNY_RING_OFF, "RingOff"}, {SKINNY_RING_OFF, "RingOff"},
{SKINNY_RING_INSIDE, "RingInside"}, {SKINNY_RING_INSIDE, "RingInside"},
{SKINNY_RING_OUTSIDE, "RingOutside"}, {SKINNY_RING_OUTSIDE, "RingOutside"},
{SKINNY_RING_FEATURE, "RingFeature"}, {SKINNY_RING_FEATURE, "RingFeature"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown") SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2ring_type, SKINNY_RING_TYPES, -1) SKINNY_DECLARE_STR2ID(skinny_str2ring_type, SKINNY_RING_TYPES, -1)
struct skinny_table SKINNY_RING_MODES[] = { struct skinny_table SKINNY_RING_MODES[] = {
{SKINNY_RING_FOREVER, "RingForever"}, {SKINNY_RING_FOREVER, "RingForever"},
{SKINNY_RING_ONCE, "RingOnce"}, {SKINNY_RING_ONCE, "RingOnce"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown") SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1) SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1)
struct skinny_table SKINNY_BUTTONS[] = { struct skinny_table SKINNY_BUTTONS[] = {
{SKINNY_BUTTON_UNKNOWN, "Unknown"}, {SKINNY_BUTTON_UNKNOWN, "Unknown"},
{SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"}, {SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"},
{SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"}, {SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"},
@ -162,11 +162,11 @@ struct skinny_table SKINNY_BUTTONS[] = {
{SKINNY_BUTTON_SERVICE_URL, "ServiceUrl"}, {SKINNY_BUTTON_SERVICE_URL, "ServiceUrl"},
{SKINNY_BUTTON_UNDEFINED, "Undefined"}, {SKINNY_BUTTON_UNDEFINED, "Undefined"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown") SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown")
SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1) SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1)
struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = { struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = {
{SOFTKEY_REDIAL, "SoftkeyRedial"}, {SOFTKEY_REDIAL, "SoftkeyRedial"},
{SOFTKEY_NEWCALL, "SoftkeyNewcall"}, {SOFTKEY_NEWCALL, "SoftkeyNewcall"},
{SOFTKEY_HOLD, "SoftkeyHold"}, {SOFTKEY_HOLD, "SoftkeyHold"},
@ -188,30 +188,30 @@ struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = {
{SOFTKEY_DND, "SoftkeyDnd"}, {SOFTKEY_DND, "SoftkeyDnd"},
{SOFTKEY_IDIVERT, "SoftkeyIdivert"}, {SOFTKEY_IDIVERT, "SoftkeyIdivert"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown") SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, 0) SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, 0)
struct skinny_table SKINNY_LAMP_MODES[] = { struct skinny_table SKINNY_LAMP_MODES[] = {
{SKINNY_LAMP_OFF, "Off"}, {SKINNY_LAMP_OFF, "Off"},
{SKINNY_LAMP_ON, "On"}, {SKINNY_LAMP_ON, "On"},
{SKINNY_LAMP_WINK, "Wink"}, {SKINNY_LAMP_WINK, "Wink"},
{SKINNY_LAMP_FLASH, "Flash"}, {SKINNY_LAMP_FLASH, "Flash"},
{SKINNY_LAMP_BLINK, "Blink"}, {SKINNY_LAMP_BLINK, "Blink"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown") SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown")
SKINNY_DECLARE_STR2ID(skinny_str2lamp_mode, SKINNY_LAMP_MODES, -1) SKINNY_DECLARE_STR2ID(skinny_str2lamp_mode, SKINNY_LAMP_MODES, -1)
struct skinny_table SKINNY_SPEAKER_MODES[] = { struct skinny_table SKINNY_SPEAKER_MODES[] = {
{SKINNY_SPEAKER_ON, "SpeakerOn"}, {SKINNY_SPEAKER_ON, "SpeakerOn"},
{SKINNY_SPEAKER_OFF, "SpeakerOff"}, {SKINNY_SPEAKER_OFF, "SpeakerOff"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown") SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown")
SKINNY_DECLARE_STR2ID(skinny_str2speaker_mode, SKINNY_SPEAKER_MODES, -1) SKINNY_DECLARE_STR2ID(skinny_str2speaker_mode, SKINNY_SPEAKER_MODES, -1)
struct skinny_table SKINNY_KEY_SETS[] = { struct skinny_table SKINNY_KEY_SETS[] = {
{SKINNY_KEY_SET_ON_HOOK, "KeySetOnHook"}, {SKINNY_KEY_SET_ON_HOOK, "KeySetOnHook"},
{SKINNY_KEY_SET_CONNECTED, "KeySetConnected"}, {SKINNY_KEY_SET_CONNECTED, "KeySetConnected"},
{SKINNY_KEY_SET_ON_HOLD, "KeySetOnHold"}, {SKINNY_KEY_SET_ON_HOLD, "KeySetOnHold"},
@ -224,11 +224,11 @@ struct skinny_table SKINNY_KEY_SETS[] = {
{SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES, "KeySetOffHookWithFeatures"}, {SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES, "KeySetOffHookWithFeatures"},
{SKINNY_KEY_SET_IN_USE_HINT, "KeySetInUseHint"}, {SKINNY_KEY_SET_IN_USE_HINT, "KeySetInUseHint"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET") SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET")
SKINNY_DECLARE_STR2ID(skinny_str2soft_key_set, SKINNY_KEY_SETS, -1) SKINNY_DECLARE_STR2ID(skinny_str2soft_key_set, SKINNY_KEY_SETS, -1)
struct skinny_table SKINNY_CALL_STATES[] = { struct skinny_table SKINNY_CALL_STATES[] = {
{SKINNY_OFF_HOOK, "OffHook"}, {SKINNY_OFF_HOOK, "OffHook"},
{SKINNY_ON_HOOK, "OnHook"}, {SKINNY_ON_HOOK, "OnHook"},
{SKINNY_RING_OUT, "RingOut"}, {SKINNY_RING_OUT, "RingOut"},
@ -244,38 +244,38 @@ struct skinny_table SKINNY_CALL_STATES[] = {
{SKINNY_IN_USE_REMOTELY, "InUseRemotely"}, {SKINNY_IN_USE_REMOTELY, "InUseRemotely"},
{SKINNY_INVALID_NUMBER, "InvalidNumber"}, {SKINNY_INVALID_NUMBER, "InvalidNumber"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown") SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2call_state, SKINNY_CALL_STATES, -1) SKINNY_DECLARE_STR2ID(skinny_str2call_state, SKINNY_CALL_STATES, -1)
struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = { struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = {
{SKINNY_DEVICE_RESET, "DeviceReset"}, {SKINNY_DEVICE_RESET, "DeviceReset"},
{SKINNY_DEVICE_RESTART, "DeviceRestart"}, {SKINNY_DEVICE_RESTART, "DeviceRestart"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown") SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1) SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1)
struct skinny_table SKINNY_ACCESSORY_TYPES[] = { struct skinny_table SKINNY_ACCESSORY_TYPES[] = {
{SKINNY_ACCESSORY_NONE, "AccessoryNone"}, {SKINNY_ACCESSORY_NONE, "AccessoryNone"},
{SKINNY_ACCESSORY_HEADSET, "Headset"}, {SKINNY_ACCESSORY_HEADSET, "Headset"},
{SKINNY_ACCESSORY_HANDSET, "Handset"}, {SKINNY_ACCESSORY_HANDSET, "Handset"},
{SKINNY_ACCESSORY_SPEAKER, "Speaker"}, {SKINNY_ACCESSORY_SPEAKER, "Speaker"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_accessory_type2str, SKINNY_ACCESSORY_TYPES, "AccessoryUnknown") SKINNY_DECLARE_ID2STR(skinny_accessory_type2str, SKINNY_ACCESSORY_TYPES, "AccessoryUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2accessory_type, SKINNY_ACCESSORY_TYPES, -1) SKINNY_DECLARE_STR2ID(skinny_str2accessory_type, SKINNY_ACCESSORY_TYPES, -1)
struct skinny_table SKINNY_ACCESSORY_STATES[] = { struct skinny_table SKINNY_ACCESSORY_STATES[] = {
{SKINNY_ACCESSORY_STATE_NONE, "AccessoryNoState"}, {SKINNY_ACCESSORY_STATE_NONE, "AccessoryNoState"},
{SKINNY_ACCESSORY_STATE_OFFHOOK, "OffHook"}, {SKINNY_ACCESSORY_STATE_OFFHOOK, "OffHook"},
{SKINNY_ACCESSORY_STATE_ONHOOK, "OnHook"}, {SKINNY_ACCESSORY_STATE_ONHOOK, "OnHook"},
{0, NULL} {0, NULL}
}; };
SKINNY_DECLARE_ID2STR(skinny_accessory_state2str, SKINNY_ACCESSORY_STATES, "AccessoryStateUnknown") SKINNY_DECLARE_ID2STR(skinny_accessory_state2str, SKINNY_ACCESSORY_STATES, "AccessoryStateUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2accessory_state, SKINNY_ACCESSORY_STATES, -1) SKINNY_DECLARE_STR2ID(skinny_str2accessory_state, SKINNY_ACCESSORY_STATES, -1)
/* For Emacs: /* For Emacs:
* Local Variables: * Local Variables:
* mode:c * mode:c
* indent-tabs-mode:t * indent-tabs-mode:t

View File

@ -41,7 +41,7 @@ struct skinny_table {
}; };
#define SKINNY_DECLARE_ID2STR(func, TABLE, DEFAULT_STR) \ #define SKINNY_DECLARE_ID2STR(func, TABLE, DEFAULT_STR) \
const char *func(uint32_t id) \ const char *func(uint32_t id) \
{ \ { \
const char *str = DEFAULT_STR; \ const char *str = DEFAULT_STR; \
uint8_t x; \ uint8_t x; \
@ -57,7 +57,7 @@ const char *func(uint32_t id) \
} }
#define SKINNY_DECLARE_STR2ID(func, TABLE, DEFAULT_ID) \ #define SKINNY_DECLARE_STR2ID(func, TABLE, DEFAULT_ID) \
uint32_t func(const char *str)\ uint32_t func(const char *str)\
{\ {\
uint32_t id = (uint32_t) DEFAULT_ID;\ uint32_t id = (uint32_t) DEFAULT_ID;\
\ \
@ -77,14 +77,14 @@ uint32_t func(const char *str)\
#define SKINNY_DECLARE_PUSH_MATCH(TABLE) \ #define SKINNY_DECLARE_PUSH_MATCH(TABLE) \
switch_console_callback_match_t *my_matches = NULL;\ switch_console_callback_match_t *my_matches = NULL;\
uint8_t x;\ uint8_t x;\
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\ for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
switch_console_push_match(&my_matches, TABLE[x].name);\ switch_console_push_match(&my_matches, TABLE[x].name);\
}\ }\
if (my_matches) {\ if (my_matches) {\
*matches = my_matches;\ *matches = my_matches;\
status = SWITCH_STATUS_SUCCESS;\ status = SWITCH_STATUS_SUCCESS;\
} }
extern struct skinny_table SKINNY_MESSAGE_TYPES[72]; extern struct skinny_table SKINNY_MESSAGE_TYPES[72];