msg_error_t MsgSoundPlayUninit() { MSG_BEGIN(); int err = MM_ERROR_NONE; /* Uninitializing the player module */ err = mm_player_unrealize(hPlayerHandle); /* Destroying the player handle */ err = mm_player_destroy(hPlayerHandle); pthread_mutex_lock(&muMmPlay); bPlaying = false; pthread_mutex_unlock(&muMmPlay); pthread_cond_signal(&cvMmPlay); hPlayerHandle = 0; MSG_END(); return MSG_SUCCESS; }
msg_error_t MsgSettingHandleNewMsg(int SmsCnt, int MmsCnt) { MSG_BEGIN(); MSG_DEBUG("smsCnt = %d, mmsCnt = %d ##", SmsCnt, MmsCnt); // Set Msg Count into VConf if (MsgSettingSetIndicator(SmsCnt, MmsCnt) != MSG_SUCCESS) { MSG_DEBUG("MsgSettingSetIndicator() FAILED"); return MSG_ERR_SET_SETTING; } if (SmsCnt == 0 && MmsCnt == 0) { MSG_DEBUG("No New Message."); } else { MSG_DEBUG("New Message."); pm_change_state(LCD_NORMAL); } MSG_END(); return MSG_SUCCESS; }
void MsgSoundPlayVibration() { MSG_BEGIN(); int ret = 0; int vibLevel = 0; char ivtFilePath[MAX_SOUND_FILE_LEN] = {0,}; vibLevel = MsgSettingGetInt(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT); if (vibLevel > 0) { bVibrating = true; dev_handle = device_haptic_open(DEV_IDX_0, 0); g_timeout_add(MSG_VIBRATION_INTERVAL , MsgSoundVibTimeout, NULL); /* set timer to stop vibration, then play melody */ svi_get_path(SVI_TYPE_VIB, SVI_VIB_NOTIFICATION_MESSAGE, ivtFilePath, sizeof(ivtFilePath)); ret = device_haptic_play_file(dev_handle, ivtFilePath, HAPTIC_TEST_ITERATION, vibLevel); if (ret != 0) { MSG_DEBUG("Fail to play haptic : [%d]", ret); } } MSG_END(); }
void MsgSoundPlayStart() { MSG_BEGIN(); pthread_mutex_lock(&muMmPlay); if (bPlaying == true) { MSG_DEBUG("Ringtone is Playing..."); pthread_mutex_unlock(&muMmPlay); return; } pthread_mutex_unlock(&muMmPlay); pthread_t tid; if (pthread_create(&tid, NULL, &MsgPlayThread, (void*)NULL) == 0) { MSG_DEBUG("Ring alert thread created = %d", tid); } else { MSG_DEBUG("Creating Thread was failed"); return; } MSG_END(); }
msg_error_t MmsPluginStorage::addMmsMsgToDB(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, int attachCnt) { MSG_BEGIN(); char sqlQuery[MAX_QUERY_LEN + 1]; // Add Message memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d, %d, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);", MMS_PLUGIN_MESSAGE_TABLE_NAME, pMmsMsg->msgID, pMmsMsg->szTrID, pMmsMsg->szMsgID, pMmsMsg->szForwardMsgID, pMmsMsg->szContentLocation, pMsgInfo->msgData, pMmsMsg->mmsAttrib.version, pMmsMsg->mmsAttrib.dataType, pMmsMsg->mmsAttrib.date, pMmsMsg->mmsAttrib.bHideAddress, pMmsMsg->mmsAttrib.bAskDeliveryReport, pMmsMsg->mmsAttrib.bReportAllowed, pMmsMsg->mmsAttrib.readReportAllowedType, pMmsMsg->mmsAttrib.bAskReadReply, pMmsMsg->mmsAttrib.bRead, pMmsMsg->mmsAttrib.readReportSendStatus, pMmsMsg->mmsAttrib.bReadReportSent, pMmsMsg->mmsAttrib.priority, pMmsMsg->mmsAttrib.bLeaveCopy, pMmsMsg->mmsAttrib.msgSize, pMmsMsg->mmsAttrib.msgClass, pMmsMsg->mmsAttrib.expiryTime.time, pMmsMsg->mmsAttrib.bUseDeliveryCustomTime, pMmsMsg->mmsAttrib.deliveryTime.time, pMmsMsg->mmsAttrib.msgStatus); MSG_DEBUG("\n!!!!!!!!! QUERY : %s\n", sqlQuery); if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; if (updateMmsAttachCount(pMmsMsg->msgID, attachCnt) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; MSG_END(); return MSG_SUCCESS; }
static gboolean MsgSoundVibTimeout(gpointer data) { MSG_BEGIN(); int ret = 0; if (bVibrating == true) { ret = device_haptic_stop_play(dev_handle); if (ret != 0) { MSG_DEBUG("Fail to stop haptic : [%d]", ret); } ret = device_haptic_close(dev_handle); if (ret != 0) { MSG_DEBUG("Fail to close haptic : [%d]", ret); } bVibrating = false; } if(!bPlaying && !bVibrating) worker_done(); MSG_END(); return FALSE; }
msg_error_t MmsUpdateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData) { MSG_BEGIN(); msg_error_t err = MSG_SUCCESS; try { if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND) { err = MmsPluginStorage::instance()->updateMessage(pMsgInfo, pSendOptInfo, pFileData); } else { //[Update Message ID & File path only in case of retrieve. Else update Message ID] if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { err = MmsPluginStorage::instance()->updateConfMessage(pMsgInfo); } else { err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); } } } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } catch (exception& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } MSG_END(); return err; }
void MsgProxyListener::stop() { MSG_BEGIN(); if (running > 1) { running--; MSG_DEBUG("There are still running Listener. [%d] left.", running); } else if (running == 1) { MutexLocker lock(mx); running--; g_io_channel_unref(channel); // decrements ref_count = 1 g_source_remove(eventSourceId); cliSock.close(); MSG_DEBUG("client Listener is terminated."); } MSG_END(); }
void MsgSoundPlayStop() { MSG_BEGIN(); pthread_mutex_lock(&muMmPlay); if (bPlaying == false) { MSG_DEBUG("Ringtone is Not Playing..."); pthread_mutex_unlock(&muMmPlay); return; } pthread_mutex_unlock(&muMmPlay); /* Stop playing media contents */ MSG_DEBUG("Before mm_player_stop, %p", hPlayerHandle); int err = mm_player_stop(hPlayerHandle); MSG_DEBUG("After mm_player_stop"); if (err != MM_ERROR_NONE) { MSG_DEBUG("stopping the player handle failed"); } MsgSoundPlayUninit(); MSG_END(); }
gboolean readSocket(GIOChannel *source, GIOCondition condition, gpointer data) { MSG_BEGIN(); if (G_IO_ERR & condition) { MSG_DEBUG("IO Error!!! [%d]", condition); MsgProxyListener::instance()->stop(); return FALSE; } if (G_IO_HUP & condition) { MSG_DEBUG("socket fd Error!!! [%d]", condition); MsgProxyListener::instance()->stop(); return FALSE; } if (G_IO_NVAL & condition) { MSG_DEBUG("Invaild socket Error!!! [%d]", condition); MsgProxyListener::instance()->stop(); return FALSE; } char* buf = NULL; int len; int n = MsgProxyListener::instance()->readFromSocket(&buf, &len); if (n > 0) { MSG_DEBUG(">>Receiving %d bytes", n); MsgProxyListener::instance()->handleEvent((MSG_EVENT_S*)buf); } else if (n == 0) { MSG_DEBUG("Server closed connection"); MsgProxyListener::instance()->stop(); return FALSE; } else // dataSize < 0 { MSG_DEBUG("Data is not for Listener"); } if (buf) { delete [] buf; buf = NULL; } MSG_END(); return TRUE; }
msg_error_t MmsFinalize() { MSG_BEGIN(); MSG_END(); return MSG_SUCCESS; }
static void setup_read(msg_t *msg) { CEX_finalize_write_msg(msg); int len = CEX_msg_tell(msg); MSG_PTR(msg) = MSG_START(msg); MSG_END(msg) = MSG_PTR(msg) + len; MSG_MODE(msg) = MSG_R; }
msg_error_t SmsPlgRegisterListener(MSG_PLUGIN_LISTENER_S *pListener) { MSG_BEGIN(); SmsPluginEventHandler::instance()->registerListener(pListener); MSG_END(); return MSG_SUCCESS; }
void SmsPluginSetting::getParamList(MSG_SMSC_LIST_S *pSMSCList) { MSG_BEGIN(); int paramCnt = 0; paramCnt = getParamCount(); MSG_DEBUG("Parameter Count [%d]", paramCnt); int ret = TAPI_API_SUCCESS; int reqId = 0; MSG_SMSC_DATA_S tmpSmscData = {}; for (int index = 0; index < paramCnt; index++) { ret = tel_get_sms_parameters(pTapiHandle, index, TapiEventGetParam, NULL); if (ret == TAPI_API_SUCCESS) { MSG_DEBUG("######## tel_get_sms_parameters() Success !!! #######"); } else { THROW(MsgException::SMS_PLG_ERROR, "######## tel_get_sms_parameters() Fail !!! return : %d #######", ret); } if (getParamEvent(&tmpSmscData) == true) { MSG_DEBUG("######## Get Parameter was Successful !!! #######"); } else { THROW(MsgException::SMS_PLG_ERROR, "######## Get Parameter was Failed !!! #######"); } memcpy(&(pSMSCList->smscData[index]), &tmpSmscData, sizeof(MSG_SMSC_DATA_S)); MSG_DEBUG("pid[%d]", pSMSCList->smscData[index].pid); MSG_DEBUG("val_period[%d]", pSMSCList->smscData[index].valPeriod); MSG_DEBUG("name[%s]", pSMSCList->smscData[index].name); MSG_DEBUG("ton[%d]", pSMSCList->smscData[index].smscAddr.ton); MSG_DEBUG("npi[%d]", pSMSCList->smscData[index].smscAddr.npi); MSG_DEBUG("address[%s]", pSMSCList->smscData[index].smscAddr.address); } pSMSCList->totalCnt = paramCnt; pSMSCList->selected = selectedParam; MSG_DEBUG("total_count[%d]", pSMSCList->totalCnt); MSG_END(); }
msg_error_t MmsInitialize() { MSG_BEGIN(); // remove temp files MsgMmsInitDir(); MSG_END(); return MSG_SUCCESS; }
static gboolean MsgSoundMelodyTimeout(gpointer data) { MSG_BEGIN(); MsgSoundPlayStop(); if(!bPlaying && !bVibrating) worker_done(); MSG_END(); return FALSE; }
msg_error_t MmsPlgDestroyHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle) { MSG_BEGIN(); if (pPluginHandle != NULL) { free(pPluginHandle); pPluginHandle = NULL; } MSG_END(); return MSG_SUCCESS; }
msg_error_t SmsPlgFinalize() { MSG_BEGIN(); if (!pTapiHandle) return MSG_ERR_PLUGIN_TAPIINIT; SmsPluginCallback::instance()->deRegisterEvent(); tel_deinit(pTapiHandle); MSG_END(); return MSG_SUCCESS; }
void sml_debug(const char *format, ...) { va_list args; FILE *out; if (verbose_level < MSG_DEBUG) return; va_start(args, format); out = MSG_START(MSG_DEBUG); vfprintf(out, format, args); MSG_END(out, MSG_DEBUG); va_end(args); }
msg_error_t MmsComposeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo) { MSG_BEGIN(); try { MmsPluginStorage::instance()->composeReadReport(pMsgInfo); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } catch (exception& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } MSG_END(); return MSG_SUCCESS; }
msg_error_t MmsSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo) { MSG_BEGIN(); try { MmsPluginTransport::instance()->submitRequest(pReqInfo); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_TRANSPORT; } catch (exception& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_TRANSPORT; } MSG_END(); return MSG_SUCCESS; }
msg_error_t MmsAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData) { MSG_BEGIN(); try { MmsPluginStorage::instance()->addMessage(pMsgInfo, pSendOptInfo, pFileData); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_TRANSPORT; } catch (exception& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_TRANSPORT; } MSG_END(); return MSG_SUCCESS; }
static gboolean InitThreadFunc(void* pData) { MSG_BEGIN(); pthread_t initThreadId; // initialize msg fw if (pthread_create(&initThreadId, NULL, InitMsgServer, NULL) != 0) { MSG_DEBUG("InitMsgFw not invoked: %s", strerror(errno)); return -1; } pthread_detach(initThreadId); MSG_END(); return FALSE; }
msg_error_t SmsPlgInitialize() { MSG_BEGIN(); MSG_DEBUG("set MSG_SIM_CHANGED to MSG_SIM_STATUS_NOT_FOUND."); MsgSettingSetInt(MSG_SIM_CHANGED, MSG_SIM_STATUS_NOT_FOUND); bool bReady; MsgSettingGetBool(VCONFKEY_TELEPHONY_READY, &bReady); MSG_DEBUG("Get VCONFKEY_TELEPHONY_READY [%d].", bReady); int ret = 0; if(!bReady) { MsgSettingRegVconfCBCommon(VCONFKEY_TELEPHONY_READY, MsgTapiInitCB); mx.lock(); ret = cv.timedwait(mx.pMutex(), 90); mx.unlock(); } try { if (ret != ETIMEDOUT) { pTapiHandle = tel_init(NULL); SmsPluginCallback::instance()->registerEvent(); } } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_REGEVENT; } catch (exception& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_REGEVENT; } MSG_END(); return MSG_SUCCESS; }
msg_error_t MmsProcessReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest, bool *bReject) { MSG_BEGIN(); MSG_DEBUG("MMS Plugin ProcessReceivedInd"); try { MmsPluginInternal::instance()->processReceivedInd(pMsgInfo, pRequest, bReject); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_TRANSPORT; } catch (exception& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_TRANSPORT; } MSG_END(); return MSG_SUCCESS; }
static void print_error(enum sml_msg_level level, int err, const char *format, va_list args) { FILE *out; if (verbose_level < level) return; if (err != 0) { print_syserror(level, err, format, args); return; } out = MSG_START(level); vfprintf(out, format, args); fputs("\n", out); fflush(out); MSG_END(out, level); }
msg_error_t MmsGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg) { MSG_BEGIN(); msg_error_t err = MSG_SUCCESS; try { err = MmsPluginStorage::instance()->plgGetMmsMessage(pMsg, pSendOptInfo, pMmsMsg, pDestMsg); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } catch (exception& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } MSG_END(); return err; }
static void print_syserror(enum sml_msg_level level, int err, const char *format, va_list args) { FILE *out; if (verbose_level < level) return; out = MSG_START(level); vfprintf(out, format, args); if (err > 0) fprintf(out, "%s\n", strerror(err)); else if (err == 0) fprintf(out, ": Success\n"); else fprintf(out, ": Failed (%d)\n", err); fflush(out); MSG_END(out, level); }
msg_error_t MmsUpdateRejectStatus(MSG_MESSAGE_INFO_S *pMsgInfo) { MSG_BEGIN(); msg_error_t err = MSG_SUCCESS; try { char szTrID[MMS_TR_ID_LEN + 1] = {0x00}; bool bReportAllowed; err = MmsPluginStorage::instance()->getTrID(pMsgInfo,szTrID,sizeof(szTrID)); if (err != MSG_SUCCESS) MSG_DEBUG("MmsPlgUpdRejectStatus : Get MMS Transacation id Failed"); memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1); MsgSettingGetBool(MMS_SEND_REPORT_ALLOWED, &bReportAllowed); if (MmsPluginInternal::instance()->encodeNotifyRespInd(szTrID, MSG_DELIVERY_REPORT_REJECTED, bReportAllowed, pMsgInfo->msgData)) { MSG_DEBUG("MmsPlgUpdRejectStatus : Encode Notify Response Success"); pMsgInfo->dataSize = strlen(pMsgInfo->msgData); pMsgInfo->bTextSms = true; } else MSG_DEBUG("MmsPlgSetRejectStatus : Encode Notify Response Failed"); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } catch (exception& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } if (err != MSG_SUCCESS) MSG_DEBUG("MmsPlgSetRejectStatus : Update MMS Message Failed"); MSG_END(); return err; }
msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvdBodyLen, char *filePath) { MSG_BEGIN(); if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) { FILE *pFile; _MmsInitHeader(); _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX); if ((pFile = MsgOpenFile(pMsgInfo->msgData, "rb+")) == NULL) { MSG_DEBUG("File Open Error: %s", pMsgInfo->msgData); } else { //Decode Header if (!MmsBinaryDecodeMsgHeader(pFile, rcvdBodyLen)) MSG_DEBUG("Decoding Header Failed \r\n"); MsgCloseFile(pFile); } } else { MSG_DEBUG(":::%d :%s ",rcvdBodyLen, pRcvBody); if (filePath) { snprintf(filePath, MAX_FULL_PATH_SIZE, MSG_DATA_PATH"BODY_%lu.DATA", random() % 1000000000 + 1); } else { return MSG_ERR_NULL_POINTER; } // create temp file if (!MsgOpenCreateAndOverwriteFile(filePath, (char*)pRcvBody,rcvdBodyLen)) return MSG_ERR_PLUGIN_STORAGE; } MSG_END(); return MSG_SUCCESS; }