Add RTP support for ril V1.
Change-Id: Ibaedd44756ad14e01912b4c9db705d312f1ae960
diff --git a/mbtk/mbtk_rtpd/src/main.c b/mbtk/mbtk_rtpd/src/main.c
index a0219fa..b8eec79 100755
--- a/mbtk/mbtk_rtpd/src/main.c
+++ b/mbtk/mbtk_rtpd/src/main.c
@@ -375,6 +375,7 @@
return -1;
}
+#ifdef MBTK_DEV_INFO_VERSION_2
static void call_state_change_cb(const void* data, int data_len)
{
if(data) {
@@ -431,6 +432,119 @@
return 0;
}
+#else
+
+static void call_state_change_cb(const void* data, int data_len)
+{
+ if(data) {
+ mbtk_call_info_t *state = (mbtk_call_info_t*)data;
+ LOGD("call state change : call_wait-%d, state-%d", state->call_wait, state->state);
+ if(state->call_wait == MBTK_DISCONNECTED) {
+ if(rtp_confs.rtp_state_cur == RTP_STATE_VOIP_PROCESS) {
+ rtp_confs.rtp_state_pre = rtp_confs.rtp_state_cur;
+ rtp_confs.rtp_state_cur = RTP_STATE_ENABLE;
+ rtp_main_thread_cond();
+ } else if(rtp_confs.rtp_state_cur == RTP_STATE_DISABLE) { // 通话过程中 Disable,挂断后需要单独处理
+ rtp_confs.rtp_state_pre = RTP_STATE_VOIP_PROCESS;
+ rtp_confs.rtp_state_cur = RTP_STATE_DISABLE;
+ rtp_main_thread_cond();
+ }
+ } else if(state->call_wait == MBTK_CLCC && state->state == 0) {
+ if(rtp_confs.rtp_state_cur == RTP_STATE_ENABLE) {
+ rtp_confs.rtp_state_pre = rtp_confs.rtp_state_cur;
+ rtp_confs.rtp_state_cur = RTP_STATE_VOIP_PROCESS;
+ rtp_main_thread_cond();
+ }
+ }
+ }
+#if 0
+ mbtk_call_info_t *reg = (mbtk_call_info_t *)data;
+ switch (reg->call_wait)
+ {
+ case MBTK_CLCC:
+ printf("\r\nRING : %d, %d, %d, %d, %d, %s, %d\r\n", reg->dir1, reg->dir, reg->state, reg->mode, reg->mpty, reg->phone_number, reg->type);
+ break;
+ case MBTK_DISCONNECTED:
+ printf("\r\nRING : call dis connected!\r\n");
+ break;
+ case MBTK_CPAS:
+ printf("\r\nCALL : Call state = %d\r\n", reg->pas);
+ /*
+ MBTK_CALL_RADY, //MT allows commands from TA/TE
+ MBTK_CALL_UNAVAILABLE, //MT does not allow commands from TA/TE
+ MBTK_CALL_UNKNOWN, //MT is not guaranteed to respond to instructions
+ MBTK_CALL_RINGING, //MT is ready for commands from TA/TE, but the ringer is active
+ MBTK_CALL_PROGRESS, //MT is ready for commands from TA/TE, but a call is in progress
+ MBTK_CALL_ASLEEP, //MT is unable to process commands from TA/TE because it is in a low functionality state
+ MBTK_CALL_ACTIVE,
+ */
+ switch (reg->pas)
+ {
+ case MBTK_CALL_RADY:
+ printf("CALL: call READY\r\n");
+ break;
+ case MBTK_CALL_UNAVAILABLE:
+ printf("CALL: call unavaliable\r\n");
+ break;
+ case MBTK_CALL_UNKNOWN:
+ printf("CALL: call unknown\r\n");
+ break;
+ case MBTK_CALL_RINGING:
+ printf("CALL: call ringing\r\n");
+ break;
+ case MBTK_CALL_PROGRESS:
+ printf("CALL: call progress\r\n");
+ break;
+ case MBTK_CALL_ASLEEP:
+ printf("CALL: call asleep\r\n");
+ break;
+ case MBTK_CALL_ACTIVE:
+ printf("CALL: call active\r\n");
+ break;
+ default:
+ printf("\r\n");
+ break;
+ }
+ break;
+ default:
+ printf("\r\nRING : None call_wait = %d\r\n", reg->call_wait);
+ break;
+ }
+#endif
+}
+
+static int ril_ser_switch(bool open)
+{
+ if(open) {
+ if(rtp_info.ril_handle) {
+ LOGW("RIL has opened.");
+ return 0;
+ }
+ rtp_info.ril_handle = mbtk_info_handle_get();
+ if(rtp_info.ril_handle == NULL) {
+ LOGE("mbtk_info_handle_get() fail.");
+ return -1;
+ }
+
+ mbtk_call_state_change_cb_reg(rtp_info.ril_handle, call_state_change_cb);
+ } else {
+ if(!rtp_info.ril_handle) {
+ LOGW("RIL not open.");
+ return 0;
+ }
+
+ if(mbtk_info_handle_free(&rtp_info.ril_handle)) {
+ LOGE("mbtk_info_handle_free() fail.");
+ return -1;
+ }
+
+ rtp_info.ril_handle = NULL;
+ }
+ return 0;
+}
+
+#endif
+
static int rtp_start(rtp_state_enum state_pre, rtp_state_enum state_cur)
{
LOGD("RTP start, state : %d -> %d", state_pre, state_cur);