javanotify_midp_jsr.c
来自「This is a resource based on j2me embedde」· C语言 代码 · 共 1,294 行 · 第 1/3 页
C
1,294 行
midp_jc_event_send(&e); return;}#endif#ifdef ENABLE_JSR_177/** * */void javanotify_carddevice_event(javacall_carddevice_event event, void *context) { midp_jc_event_union e; REPORT_INFO(LC_CORE, "javanotify_carddevice_event() >>\n"); e.eventType = MIDP_JC_EVENT_CARDDEVICE; switch (event) { case JAVACALL_CARDDEVICE_RESET: e.data.carddeviceEvent.eventType = MIDP_CARDDEVICE_RESET; e.data.carddeviceEvent.handle = (int)context; break; case JAVACALL_CARDDEVICE_XFER: e.data.carddeviceEvent.eventType = MIDP_CARDDEVICE_XFER; e.data.carddeviceEvent.handle = (int)context; break; case JAVACALL_CARDDEVICE_UNLOCK: e.data.carddeviceEvent.eventType = MIDP_CARDDEVICE_UNLOCK; e.data.carddeviceEvent.handle = 0; break; default: /* TODO: report error */ return; } midp_jc_event_send(&e); return;}#endif /* ENABLE_JSR_177 *//** * A callback function to be called for notification of non-blocking * client/server socket related events, such as a socket completing opening or , * closing socket remotely, disconnected by peer or data arrived on * the socket indication. * The platform will invoke the call back in platform context for * each socket related occurrence. * * @param type type of indication: Either * - JAVACALL_EVENT_SOCKET_OPEN_COMPLETED * - JAVACALL_EVENT_SOCKET_CLOSE_COMPLETED * - JAVACALL_EVENT_SOCKET_RECEIVE * - JAVACALL_EVENT_SOCKET_SEND * - JAVACALL_EVENT_SOCKET_REMOTE_DISCONNECTED * - JAVACALL_EVENT_NETWORK_GETHOSTBYNAME_COMPLETED * @param socket_handle handle of socket related to the notification * @param operation_result <tt>JAVACALL_OK</tt> if operation * completed successfully, * <tt>JAVACALL_FAIL</tt> or negative value on failure */void javanotify_socket_event(javacall_socket_callback_type type, javacall_handle socket_handle, javacall_result operation_result) { midp_jc_event_union e; REPORT_INFO(LC_CORE, "javanotify_socket_event() >>\n"); e.eventType = MIDP_JC_EVENT_SOCKET; e.data.socketEvent.handle = socket_handle; e.data.socketEvent.status = operation_result; e.data.socketEvent.extraData = NULL; switch (type) { case JAVACALL_EVENT_SOCKET_OPEN_COMPLETED: case JAVACALL_EVENT_SOCKET_SEND: e.data.socketEvent.waitingFor = NETWORK_WRITE_SIGNAL; break; case JAVACALL_EVENT_SOCKET_RECEIVE: e.data.socketEvent.waitingFor = NETWORK_READ_SIGNAL; break; case JAVACALL_EVENT_NETWORK_GETHOSTBYNAME_COMPLETED: e.data.socketEvent.waitingFor = HOST_NAME_LOOKUP_SIGNAL; break; case JAVACALL_EVENT_SOCKET_CLOSE_COMPLETED: e.data.socketEvent.waitingFor = NETWORK_EXCEPTION_SIGNAL; break; case JAVACALL_EVENT_SOCKET_REMOTE_DISCONNECTED: e.data.socketEvent.waitingFor = NETWORK_EXCEPTION_SIGNAL; break; default: /* IMPL_NOTE: decide what to do */ return; /* do not send event to java */ /* IMPL_NOTE: NETWORK_EXCEPTION_SIGNAL is not assigned by any indication */ } midp_jc_event_send(&e);}/** * A callback function to be called for notification of non-blocking * server socket only related events, such as a accept completion. * The platform will invoke the call back in platform context for * each socket related occurrence. * * @param type type of indication: Either * JAVACALL_EVENT_SERVER_SOCKET_ACCEPT_COMPLETED * @param socket_handle handle of socket related to the notification. * If the platform is not able to provide the socket * handle in the callback, it should pass 0 as the new_socket_handle * and the implementation will call javacall_server_socket_accept_finish * to retrieve the handle for the accepted connection. * @param new_socket_handle in case of accept the socket handle for the * newly created connection * * @param operation_result <tt>JAVACALL_OK</tt> if operation * completed successfully, * <tt>JAVACALL_FAIL</tt> or negative value on failure */void /* OPTIONAL */ javanotify_server_socket_event(javacall_server_socket_callback_type type, javacall_handle socket_handle, javacall_handle new_socket_handle, javacall_result operation_result) { midp_jc_event_union e; REPORT_INFO(LC_CORE, "javanotify_server_socket_event() >>\n"); e.eventType = MIDP_JC_EVENT_SOCKET; e.data.socketEvent.handle = socket_handle; e.data.socketEvent.status = operation_result; e.data.socketEvent.extraData = NULL; if (type == JAVACALL_EVENT_SERVER_SOCKET_ACCEPT_COMPLETED) { e.data.socketEvent.waitingFor = NETWORK_READ_SIGNAL; /* IMPL_NOTE: how about using extraData instead of status? Then, malloc required. */ /* If the platform is not able to provide the socket handle in the callback, it should pass 0. */ if (operation_result == JAVACALL_OK) { e.data.socketEvent.status = (javacall_result)((int)new_socket_handle); } else { e.data.socketEvent.status = operation_result; } } else { /* IMPL_NOTE: decide what to do */ return; /* do not send event to java */ } midp_jc_event_send(&e);}/** * A callback function to be called for notification of non-blocking * client/server socket related events, such as a socket completing opening or , * closing socket remotely, disconnected by peer or data arrived on * the socket indication. * The platform will invoke the call back in platform context for * each socket related occurrence. * * @param type type of indication: Either * - JAVACALL_EVENT_DATAGRAM_RECVFROM_COMPLETED * - JAVACALL_EVENT_DATAGRAM_SENDTO_COMPLETED * @param handle handle of datagram related to the notification * @param operation_result <tt>JAVACALL_OK</tt> if operation * completed successfully, * <tt>JAVACALL_FAIL</tt> or negative value on failure */void javanotify_datagram_event(javacall_datagram_callback_type type, javacall_handle handle, javacall_result operation_result) { midp_jc_event_union e; REPORT_INFO(LC_CORE, "javanotify_datagram_event() >>\n"); e.eventType = MIDP_JC_EVENT_SOCKET; e.data.socketEvent.handle = handle; e.data.socketEvent.status = operation_result; e.data.socketEvent.extraData = NULL; switch (type) { case JAVACALL_EVENT_DATAGRAM_SENDTO_COMPLETED: e.data.socketEvent.waitingFor = NETWORK_WRITE_SIGNAL; break; case JAVACALL_EVENT_DATAGRAM_RECVFROM_COMPLETED: e.data.socketEvent.waitingFor = NETWORK_READ_SIGNAL; break; default: /* IMPL_NOTE: decide what to do */ return; /* do not send event to java */ /* IMPL_NOTE: NETWORK_EXCEPTION_SIGNAL is not assigned by any indication */ } midp_jc_event_send(&e);}#ifdef ENABLE_JSR_135/** * Post native media event to Java event handler * * @param type Event type * @param appId Application ID * @param playerId Player ID * @param status Event status * @param data Data for this event type */void javanotify_on_media_notification(javacall_media_notification_type type, int appId, int playerId, javacall_result status, void *data) {#if ENABLE_JSR_135 midp_jc_event_union e; REPORT_INFO4(LC_MMAPI, "javanotify_on_media_notification type=%d appId=%d playerId%d status=%d\n", type, appId, playerId, status); e.eventType = MIDP_JC_EVENT_MULTIMEDIA; e.data.multimediaEvent.mediaType = type; e.data.multimediaEvent.appId = appId; e.data.multimediaEvent.playerId = playerId; e.data.multimediaEvent.status = (int) status; e.data.multimediaEvent.data.num32 = (int) data; midp_jc_event_send(&e);#endif}#endif#if ENABLE_JSR_234/** * Post native advanced multimedia event to Java event handler * * @param type Event type * @param processorId Processor ID that came from javacall_media_processor_create * @param data Data for this event type */void javanotify_on_amms_notification(javacall_amms_notification_type type, javacall_int64 processorId, void *data) { midp_jc_event_union e; e.eventType = MIDP_JC_EVENT_ADVANCED_MULTIMEDIA; e.data.multimediaEvent.mediaType = type; e.data.multimediaEvent.appId = (int)((processorId >> 32) & 0xFFFF); e.data.multimediaEvent.playerId = (int)(processorId & 0xFFFF); switch( type ) { case JAVACALL_EVENT_AMMS_SNAP_SHOOTING_STOPPED: case JAVACALL_EVENT_AMMS_SNAP_STORAGE_ERROR: { int i = 0; size_t size = 0; javacall_utf16_string str16 = ( javacall_utf16_string )data; javautil_unicode_utf16_utf8length( str16, &size ); ++size; e.data.multimediaEvent.data.str16 = ( javacall_utf16_string ) javacall_malloc( size * sizeof( javacall_utf16 ) ); for( i = 0; i < size; i++ ) { e.data.multimediaEvent.data.str16[i] = str16[i]; } } break; default: e.data.multimediaEvent.data.num32 = (int) data; break; } REPORT_INFO1(LC_NONE, "[javanotify_on_amms_notification] type=%d\n", type); midp_jc_event_send(&e);}#endif/** * The implementation call this callback notify function when image decode done * * @param handle Handle that is returned from javacall_image_decode_start * @param result the decoding operation result */void javanotify_on_image_decode_end(javacall_handle handle, javacall_result result) { REPORT_INFO(LC_CORE, "javanotify_on_image_decode_end() >>\n");#ifdef ENABLE_EXTERNAL_IMAGE_DECODER midp_jc_event_union e; e.eventType = MIDP_JC_EVENT_IMAGE_DECODER; e.data.imageDecoderEvent.handle = handle; e.data.imageDecoderEvent.result = result; midp_jc_event_send(&e);#else (void)handle; (void)result;#endif}#ifdef ENABLE_JSR_75/** * A callback function to be called by the platform in order to notify * about changes in the available file system roots (new root was added/ * a root on removed). */void javanotify_fileconnection_root_changed(void) { midp_jc_event_union e; REPORT_INFO(LC_CORE, "javanotify_fileconnection_root_changed() >>\n"); e.eventType = JSR75_FC_JC_EVENT_ROOTCHANGED; midp_jc_event_send(&e);}#endif#ifdef ENABLE_JSR_179/** * A callback function to be called for notification of non-blocking * location related events. * The platform will invoke the call back in platform context for * each provider related occurrence. * * @param type type of indication: Either * <pre> * - <tt>JAVACALL_EVENT_LOCATION_OPEN_COMPLETED</tt> * - <tt>JAVACALL_EVENT_LOCATION_ORIENTATION_COMPLETED</tt> * - <tt>JAVACALL_EVENT_LOCATION_UPDATE_PERIODICALLY</tt> * - <tt>JAVACALL_EVENT_LOCATION_UPDATE_ONCE</tt> * </pre> * @param handle handle of provider related to the notification * @param operation_result operation result: Either * <pre> * - <tt>JAVACALL_OK</tt> if operation completed successfully, * - <tt>JAVACALL_LOCATION_RESULT_CANCELED</tt> if operation is canceled * - <tt>JAVACALL_LOCATION_RESULT_TIMEOUT</tt> if operation is timeout * - <tt>JAVACALL_LOCATION_RESULT_OUT_OF_SERVICE</tt> if provider is out of service * - <tt>JAVACALL_LOCATION_RESULT_TEMPORARILY_UNAVAILABLE</tt> if provider is temporarily unavailable * - otherwise, <tt>JAVACALL_FAIL</tt> * </pre> */void javanotify_location_event( javacall_location_callback_type event, javacall_handle provider, javacall_location_result operation_result) { midp_jc_event_union e; REPORT_INFO(LC_CORE, "javanotify_location_event() >>\n"); e.eventType = JSR179_LOCATION_JC_EVENT; switch(event){ case JAVACALL_EVENT_LOCATION_ORIENTATION_COMPLETED: e.data.jsr179LocationEvent.event = JSR179_ORIENTATION_SIGNAL; break; default: e.data.jsr179LocationEvent.event = JSR179_LOCATION_SIGNAL; break; } e.data.jsr179LocationEvent.provider = provider; e.data.jsr179LocationEvent.operation_result = operation_result; midp_jc_event_send(&e);}/** * A callback function to be called for notification of proximity monitoring updates. * * This function will be called only once when the terminal enters the proximity of the registered coordinate. * * @param provider handle of provider related to the notification * @param latitude of registered coordinate. * @param longitude of registered coordinate. * @param proximityRadius of registered coordinate. * @param pLocationInfo location info * @param operation_result operation result: Either * <pre> * - <tt>JAVACALL_OK</tt> if operation completed successfully, * - <tt>JAVACALL_LOCATION_RESULT_CANCELED</tt> if operation is canceled * - <tt>JAVACALL_LOCATION_RESULT_OUT_OF_SERVICE</tt> if provider is out of service * - <tt>JAVACALL_LOCATION_RESULT_TEMPORARILY_UNAVAILABLE</tt> if provider is temporarily unavailable * - otherwise, <tt>JAVACALL_FAIL</tt> * </pre> */void /*OPTIONAL*/javanotify_location_proximity( javacall_handle provider, double latitude, double longitude, float proximityRadius, javacall_location_location* pLocationInfo, javacall_location_result operation_result) { midp_jc_event_union e; REPORT_INFO(LC_CORE, "javanotify_location_proximity() >>\n"); e.eventType = JSR179_PROXIMITY_JC_EVENT; e.data.jsr179ProximityEvent.provider = provider; e.data.jsr179ProximityEvent.latitude = latitude; e.data.jsr179ProximityEvent.longitude = longitude; e.data.jsr179ProximityEvent.proximityRadius = proximityRadius; e.data.jsr179ProximityEvent.operation_result = operation_result; if (pLocationInfo) memcpy(&(e.data.jsr179ProximityEvent.location), pLocationInfo , sizeof(javacall_location_location)); midp_jc_event_send(&e);}#endif /* ENABLE_JSR_179 */#ifdef ENABLE_JSR_211/* * Called by platform to notify java VM that invocation of native handler * is finished. This is <code>ContentHandlerServer.finish()</code> substitute * after platform handler completes invocation processing. * @param invoc_id processed invocation Id * @param url if not NULL, then changed invocation URL * @param argsLen if greater than 0, then number of changed args * @param args changed args if @link argsLen is greater than 0 * @param dataLen if greater than 0, then length of changed data buffer * @param data the data * @param status result of the invocation processing. */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?