Trying to implement speaker mode on the Openmoko Freerunner
This commit is contained in:
parent
01d2e6b76a
commit
bd496ec387
|
@ -49,6 +49,8 @@ typedef enum _PhoneEvent
|
|||
PHONE_EVENT_SIM_VALID,
|
||||
PHONE_EVENT_SMS_SENT, /* char * buffer, size_t * len */
|
||||
PHONE_EVENT_SMS_RECEIVED, /* char * buffer, size_t * len */
|
||||
PHONE_EVENT_SPEAKER_ON,
|
||||
PHONE_EVENT_SPEAKER_OFF,
|
||||
PHONE_EVENT_VIBRATOR_OFF,
|
||||
PHONE_EVENT_VIBRATOR_ON
|
||||
} PhoneEvent;
|
||||
|
|
|
@ -125,6 +125,17 @@ void on_phone_call_reject(gpointer data)
|
|||
}
|
||||
|
||||
|
||||
/* on_phone_call_speaker */
|
||||
void on_phone_call_speaker(GtkWidget * widget, gpointer data)
|
||||
{
|
||||
Phone * phone = data;
|
||||
gboolean speaker;
|
||||
|
||||
speaker = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
phone_call_speaker(phone, speaker);
|
||||
}
|
||||
|
||||
|
||||
/* code */
|
||||
/* on_phone_code_clear */
|
||||
void on_phone_code_clear(gpointer data)
|
||||
|
|
|
@ -32,6 +32,7 @@ void on_phone_call_close(gpointer data);
|
|||
void on_phone_call_hangup(gpointer data);
|
||||
void on_phone_call_mute(GtkWidget * widget, gpointer data);
|
||||
void on_phone_call_reject(gpointer data);
|
||||
void on_phone_call_speaker(GtkWidget * widget, gpointer data);
|
||||
|
||||
/* code */
|
||||
void on_phone_code_clear(gpointer data);
|
||||
|
|
12
src/phone.c
12
src/phone.c
|
@ -485,6 +485,14 @@ void phone_call_reject(Phone * phone)
|
|||
}
|
||||
|
||||
|
||||
/* phone_call_speaker */
|
||||
void phone_call_speaker(Phone * phone, gboolean speaker)
|
||||
{
|
||||
phone_event(phone, speaker ? PHONE_EVENT_SPEAKER_ON
|
||||
: PHONE_EVENT_SPEAKER_OFF);
|
||||
}
|
||||
|
||||
|
||||
/* phone_code_append */
|
||||
int phone_code_append(Phone * phone, char character)
|
||||
{
|
||||
|
@ -691,6 +699,8 @@ void phone_event(Phone * phone, PhoneEvent event, ...)
|
|||
case PHONE_EVENT_NOTIFICATION_OFF:
|
||||
case PHONE_EVENT_NOTIFICATION_ON:
|
||||
case PHONE_EVENT_SIM_VALID:
|
||||
case PHONE_EVENT_SPEAKER_OFF:
|
||||
case PHONE_EVENT_SPEAKER_ON:
|
||||
case PHONE_EVENT_VIBRATOR_OFF:
|
||||
case PHONE_EVENT_VIBRATOR_ON:
|
||||
plugin->event(plugin, event);
|
||||
|
@ -955,6 +965,8 @@ void phone_show_call(Phone * phone, gboolean show, ...)
|
|||
gtk_button_set_image(GTK_BUTTON(phone->ca_speaker),
|
||||
gtk_image_new_from_icon_name("stock_volume-max",
|
||||
GTK_ICON_SIZE_BUTTON));
|
||||
g_signal_connect(G_OBJECT(phone->ca_speaker), "toggled",
|
||||
G_CALLBACK(on_phone_call_speaker), phone);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), phone->ca_speaker, FALSE,
|
||||
TRUE, 0);
|
||||
/* mute microphone */
|
||||
|
|
|
@ -55,6 +55,7 @@ void phone_call_answer(Phone * phone);
|
|||
void phone_call_hangup(Phone * phone);
|
||||
void phone_call_mute(Phone * phone, gboolean mute);
|
||||
void phone_call_reject(Phone * phone);
|
||||
void phone_call_speaker(Phone * phone, gboolean speaker);
|
||||
|
||||
/* code */
|
||||
int phone_code_append(Phone * phone, char character);
|
||||
|
|
|
@ -90,6 +90,14 @@ static int _openmoko_event(PhonePlugin * plugin, PhoneEvent event, ...)
|
|||
case PHONE_EVENT_NOTIFICATION_ON:
|
||||
/* FIXME implement */
|
||||
break;
|
||||
case PHONE_EVENT_SPEAKER_ON:
|
||||
/* XXX assumes there's an ongoing call */
|
||||
_event_mixer_set("gsmspeakerout.state");
|
||||
break;
|
||||
case PHONE_EVENT_SPEAKER_OFF:
|
||||
/* XXX assumes there's an ongoing call */
|
||||
_event_mixer_set("gsmhandset.state");
|
||||
break;
|
||||
case PHONE_EVENT_VIBRATOR_OFF:
|
||||
/* FIXME implement */
|
||||
break;
|
||||
|
|
|
@ -156,6 +156,8 @@ static int _profiles_event(PhonePlugin * plugin, PhoneEvent event, ...)
|
|||
/* not relevant */
|
||||
case PHONE_EVENT_NOTIFICATION_OFF:
|
||||
case PHONE_EVENT_NOTIFICATION_ON:
|
||||
case PHONE_EVENT_SPEAKER_OFF:
|
||||
case PHONE_EVENT_SPEAKER_ON:
|
||||
case PHONE_EVENT_VIBRATOR_OFF:
|
||||
case PHONE_EVENT_VIBRATOR_ON:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user