Beispiel #1
0
/*! \brief Set the message properties view.
 *
 * \param propItem The current message properties.
 *****************************************************************************/
MSF_BOOL meaSetMvProperties(const MeaPropItem *propItem)
{
#ifdef WAP_SUPPORT
    return TRUE;
#else
    char *str;
    if ((NULL != propItem) && (0 != meaMvPropView.formHandle))
    {
        str = meaAddrItemToStr(propItem->to);
        if (!meaSetStringGadgetValue(meaMvPropView.fromHandle, 0, str))
        {
            MEA_FREE(str);
            return FALSE;
        }
        MEA_FREE(str);
        str = meaAddrItemToStr(propItem->cc);
        if (!meaSetStringGadgetValue(meaMvPropView.ccHandle, 0, str))
        {
            MEA_FREE(str);
            return FALSE;
        }
        MEA_FREE(str);
        if (!meaSetStringGadgetValue(meaMvPropView.subjectHandle,
                                     0, propItem->subject))
        {
            return FALSE;
        }
        return TRUE;
    }
    return FALSE;
#endif /* WAP_SUPPORT */
}
Beispiel #2
0
/*!
 * \brief Creates the GUI for the message status dialog.
 *
 * \param propItem The current message properties.
 * \param
 * \return TRUE if the operation was successful, otherwise FALSE.
 *****************************************************************************/
MSF_BOOL meaCreateMvStatusView(U32 str_id, U8 ntt, U8 quota)
{
    ctk_screen_handle	scrid;
    ctk_string_id       titleid;
    kal_uint8 			*text, *str;
    int                 text_size;

    if (0 != meaMvStatusView.formHandle)
    {
        return FALSE;
    }
    memset(&meaMvStatusView, 0, sizeof(MeaMvPropView));

    text_size = 300;
    text = MEA_ALLOC(text_size);
    str = MEA_ALLOC(3);
    widget_utf8_to_ucs2_string(text, text_size, (kal_uint8*) "");
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_STATUS);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)" ");
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, str_id);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");



    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_NEXT_TRANS_TIME);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)": ");
    sprintf((S8 *)str,"%d", ntt);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)str);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)" ");
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_MINS);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_REMAIN_QUOTA);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)": ");
    sprintf((S8 *)str,"%d", quota);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)str);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Create widow */
    titleid = MEA_STR_ID_SHOW_STATUS;
    meaMvStatusView.formHandle = HDIa_widgetExtCreateTextViewSeparator(MSF_MODID_MEA, text, titleid , 0);
    MEA_FREE(text);
    MEA_FREE(str);
    meaAddWidgetList(meaMvStatusView.formHandle);

    /* Set Key */
    scrid = HDIa_widgetCtkGetScreenHandle(meaMvStatusView.formHandle);

    ctk_screen_addRSK_UA(scrid, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, NULL, meaMvStatusViewGoBack, KAL_TRUE);
    ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvStatusViewGoBack, KAL_TRUE);

    return meaDisplayWindow(meaMvStatusView.formHandle, meaGetPosLeftTop());

}
Beispiel #3
0
/*!
 * \brief Creates the GUI for the notification property dialog.  Show in App (LSK Option, RSK Back)
 *
 * \param
 * \return void
 *****************************************************************************/
void meaCreateMvNotifPropView(MmsMsgId msgId)
{
    ctk_screen_handle	scrid;
    kal_uint8 			*text;
    extern char *meaCreateNotifPropText(MmsMsgId msgId);

    if (0 != meaMvPropView.formHandle)
    {
        return;
    }
    memset(&meaMvPropView, 0, sizeof(MeaMvPropView));

    /* Create widow */
    text = (kal_uint8 *)meaCreateNotifPropText(msgId);
    meaMvPropView.formHandle = HDIa_widgetExtCreateTextViewSeparator(MSF_MODID_MEA, text, MEA_STR_ID_PROPERTIES, 0);
    MEA_FREE(text);
    meaAddWidgetList(meaMvPropView.formHandle);

    /* Set Key */
    scrid = HDIa_widgetCtkGetScreenHandle(meaMvPropView.formHandle);
    ctk_screen_addRSK_UA(scrid, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, NULL, meaMvPropViewOnlyGoBack, KAL_TRUE);
    ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvPropViewOnlyGoBack, KAL_TRUE);
    ctk_screen_addLSK_UA(scrid, MEA_STR_ID_OPTIONS, IMG_GLOBAL_OK, NULL, handleMvPropOptionAction, KAL_TRUE);

    meaDisplayWindow(meaMvPropView.formHandle, meaGetPosLeftTop());
    return;
}
Beispiel #4
0
/*lint -e{818} */
MSF_BOOL MEAc_pbLookupNameRsp(MSF_UINT16 result, MSF_UINT16 instanceId, 
    MeaPbItem *item)
{
    MeaAddrItem *cpyItem = NULL;
    MeaPbhLookupItem *tmp;
    MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, 
        MEA_ENV_240C1403614E89FC1E789D2540790D27, "(%s) (%d) MEAc_pbLookupNameRsp result = %d, instanceId = %d, "
        "addrType = %d, name = %s, addr = %s\n", __FILE__, __LINE__, result, 
        instanceId, (NULL != item) ?item->type: 0, 
        (NULL != item) ? item->name: NULL, (NULL != item) ? item->addr: NULL));
    if ((MEA_PB_LOOKUP_RESULT_OK == result) && (NULL != item))
    {
        /* Copy the item */
        if (NULL == (cpyItem = meaPbhCopyItem(item)))
        {
            /* Prevent memory leak if the entry cannot be copied cannot be 
               sent */
            if (NULL != (tmp = meaPbhGetLookupEntry(instanceId)))
            {
                /*lint -e{774} */
                MEA_FREE(tmp);
            }
            return FALSE;
        }
    }
    /* Send the response */
    (void)MEA_SIGNAL_SENDTO_UUP(MEA_PBH_FSM, MEA_SIG_PBH_LOOKUP_RSP, 
        result, instanceId, cpyItem);
    return TRUE;
}
Beispiel #5
0
/*!
 * \brief Deletes multipart/mixed viewer instance 
 *
 * \param instance The current instance.
 *****************************************************************************/
static void meaMmvDeleteInstance(MeaMmvInstance **instance)
{
    if (*instance != NULL)
    {
        MEA_FREE(*instance);
        *instance = NULL;
    }
}
Beispiel #6
0
/*!
 * \brief Cleanup of the current content routing request.
 *
 * \param result The result that is sent back to the originating fsm, if
 *               the result is MEA_CRH_TERMINATE no signal is sent back.
 *****************************************************************************/
static void crhCleanupInstance(int result)
{
    if (NULL == crhInstance)
    {
        return;
    }
    else
    {
        if (MEA_CRH_TERMINATE != result)
        {
            (void)MEA_SIGNAL_SENDTO_U(
                (MeaStateMachine)crhInstance->bodyPartToRead->fsm, 
                crhInstance->bodyPartToRead->signal, (unsigned)result);
        }
        if (crhInstance)
        {
            if (crhInstance->hPipe != -1)
            {
                (void)MSF_PIPE_CLOSE(crhInstance->hPipe);
                crhInstance->hPipe = -1;
            }
            if (NULL != crhInstance->transactionHandle)
            {
                (void)MMSlib_transactionClose(MSF_MODID_MEA, 
                    &crhInstance->transactionHandle);
                crhInstance->transactionHandle = NULL;
            }


            if (NULL != crhInstance->msgHandle)
            {
                (void)MMSlib_messageClose(MSF_MODID_MEA, &crhInstance->msgHandle);
                crhInstance->msgHandle = NULL;
            }
            MEA_FREE(crhInstance->bodyPartToRead);
            crhInstance->bodyPartToRead = NULL;
            MEA_FREE(crhInstance);
            crhInstance = NULL;
        }
        /* Delete progress meter */
        /*meaPmViewRemove();*/
    }
}
Beispiel #7
0
/*!
 * \brief Creates the GUI for the message property dialog.
 *
 * \param propItem The current message properties.
 * \param
 * \return TRUE if the operation was successful, otherwise FALSE.
 *****************************************************************************/
MSF_BOOL meaCreateMvPropView(MmsMsgId msgId, MSF_BOOL appActivated)
{
    ctk_screen_handle	scrid;
    ctk_string_id       titleid;
    kal_uint8 			*text;

    if (0 != meaMvPropView.formHandle)
    {
        return FALSE;
    }
    memset(&meaMvPropView, 0, sizeof(MeaMvPropView));

    text = (kal_uint8 *)meaCreateMsgPropText(msgId);

    /* Create widow */
    titleid = (appActivated == TRUE) ? MEA_STR_ID_VIEW_TITLE : MEA_STR_ID_PROPERTIES;
    meaMvPropView.formHandle = HDIa_widgetExtCreateTextViewSeparator(MSF_MODID_MEA, text, titleid , 0);
    MEA_FREE(text);
    meaAddWidgetList(meaMvPropView.formHandle);

    /* Set Key */
    scrid = HDIa_widgetCtkGetScreenHandle(meaMvPropView.formHandle);
    if (appActivated == TRUE)
    {
        ctk_screen_addRSK_UA(scrid, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, NULL, meaMvPropViewGoBack, KAL_TRUE);
        ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvPropViewGoBack, KAL_TRUE);
        ctk_screen_addLSK_UA(scrid, SMA_STR_ID_MENU_PLAY, IMG_GLOBAL_OK, NULL, meaMvPropViewGoNext, KAL_TRUE);
        //ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvPropViewGoNext, KAL_TRUE);
    }
    else
    {
#if defined(__UNIFIED_MSG_SUPPORT__) && !defined(__UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__)  /* For delete option */
        if (mmcIsJSRMsg(msgId))
        {
            ctk_screen_addLSK_UA(scrid, MEA_STR_ID_OPTIONS, IMG_GLOBAL_OK, NULL, handleMvPropOptionAction, KAL_TRUE);
        }
#endif
        ctk_screen_addRSK_UA(scrid, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, NULL, meaMvPropViewOnlyGoBack, KAL_TRUE);
        ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvPropViewOnlyGoBack, KAL_TRUE);
    }
    return meaDisplayWindow(meaMvPropView.formHandle, meaGetPosLeftTop());
}
Beispiel #8
0
/*! \brief
 *
 *****************************************************************************/
void MEAa_pbLookupName(MSF_UINT16 instanceId, MSF_UINT8 type, void *value)
{
    const char *name = NULL;
    MeaPbItem *item = NULL;
    MSF_UINT8 result = MEA_PB_LOOKUP_RESULT_OK;
    MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, 
        MEA_INT_48DC831AD0DE65B05A76F2F0DCF4F66F, "(%s) (%d) MEAa_pbLookupEntry instanceId = %d, type = %d, value = "
        "\"%s\"\n", __FILE__, __LINE__, instanceId, type, value));
	//PHB Jo 030813
	
    name = meaLookupNameFromPHB(value);

    if (name != NULL)
    {
        if (NULL == (item = MEA_ALLOC(sizeof(MeaPbItem))))
        {
            (void)MEAc_pbLookupNameRsp(MEA_PB_LOOKUP_RESULT_ERROR, instanceId, 
                item);
            return;
        }
        memset(item, 0, sizeof(MeaPbItem));
        /*lint -e{605} */
        item->name      = (char *)name;
        item->type      = (MeaPbAddrType)type;
        item->addr      = value;
    }
	else
	{
		result = MEA_PB_LOOKUP_RESULT_NO_HIT;
	}
    (void)MEAc_pbLookupNameRsp(result, instanceId, item);
    if (NULL != item)
    {
        /*lint -e{774} */
        MEA_FREE(item);
    }
}
Beispiel #9
0
/*!
 * \brief Save the media object
 *
 * \param instance The current instance.
 *****************************************************************************/
static void saveMo(const MeaMmvInstance *instance)
{
    MeaMoDataItem *mo = instance->currentMo;
#ifdef MMS_SLIM_MEM
    MSF_INT32             actId;
    msf_pck_result_t      result;
    char *vFileName = NULL;
    const char *mime = NULL;
    int fileHandle = 0;

    meaUiMmvDeleteMenu();   
    vFileName = MEA_ALLOC(WIDGET_RAWFILE_NAMELEN);
    ASSERT(vFileName != NULL);

    fileHandle = MSF_FILE_OPEN( MSF_MODID_SMA, mo->file->path, MSF_FILE_SET_RDONLY, 0);
    if(fileHandle < 0)
    {
        MEA_FREE(vFileName);
        fileHandle = 0;
        meaShowDialog(MEA_GET_STR_ID(SMA_STR_ID_FAILED_TO_SAVE),MEA_DIALOG_ERROR);
        return;
    }

    if(HDIa_fileGenVirtualFileName(fileHandle, vFileName, WIDGET_RAWFILE_NAMELEN, mo->file->pos, mo->file->size) != HDI_FILE_OK)
    {
        MEA_FREE(vFileName);
        MSF_FILE_CLOSE(fileHandle);
        fileHandle = 0;
        meaShowDialog(MEA_GET_STR_ID(SMA_STR_ID_FAILED_TO_SAVE),MEA_DIALOG_ERROR);
        return;
    }

    if((mime = meaFileName2MimeType(mo->name)) == NULL)
    {
        mime = MEA_UNKNOWN_MIME_STR;
    }
    meaActHandle = (msf_pck_handle_t*)msf_act_init(MSF_MODID_MEA);
    actId = msf_act_object_action_drm (meaActHandle,
                   0, 
                   mime,
                   MsfResourceFile,
                   NULL,
                   mo->size,
                   vFileName,
                   NULL,
                   mo->name,
                   0, //for drm
                   meaGetScreenHandle(),
                   NULL,
                   NULL,
                   0);

    msf_act_get_result (meaActHandle, actId, &result);
    msf_act_result_free (meaActHandle, &result);
    meaActTerminate();
    MEA_FREE(vFileName);
    MSF_FILE_CLOSE(fileHandle);
#else
    (void)meaCreateSaveAs(MEA_MMV_FSM, MEA_SIG_MMV_SAVE_DONE, 
        meaMediaType2Mime(mo->content.type) , mo->name, (char*)mo->data, (long)mo->size);
#endif /* MMS_SLIM_MEM */
}
Beispiel #10
0
/*!
* \brief Creates the GUI for read or delivery reports.
*
* \param titleStrId The form title.
* \param from The from address.
* \param subject The subject.
* \param statusStrId The status of the message.
* \param date The date of the message
* \return TRUE if successful, otherwise FALSE.
*****************************************************************************/
MSF_BOOL meaCreateMvRrDrView(MSF_UINT32 titleStrId, const char *from, const char *subject,
                             MSF_UINT32 statusStrId, MmsTimeSec rDate)
{
    ctk_screen_handle	scrid;
    kal_uint8 			*text;
    int					text_size;
    MYTIME time;
    MSF_UINT16* dateOrTimeString;
    MeaAddrType addrType;
    char *name = NULL;

    if (0 != meaMvRrDrView.formHandle)
    {
        /* Delete the GUI so that all resources are de-allocated */
        meaDeleteMvRrDrView();
    }
    memset(&meaMvRrDrView, 0, sizeof(meaMvRrDrView));

    /* Prepare text */
    text_size = 150; /* The default size. widget_ucs2str_append_* will realloc the buffer on necessary */
    text = MEA_ALLOC(text_size);
    widget_utf8_to_ucs2_string(text, text_size, (kal_uint8*) "");

    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, (MSF_UINT16)titleStrId);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n\n");

    /* To */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_TO);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)":\n");

    if (MEA_ADDR_TYPE_PLMN == (addrType = meaGetAddrType(from)))
    {
        name = meaLookupNameFromPHB((char *)from);
        text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)name);
    }
    else
    {
        text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)from);
    }

    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Subject */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_SUBJECT);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)":\n");
    if (subject)
    {
        text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)subject);
    }
    else
    {
        text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_NO_SUBJECT);
    }
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Date */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_DATE);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n");
    dateOrTimeString = MEA_ALLOC(MEA_MAX_DATE_SIZE);
    rDate += (HDIa_timeGetTimeZone() * 60);
    mmi_dt_utc_sec_2_mytime((kal_int32)rDate, &time, KAL_TRUE);
    date_string(&time, dateOrTimeString, DT_IDLE_SCREEN);
    text = widget_ucs2str_append_ucs2(MSF_MODID_MEA, text, &text_size, (kal_uint8 *)dateOrTimeString);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n");
    time_string(&time, dateOrTimeString, DT_IDLE_SCREEN);
    text = widget_ucs2str_append_ucs2(MSF_MODID_MEA, text, &text_size, (kal_uint8 *)dateOrTimeString);
    MEA_FREE(dateOrTimeString);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Status */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_STATUS);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n");
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, (MSF_UINT16)statusStrId);

    /* Create widow */
    meaMvRrDrView.formHandle = HDIa_widgetExtCreateTextViewSeparator(MSF_MODID_MEA, text,
                               (MSF_UINT16)titleStrId, 0);

    MEA_FREE(text);
    meaAddWidgetList(meaMvRrDrView.formHandle);

    /* Set Key */
    scrid = HDIa_widgetCtkGetScreenHandle(meaMvRrDrView.formHandle);

#ifdef __UNIFIED_MSG_SUPPORT__
    ctk_screen_addRSK_UA(scrid, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, NULL, meaMvDrViewOk, KAL_TRUE);
    ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvDrViewOk, KAL_TRUE);
    ctk_screen_addLSK_UA(scrid, MEA_STR_ID_OPTIONS, IMG_GLOBAL_OK, NULL, handleMvPropOptionAction, KAL_TRUE);
#else
    ctk_screen_addLSK_UA(scrid, STR_GLOBAL_OK, IMG_GLOBAL_OK, NULL, meaMvDrViewOk, KAL_TRUE);
    //ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvPropViewOnlyGoBack, KAL_TRUE);
#endif

    return meaDisplayWindow(meaMvRrDrView.formHandle, meaGetPosLeftTop());
}
Beispiel #11
0
/*!
 *  \brief Deletes the current input form.
 *
 *  \param winHandle The window handle of the instance to delete or 0 to delete
 *                  all instances.
 *  \param action Tells the reason why the function was called. See
 *                #MeaInputFormAction for possible values.
 *****************************************************************************/
static void deleteInputForm(MsfWindowHandle winHandle, 
    MeaInputFormAction action)
{
    MeaInputForm *currItem;
    int i;
    void *ptr = NULL;
    unsigned int value = 0;
    MeaInputActionBackCallBack callback;

    /*lint -e{611} */
    callback = (MeaInputActionBackCallBack)NULL;

    if (0 != winHandle)
    {
        if (0 != (currItem = getInstance(winHandle)))
        {
            /*  Save values before we deallocates the instance in case 
             *  we need them later */
            callback = currItem->item.backCallback;
            value = currItem->item.uintValue;
            ptr = currItem->item.dataPtr;

            /* Remove the gadget if it has been created */
            if (0 != currItem->gadgetHandle)
            {
                (void)MSF_WIDGET_RELEASE(currItem->gadgetHandle);
            }
            /* Remove the window and its actions */
            (void)meaDeleteWindow(currItem->winHandle);
            /* Delete the instance */
            /*lint -e{774}*/
            MEA_FREE(currItem);
            for(i = 0; i < MEA_MAX_INPUT_FORMS; i++)
            {
                if (currItem == meaInputForm[i])
                {
                    meaInputForm[i] = NULL;
                    break;
                }
            }
        }
    }
    else
    {
        /* Delete all instances */
        for (i = 0; i < MEA_MAX_INPUT_FORMS; i++)
        {
            if (NULL != meaInputForm[i])
            {
                if (0 != meaInputForm[i]->gadgetHandle)
                {
                    (void)MSF_WIDGET_RELEASE(meaInputForm[i]->gadgetHandle);
                }
                /* Remove the window and its actions */
                (void)meaDeleteWindow(meaInputForm[i]->winHandle);
                MEA_FREE(meaInputForm[i]);
                meaInputForm[i] = NULL;
            }
        }
    }
    /* The window is closed, tell the user about it */
    if ((NULL != callback) && (MEA_INPUT_FORM_CANCEL == action))
    {
        /* Call callback, preserve original data parameters */
        callback(ptr, value);
    }
}
Beispiel #12
0
static void crhMain(MeaSignal *sig)
{
    if (NULL == sig)
    {
        meaPanic(TRUE);
        return;
    }
    if ((sig->type != MEA_SIG_CRH_START) && (NULL == crhInstance))
    {
        MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA,
            MACRH_40161465EE234C2892643D1BC846B15A, "(%s) (%d) No instance!\n", __FILE__, __LINE__));
        return;
    }
    switch (sig->type)
    {
    case MEA_SIG_CRH_START:
        if (!crhCreateInstance())
        {
            MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA,
                MACRH_416E055D9FBD63FD20D07D4FB5143070, "(%s) (%d) failed to create instance\n", __FILE__, __LINE__));
            /* Delete signal data */
            MEA_FREE(sig->p_param);
            sig->p_param = NULL;
        }
        /* Init state */
        crhInstance->state = MEA_CRH_STATE_INIT;
        /* Copy signal data */
        crhInstance->bodyPartToRead = (MeaCrhBodyPart *)sig->p_param;
        sig->p_param = NULL;
        crhInitContentRouting(crhInstance->bodyPartToRead->fileName);
        break;
    case MEA_SIG_CRH_FILE_NOTIFY:
        switch (crhInstance->state)
        {
        case MEA_CRH_STATE_INIT:
            /* The previous get header was delayed, try again */
            if (crhGetHeader())
            {
                (void)MEA_SIGNAL_SENDTO(MEA_CRH_FSM, 
                    MEA_SIG_CRH_READ_BODYPART);
                crhInstance->state = MEA_CRH_STATE_PROCESS;
            }
            break;
        case MEA_CRH_STATE_PROCESS:
            /* The previous get body-part was delayed, try again */
            crhReadBodyPart(crhInstance);
            break;
        }
        break;
    case MEA_SIG_CRH_READ_BODYPART:
        /* Read body-part */
        crhReadBodyPart(crhInstance);
        break;
    case MEA_SIG_CRH_CANCEL:
        /* Cleanup if the operation was cancelled */
        crhCleanupInstance(MEA_CRH_VIEW_ATTACH_OK);
        break;
    case MEA_SIG_CRH_NOTIFY:
        /* */
        crhPipeNotify((MSF_INT32)sig->u_param1, (MSF_INT16)sig->i_param);
        break;
    case MEA_SIG_CRH_SEND_RSP:
        /* Check wheter the content can be handled */
        if (MSF_CONTENT_STATUS_FAILED == sig->u_param1)
        {
            /* End content routing */
            crhCleanupInstance(MEA_CRH_VIEW_ATTACH_NO_HANDLER);
        }
        else
        {
            /* Open message */ 
            if (MMS_RESULT_OK != MMSlib_messageOpen(MSF_MODID_MEA, 
                crhInstance->bodyPartToRead->mmsMsgId, 
                crhInstance->bodyPartToRead->fileType , &crhInstance->msgHandle))
            {
                crhCleanupInstance(MEA_CRH_VIEW_ATTACH_ERROR);
                break;
            }
            /* Open transaction */
            if (MMS_RESULT_OK != MMSlib_transactionOpen(MSF_MODID_MEA, 
                &(crhInstance->transactionHandle)))
            {
                crhCleanupInstance(MEA_CRH_VIEW_ATTACH_ERROR);
                break;
            }

            /* Show progress meter */
            /*(void)meaPmViewShow(MEA_STR_ID_SHOW_ATTACH_PROGRESS, FALSE,
                TRUE, MEA_CRH_FSM, MEA_SIG_CRH_CANCEL);*/
            /* Get header */
            if (crhGetHeader())
            {
                /* If the header was successfully retrieved start to read
                   the requested bodypart */
                (void)MEA_SIGNAL_SENDTO(MEA_CRH_FSM, MEA_SIG_CRH_READ_BODYPART);
                crhInstance->state = MEA_CRH_STATE_PROCESS;
            }
        }
        break;
    default:
        MSF_LOG_MSG_OFF((MSF_LOG_DETAIL_HIGH, MSF_MODID_MEA, 
            MACRH_39E08AA63293875A5025796ECF3C5CBA, "(%s) (%d) unhandled signal\n", __FILE__, __LINE__));
        break;            
    }
    /* Deallocate the signal */
    meaSignalDelete(sig);
}