javanotify_midp_jsr.c

来自「This is a resource based on j2me embedde」· C语言 代码 · 共 1,294 行 · 第 1/3 页

C
1,294
字号
void javanotify_chapi_platform_finish(        int invoc_id,        javacall_utf16_string url,        int argsLen, javacall_utf16_string* args,        int dataLen, void* data,        javacall_chapi_invocation_status status) {    midp_jc_event_union e;    javacall_chapi_invocation *inv;    int i;    REPORT_INFO(LC_CORE, "javanotify_chapi_platform_finish() >>\n");    e.eventType = JSR211_JC_EVENT_PLATFORM_FINISH;    e.data.jsr211PlatformEvent.invoc_id    = invoc_id;    e.data.jsr211PlatformEvent.jsr211event =        javacall_malloc (sizeof(*e.data.jsr211PlatformEvent.jsr211event));    if (NULL != e.data.jsr211PlatformEvent.jsr211event) {        e.data.jsr211PlatformEvent.jsr211event->status     = status;        e.data.jsr211PlatformEvent.jsr211event->handler_id = NULL;        inv = &e.data.jsr211PlatformEvent.jsr211event->invocation;        inv->url               = javautil_wcsdup (url);        inv->type              = NULL;        inv->action            = NULL;        inv->invokingAppName   = NULL;        inv->invokingAuthority = NULL;        inv->username          = NULL;        inv->password          = NULL;        inv->argsLen           = argsLen;        inv->args              =            javacall_calloc (sizeof(javacall_utf16_string), inv->argsLen);        if (NULL != inv->args) {            for (i = 0; i < inv->argsLen; i++) {                inv->args[i] = javautil_wcsdup(args[i]);            }        }        inv->dataLen           = dataLen;        inv->data              = javacall_malloc (inv->dataLen);        if (NULL != inv->data) {            memcpy (inv->data, data, inv->dataLen);        }        inv->responseRequired  = 0;    }    midp_jc_event_send(&e);}/** * Receives invocation request from platform. <BR> * This is <code>Registry.invoke()</code> substitute for Platform->Java call. * @param handler_id target Java handler Id * @param invocation filled out structure with invocation params * @param invoc_id invocation Id for further references */void javanotify_chapi_java_invoke(        const javacall_utf16_string handler_id,        javacall_chapi_invocation* invocation,        int invoc_id) {    midp_jc_event_union e;    javacall_chapi_invocation *inv;    int i;    REPORT_INFO(LC_CORE, "javanotify_chapi_java_invoke() >>\n");    e.eventType = JSR211_JC_EVENT_JAVA_INVOKE;    e.data.jsr211PlatformEvent.invoc_id    = invoc_id;    e.data.jsr211PlatformEvent.jsr211event =        javacall_malloc (sizeof(*e.data.jsr211PlatformEvent.jsr211event));    if (NULL != e.data.jsr211PlatformEvent.jsr211event) {        e.data.jsr211PlatformEvent.jsr211event->handler_id =            javautil_wcsdup(handler_id);        e.data.jsr211PlatformEvent.jsr211event->status     =            INVOCATION_STATUS_ERROR;        inv = &e.data.jsr211PlatformEvent.jsr211event->invocation;        inv->url             = javautil_wcsdup(invocation->url);        inv->type            = javautil_wcsdup(invocation->type);        inv->action          = javautil_wcsdup(invocation->action);        inv->invokingAppName =            javautil_wcsdup(invocation->invokingAppName);        inv->invokingAuthority =            javautil_wcsdup(invocation->invokingAuthority);        inv->username        = javautil_wcsdup(invocation->username);        inv->password        = javautil_wcsdup(invocation->password);        inv->argsLen         = invocation->argsLen;        inv->args            =            javacall_calloc (sizeof(javacall_utf16_string), inv->argsLen);        if (NULL != inv->args) {            for (i = 0; i < inv->argsLen; i++) {                inv->args[i] = javautil_wcsdup(invocation->args[i]);            }        }        inv->dataLen           = invocation->dataLen;        inv->data              = javacall_malloc (inv->dataLen);        if (NULL != inv->data) {            memcpy (inv->data, invocation->data, inv->dataLen);        }        inv->responseRequired  = invocation->responseRequired;    }    midp_jc_event_send(&e);}#endif /* ENABLE_JSR_211 */#ifdef ENABLE_JSR_290voidjavanotify_fluid_image_notify_dirty (    javacall_handle                       fluid_image    ) {    midp_jc_event_union e;    e.eventType = JSR290_JC_EVENT_FLUID_INVALIDATE;    e.data.jsr290FluidEvent.fluid_image = fluid_image;    e.data.jsr290FluidEvent.result      = 0;    midp_jc_event_send(&e);}voidjavanotify_fluid_listener_completed (    javacall_handle                       fluid_image    ) {    midp_jc_event_union e;    e.eventType = JSR290_JC_EVENT_FLUID_LISTENER_COMPLETED;    e.data.jsr290FluidEvent.fluid_image = fluid_image;    midp_jc_event_send(&e);}    voidjavanotify_fluid_listener_failed (    javacall_handle                       fluid_image,    javacall_const_utf16_string           failure    ) {    midp_jc_event_union e;    e.eventType = JSR290_JC_EVENT_FLUID_LISTENER_FAILED;    e.data.jsr290FluidEvent.fluid_image = fluid_image;    e.data.jsr290FluidEvent.text = javautil_wcsdup(failure);    midp_jc_event_send(&e);}voidjavanotify_fluid_listener_percentage (    javacall_handle                       fluid_image,    float                                 percentage    ) {    midp_jc_event_union e;    e.eventType = JSR290_JC_EVENT_FLUID_LISTENER_PERCENTAGE;    e.data.jsr290FluidEvent.fluid_image = fluid_image;    e.data.jsr290FluidEvent.percentage = percentage;    midp_jc_event_send(&e);}    voidjavanotify_fluid_listener_started (    javacall_handle                       fluid_image    ) {    midp_jc_event_union e;    e.eventType = JSR290_JC_EVENT_FLUID_LISTENER_STARTED;    e.data.jsr290FluidEvent.fluid_image = fluid_image;    midp_jc_event_send(&e);}    voidjavanotify_fluid_listener_warning (    javacall_handle                       fluid_image,    javacall_const_utf16_string           warning    ) {    midp_jc_event_union e;    e.eventType = JSR290_JC_EVENT_FLUID_LISTENER_WARNING;    e.data.jsr290FluidEvent.fluid_image = fluid_image;    e.data.jsr290FluidEvent.text = javautil_wcsdup(warning);    midp_jc_event_send(&e);}voidjavanotify_fluid_request_resource (    javacall_handle                       fluid_image,    javacall_handle                       request,    javacall_const_utf16_string           url    ) {    midp_jc_event_union e;    e.eventType = JSR290_JC_EVENT_FLUID_REQUEST_RESOURCE;    e.data.jsr290FluidEvent.fluid_image = fluid_image;    e.data.jsr290FluidEvent.spare       = request;    e.data.jsr290FluidEvent.text        = javautil_wcsdup(url);    midp_jc_event_send(&e);}voidjavanotify_fluid_cancel_request (    javacall_handle                       fluid_image,    javacall_handle                       request    ) {    midp_jc_event_union e;    e.eventType = JSR290_JC_EVENT_FLUID_CANCEL_REQUEST;    e.data.jsr290FluidEvent.fluid_image = fluid_image;    e.data.jsr290FluidEvent.spare       = request;    midp_jc_event_send(&e);}#endif /* ENABLE_JSR_290 *//** * The platform calls this callback notify function when the permission dialog * is dismissed. The platform will invoke the callback in platform context. * * @param userPermssion the permission level the user chose */void javanotify_security_permission_dialog_finish(                         javacall_security_permission_type userPermission) {    midp_jc_event_union e;    REPORT_INFO(LC_CORE, "javanotify_security_permission_dialog_finish() >>\n");    e.eventType = MIDP_JC_EVENT_PERMISSION_DIALOG;    e.data.permissionDialog_event.permission_level = userPermission;    midp_jc_event_send(&e);}#ifdef USE_VSCL/* * See javacall_vscl.h for description */void javanotify_vscl_incoming_event(javacall_vscl_event_type type,                                    javacall_utf16* str1,                                    javacall_utf16* str2) {    midp_jc_event_union e;    REPORT_INFO(LC_CORE, "javanotify_vscl_incoming_event() >>\n");    switch (type) {    case JAVACALL_VSCL_INCOMING_CALL:        e.eventType = MIDP_JC_EVENT_VSCL_INCOMING_CALL;                REPORT_INFO(LC_VSCL,"javanotify_vscl_incoming_event() got EVENT=INCOMING_CALL\n");        break;    case JAVACALL_VSCL_CALL_DROPPED:        e.eventType = MIDP_JC_EVENT_VSCL_CALL_DROPPED;                REPORT_INFO(LC_VSCL,"javanotify_vscl_incoming_event() got EVENT=CALL_DROPPED\n");        break;    case JAVACALL_VSCL_INCOMING_MAIL_CBS:    case JAVACALL_VSCL_INCOMING_MAIL_DELIVERY_CONF:    case JAVACALL_VSCL_INCOMING_MAIL_MMS:    case JAVACALL_VSCL_INCOMING_MAIL_SMS:    case JAVACALL_VSCL_INCOMING_MAIL_WAP_PUSH:    case JAVACALL_VSCL_SCHEDULED_ALARM:                REPORT_INFO1(LC_VSCL,"javanotify_vscl_incoming_event() EVENT=%d NOT IMPLEMENTED!\n", (int)type);        return;    case JAVACALL_VSCL_FLIP_OPEN:                REPORT_INFO(LC_VSCL,"javanotify_vscl_incoming_event() got EVENT=FLIP_OPEN\n");        e.eventType = MIDP_JC_EVENT_VSCL_FLIP_OPENED;        break;    case JAVACALL_VSCL_FLIP_CLOSED:                REPORT_INFO(LC_VSCL,"javanotify_vscl_incoming_event() got EVENT=FLIP_CLOSED\n");        e.eventType = MIDP_JC_EVENT_VSCL_FLIP_CLOSED;        break;    default:                REPORT_INFO1(LC_VSCL,"javanotify_vscl_incoming_event() EVENT=%d NOT IMPLEMENTED!\n", (int)type);        return;    }    midp_jc_event_send(&e);}#endif /* USE_VSCL *//** * Notify Java that the user has made a selection * * @param phoneNumber a string representing the phone number the user selected. *                    The string will be copied so it can be freed after this *                    function call returns. *                    In case the user dismissed the phonebook without making a *                    selection, this sting is <tt>NULL</tt> */void /* OPTIONAL */ javanotify_textfield_phonenumber_selection(char* phoneNumber) {    midp_jc_event_union e;    int length;    REPORT_INFO(LC_CORE, "javanotify_textfield_phonenumber_selection() >>\n");    e.eventType = MIDP_JC_EVENT_PHONEBOOK;    memset(selectedNumber, 0, MAX_PHONE_NUMBER_LENGTH);    if (phoneNumber != NULL) {        length = strlen(phoneNumber) + 1;        if (length <= MAX_PHONE_NUMBER_LENGTH) {            memcpy(selectedNumber, phoneNumber, length);        } else {            memcpy(selectedNumber, phoneNumber, MAX_PHONE_NUMBER_LENGTH);        }    }    e.data.phonebook_event.phoneNumber = selectedNumber;    midp_jc_event_send(&e);}void /* OPTIONAL */ javanotify_rotation(int hardwareId) {    midp_jc_event_union e;    (void)hardwareId;    REPORT_INFO(LC_CORE, "javanotify_rotation() >>\n");    e.eventType = MIDP_JC_EVENT_ROTATION;    midp_jc_event_send(&e);}/**  * The platform should invoke this function in platform context  * to notify display device state change  */void  /* OPTIONAL */ javanotify_display_device_state_changed(int hardwareId, javacall_lcd_display_device_state state) {    midp_jc_event_union e;    REPORT_INFO(LC_CORE, "javanotify_display_device_state_changed >>\n");    e.data.displayDeviceEvent.hardwareId =  hardwareId;    e.data.displayDeviceEvent.state = state;    e.eventType = MIDP_JC_EVENT_DISPLAY_DEVICE_STATE_CHANGED;    midp_jc_event_send(&e);}/**  * The platform should invoke this function in platform context  * to notify clamshell state change  */    void  /* OPTIONAL */ javanotify_clamshell_state_changed(javacall_lcd_clamshell_state state) {    midp_jc_event_union e;    REPORT_INFO(LC_CORE, "javanotify_clamshell_state_changed >>\n");    e.data.clamshellEvent.state = state;    e.eventType = MIDP_JC_EVENT_CLAMSHELL_STATE_CHANGED;    midp_jc_event_send(&e);}void javanotify_virtual_keyboard() {    midp_jc_event_union e;    REPORT_INFO(LC_CORE, "javanotify_virtual_keyboard() >>\n");    e.eventType = MIDP_JC_EVENT_VIRTUAL_KEYBOARD;    midp_jc_event_send(&e);}#ifdef ENABLE_API_EXTENSIONS/** *  * The implementation calls this callback notify function when master volume dialog * is dismissed. The platfrom will invoke the callback in platform context. * This function is used only for asynchronous mode of the function * javacall_prompt_volume. *  */void javanotify_prompt_volume_finish(void) {    midp_jc_event_union e;    REPORT_INFO1(LC_PROTOCOL,                  "[javanotify_prompt_volume_finish] status=%d",                 JAVACALL_OK);    e.eventType = MIDP_JC_EVENT_VOLUME;    e.data.VolumeEvent.stub = 0;}#endif /*ENABLE_API_EXTENSIONS*/void javanotify_widget_menu_selection(int cmd) {    // This command comes from a menu item dynamically    // created in the native method    // SoftButtonLayer.setNativePopupMenu()    midp_jc_event_union e;    e.eventType = MIDP_JC_EVENT_MENU_SELECTION;    e.data.menuSelectionEvent.menuIndex = cmd;    midp_jc_event_send(&e);}/** * Notfy native peer widget state changed, such as key pressed in editor control. * Now only java TextField/TextBox has native peer. */void javanotify_peerchanged_event(void) {    midp_jc_event_union e;    e.eventType = MIDP_JC_EVENT_PEER_CHANGED;    midp_jc_event_send(&e);}#if ENABLE_ON_DEVICE_DEBUG/** * The platform calls this function to inform VM that * ODTAgent midlet must be enabled. */void javanotify_enable_odd() {     midp_jc_event_union e;     REPORT_INFO(LC_CORE, "javanotify_enable_odd() >>\n");     e.eventType = MIDP_JC_ENABLE_ODD_EVENT;     midp_jc_event_send(&e);}#endif#ifdef __cplusplus}#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?