当前位置: 首页>>代码示例>>C++>>正文


C++ KNI_ReturnVoid函数代码示例

本文整理汇总了C++中KNI_ReturnVoid函数的典型用法代码示例。如果您正苦于以下问题:C++ KNI_ReturnVoid函数的具体用法?C++ KNI_ReturnVoid怎么用?C++ KNI_ReturnVoid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了KNI_ReturnVoid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Java_com_sun_midp_io_j2me_btspp_BTSPPNotifierImpl_listen0

/**
 * Force Bluetooth stack to listen for incoming client connections.
 *
 * Note: the method gets native connection handle directly from
 * <code>handle<code> field of <code>BTSPPNotifierImpl</code> object.
 *
 * @throws IOException if an I/O error occurs
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_io_j2me_btspp_BTSPPNotifierImpl_listen0(void) {

    bt_handle_t handle = BT_INVALID_HANDLE;

    REPORT_INFO(LC_PROTOCOL, "btspp_notif::listen");

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisHandle);
    KNI_GetThisPointer(thisHandle);
    if (KNI_GetIntField(thisHandle, pushHandleID) == BT_INVALID_PUSH_HANDLE) {
        handle = (bt_handle_t)KNI_GetIntField(thisHandle, notifHandleID);

        /* force listening */
        if (bt_rfcomm_listen(handle) == BT_RESULT_FAILURE) {
            bt_rfcomm_close(handle);
            REPORT_ERROR(LC_PROTOCOL,
                "RFCOMM notifier listen failed in btspp_notif::listen");
            KNI_ThrowNew(midpIOException,
                EXCEPTION_MSG("RFCOMM notifier listen failed"));
        } else {
            REPORT_INFO(LC_PROTOCOL, "btspp_notif::listen done!");
        }
    }
    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:35,代码来源:btSPPNotifierGlue.c

示例2: Java_com_sun_midp_links_LinkPortal_getLinks0

/**
 * private static native void getLinks0(Link[] linkarray);
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_links_LinkPortal_getLinks0(void)
{
    int targetIsolate;
    jsize len;
    int i;
    KNI_StartHandles(2);
    KNI_DeclareHandle(linkArray);
    KNI_DeclareHandle(linkObj);

    targetIsolate = JVM_CurrentIsolateID();
    KNI_GetParameterAsObject(1, linkArray);
    len = KNI_GetArrayLength(linkArray);

    if (portals != NULL) {
        if (portals[targetIsolate].count > 0) {
            rendezvous **rpp = portals[targetIsolate].rppa;
            for (i = 0; i < len; i++) {
                KNI_GetObjectArrayElement(linkArray, i, linkObj);
                setNativePointer(linkObj, rpp[i]);
                rp_incref(rpp[i]);
            }
        }
        portal_free(&portals[targetIsolate]);
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:32,代码来源:midp_link.c

示例3: KNIDECL

/**
 * Native method void removeAllComponents(int suiteId) of
 * com.sun.midp.midletsuite.DynamicComponentStorage.
 * <p>
 * Removes all dynamic components belonging to the given suite.
 * <p>
 * If any component is in use, no components are removed, and
 * an exception is thrown.
 *
 * @param suiteId ID of the suite whose components must be removed
 *
 * @throws IllegalArgumentException if there is no suite with
 *                                  the specified ID
 * @throws MIDletSuiteLockedException is thrown, if any component is
 *                                    locked
 */
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_midp_midletsuite_DynamicComponentStorage_removeAllComponents) {
    MIDPError status;
    SuiteIdType suiteId = KNI_GetParameterAsInt(1);

    do {
        status = begin_transaction(TRANSACTION_REMOVE_ALL_COMPONENTS,
                                   suiteId, NULL);
        if (status != ALL_OK) {
            break;
        }

        status = delete_components_files(suiteId, UNUSED_COMPONENT_ID);
        if (status != ALL_OK) {
            break;
        }
        
        (void)remove_from_component_list_and_save(suiteId, UNUSED_COMPONENT_ID);
    } while(0);

    (void)finish_transaction();

    if (status == SUITE_LOCKED) {
        KNI_ThrowNew(midletsuiteLocked, NULL);
    } else if (status == BAD_PARAMS) {
        KNI_ThrowNew(midpIllegalArgumentException, "bad component ID");
    } else if (status != ALL_OK) {
        KNI_ThrowNew(midpRuntimeException,
            (status == OUT_OF_MEMORY) ? "Remove failed" : "Out of memory!");
    }

    KNI_ReturnVoid();
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:49,代码来源:components_storage_kni.c

示例4: Java_com_sun_midp_links_Link_close

/**
 * public native void close();
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_links_Link_close(void)
{
    rendezvous *rp;
    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObj);

    KNI_GetThisPointer(thisObj);
    rp = getNativePointer(thisObj);

    /* ignore if closed twice */
    if (rp != NULL) {
        if (rp->sender == JVM_CurrentIsolateID()
                && rp->msg != INVALID_REFERENCE_ID) {
            /* we're the sender, make sure to clean out our message */
            SNI_DeleteReference(rp->msg);
            rp->msg = INVALID_REFERENCE_ID;
        }

        rp->state = CLOSED;
        midp_thread_signal(LINK_READY_SIGNAL, (int)rp, 0);
        setNativePointer(thisObj, NULL);
        rp_decref(rp);
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:31,代码来源:midp_link.c

示例5: Java_javax_microedition_lcdui_FormLFImpl_showNativeResource0

/**
 * KNI function that makes native form visible.
 * Java Prototype: void showNativeResource0(int nativeId,
 * 					   int modelVersion,
 *                                         int w, int h) 
 * CLASS:         javax.microedition.lcdui.FormLFImpl
 * Param: nativeId Id of previously created Form native resource
 * Param: modelVersion version id of the data passed in from Java
 * Param: w width of all form content
 * Param: h height of all form content
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_lcdui_FormLFImpl_showNativeResource0() {
    int w, h;
    MidpError err;
    MidpDisplayable *formPtr = (MidpDisplayable *)KNI_GetParameterAsInt(1);
    
    /* Initialize data model version for this new visible period */
    formPtr->frame.component.modelVersion = KNI_GetParameterAsInt(2);
    w = KNI_GetParameterAsInt(3);
    h = KNI_GetParameterAsInt(4);

    /* Set form window virtual size */
    err = lfpport_form_set_content_size(formPtr, w, h);
    if (err != KNI_OK) goto cleanup;

    if (MidpCurrentScreen != &formPtr->frame) {
	/* Becomes the new current screen that receives events */
	MidpCurrentScreen = &formPtr->frame;
    
	/*
	 * NOTE: MidpCurrentScreen is needed before it is shown because
	 * on show its children may want to notify their appearance.
	 */

	/* Show Form window */
	err = formPtr->frame.show(&formPtr->frame);
    }

cleanup:
    if (err != KNI_OK) {
	KNI_ThrowNew(midpOutOfMemoryError, NULL);
    }

    KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:46,代码来源:lfp_form.c

示例6: handleFatalError

/**
 * Reports a fatal error that cannot be handled in Java.
 * Must be called from a KNI method
 *
 */
void handleFatalError(void) {
    KNI_StartHandles(1);
    KNI_DeclareHandle(throwableObj);
    KNI_GetParameterAsObject(1, throwableObj);

    /* IMPL NOTE: Figure out what throwable class this is and log the error? */
    REPORT_CRIT1(LC_CORE, "handleFatalError: uncaught exception in "
        "isolate %d event processing thread", getCurrentIsolateId());
    
    KNI_EndHandles();

    if (getCurrentIsolateId() == midpGetAmsIsolateId()) {
        /* AMS isolate or SVM mode, terminate VM */
        midp_exitVM(-1);
    } else {
        MidpEvent event;

        /* Application isolate, notify the AMS isolate. */
        MIDP_EVENT_INITIALIZE(event);
        event.type = FATAL_ERROR_NOTIFICATION;
        event.intParam1 = getCurrentIsolateId();

        /* Send the shutdown event. */
        StoreMIDPEventInVmThread(event, midpGetAmsIsolateId());
    }

    KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:33,代码来源:midpEvents.c

示例7: Java_com_sun_j2me_payment_TransactionStorageImpl_lockStore

/**
 * The function blocks the calling thread if Transaction Store is locked.
 * <p>Java declaration:
 * <pre>
 * private native void lockStore();
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_j2me_payment_TransactionStorageImpl_lockStore() {
    MidpReentryData *info = NULL;

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObject);
    KNI_GetThisPointer(thisObject);

    if (locked == KNI_FALSE) {
        locked = KNI_TRUE;
        KNI_GetThisPointer(thisObject);
        getStorageOpenFlag(thisObject)->isOpen = (jboolean)KNI_TRUE;
    } else {
        info = (MidpReentryData*)SNI_GetReentryData(NULL);
        if (info == NULL) {
            info = (MidpReentryData*)
                (SNI_AllocateReentryData(sizeof (MidpReentryData)));
        }
        info->waitingFor = PAYMENT_TRANSACTION_STORE_SIGNAL;
        info->descriptor = 0;
        info->status = KNI_FALSE;
        info->pResult = NULL;

        /* try again later */
        SNI_BlockThread();
    }
    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:35,代码来源:transactionStorage_kni.c

示例8: Java_com_sun_midp_events_EventQueue_finalize

/**
 * Native finalizer to reset the native peer event queue when
 * the Isolate ends.
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_events_EventQueue_finalize(void) {
   jint queueId;
   EventQueue* pEventQueue;

   KNI_StartHandles(1);
   KNI_DeclareHandle(thisObject);
   KNI_GetThisPointer(thisObject);

   SNI_BEGIN_RAW_POINTERS;
   queueId = getEventQueuePtr(thisObject)->queueId;
   SNI_END_RAW_POINTERS;

   KNI_EndHandles();

   if (queueId >= 0) {
       resetEventQueue(queueId);

       /* Mark queue as inactive */
       GET_EVENT_QUEUE_BY_ID(pEventQueue, queueId);
       pEventQueue->isActive = KNI_FALSE;
   }

   KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:29,代码来源:midpEvents.c

示例9: Java_com_sun_midp_jsr229_Initializer_init

/**
* Native method void init() of
* com.sun.midp.jsr229.Initializer.
* <p>
* Do the basic initialization of the JSR229.
* Registers a callback on a midlet suite removal.
*/
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_jsr229_Initializer_init() {
    (void) midp_suite_add_listener(jsr229_remove_listener,
                                   SUITESTORE_LISTENER_TYPE_REMOVE,
                                   SUITESTORE_OPERATION_START);
    KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:14,代码来源:jsr229_initializer_kni.c

示例10: Java_javax_microedition_lcdui_CustomItemLFImpl_setContentBuffer0

/**
 * Sets the content buffer. All paints are done to that buffer.
 * When paint is processed snapshot of the buffer is flushed to
 * the native resource content area.
 * Native implementation of Java function:
 * private static native int setContentBuffer0 ( int nativeId, Image img );
 * @param nativeId native resource is for this CustomItem
 * @param img mutable image that serves as an offscreen buffer
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_lcdui_CustomItemLFImpl_setContentBuffer0() {

  MidpError err = KNI_OK;
  unsigned char* imgPtr = NULL;
  MidpItem *ciPtr = (MidpItem *)KNI_GetParameterAsInt(1);

  KNI_StartHandles(1);
  KNI_DeclareHandle(image);

  KNI_GetParameterAsObject(2, image);
  
  if (KNI_IsNullHandle(image) != KNI_TRUE) {
    imgPtr = gxp_get_imagedata(image);
  }

  KNI_EndHandles();

  err = lfpport_customitem_set_content_buffer(ciPtr, imgPtr);
  
  if (err != KNI_OK) {
    KNI_ThrowNew(midpOutOfMemoryError, NULL);
  }
  
  KNI_ReturnVoid();
}
开发者ID:jiangxilong,项目名称:yari,代码行数:35,代码来源:lfp_customitem.c

示例11: Java_javax_microedition_lcdui_StringItemLFImpl_setContent0

/**
 * KNI function that sets new content on the native resource corresponding to
 * the current StringItem.
 *
 * Class: javax.microedition.lcdui.StringLFImpl
 * Java prototype:
 * private native int setContent0(int nativeId, Image image, altText,
 *                                appearanceMode)
 *
 * INTERFACE (operand stack manipulation):
 *   parameters:  nativeId pointer to the native resource of the StringItem
 *                text     the new string set in the StringItem
 *                appearanceMode the appearance mode of the passed in text
 *   returns:     <nothing>
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_lcdui_StringItemLFImpl_setContent0() {
    MidpError err = KNI_OK;
    MidpItem *itemPtr = (MidpItem *)KNI_GetParameterAsInt(1);
    int appearanceMode = KNI_GetParameterAsInt(3);
    pcsl_string text;
    pcsl_string_status rc;

    KNI_StartHandles(1);
    KNI_DeclareHandle(textJString);

    KNI_GetParameterAsObject(2, textJString);

    rc = midp_kjstring_to_pcsl_string(textJString, &text);

    KNI_EndHandles();

    if (PCSL_STRING_OK != rc) {
        err = KNI_ENOMEM;
    } else {
        err = lfpport_stringitem_set_content(itemPtr, &text, appearanceMode);
    }

    pcsl_string_free(&text);

    if (err == KNI_ENOMEM) {
        KNI_ThrowNew(midpOutOfMemoryError, NULL);
    }

    KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:46,代码来源:lfp_stringitem.c

示例12: Java_javax_microedition_lcdui_ImageData_finalize

/**
 * Releases any native resources used by this immutable <tt>ImageData</tt>.
 * <p>
 * Java declaration:
 * <pre>
 *     finalize()V
 * </pre>
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_lcdui_ImageData_finalize() {
    java_imagedata * imageDataPtr = NULL;
    gxpport_image_native_handle h;

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObject);
    KNI_GetThisPointer(thisObject);

    imageDataPtr = IMGAPI_GET_IMAGEDATA_PTR(thisObject);

    /*
     * Image objects with NULL nativeImageData could exist when loading
     * romized image but failed.
     */
    h = (gxpport_image_native_handle)imageDataPtr->nativeImageData;
    if (h != NULL) {
        if (imageDataPtr->isMutable) {
            gxpport_destroy_mutable(h);
        } else {
            gxpport_destroy_immutable(h);
        }
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:35,代码来源:imgp_imagedata_kni.c

示例13: Java_com_sun_midp_io_j2me_socket_Protocol_setSockOpt0

/**
 * Sets the requested socket option.
 * <p>
 * Java declaration:
 * <pre>
 *     setSockOpt(II)V
 * </pre>
 *
 * @param option socket option to set
 * @param value the value to set <tt>option</tt> to
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_io_j2me_socket_Protocol_setSockOpt0(void) {
    int option;
    int value;
    void *pcslHandle;
    int status = PCSL_NET_INVALID;
    
    value  = (int)KNI_GetParameterAsInt(2);
    option = (int)KNI_GetParameterAsInt(1);

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObject);
    KNI_GetThisPointer(thisObject);

    pcslHandle = (void *)(getMidpSocketProtocolPtr(thisObject)->handle);

    KNI_EndHandles();

    if (INVALID_HANDLE == pcslHandle) {
        KNI_ThrowNew(midpIOException, 
                     "invalid handle during socket::getPort");
    } else {
        status = pcsl_network_setsockopt(pcslHandle, option, value);
        if (status == PCSL_NET_IOERROR) {
            KNI_ThrowNew(midpIllegalArgumentException, "Unsupported Socket Option");
        } else if (PCSL_NET_INVALID == status) {
            KNI_ThrowNew(midpIllegalArgumentException, "Illegal Socket Option Value");
        }
    }

    KNI_ReturnVoid();
}
开发者ID:jiangxilong,项目名称:yari,代码行数:43,代码来源:socketProtocol.c

示例14: KNIDECL

/**
 * Initializes the native peer of this <tt>Font</tt>.
 * <p>
 * Java declaration:
 * <pre>
 *     init(III)V
 * </pre>
 *
 * @param face The face of the font to initialize
 * @param style The style of the font to initialize
 * @param size The point size of the font to initialize
 */
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(javax_microedition_lcdui_Font_init) {
    jboolean free_size = KNI_GetParameterAsBoolean(4);
    int size  = (int)KNI_GetParameterAsInt(3);
    int style = (int)KNI_GetParameterAsInt(2);
    int face  = (int)KNI_GetParameterAsInt(1);
    int ascent, descent, leading;

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObject);

    if (free_size == KNI_FALSE) {
        /* size is one of the SIZE_XXX constants */
        size = OEM_FONT_SIZE(size);
    }

    KNI_GetParameterAsObject(0, thisObject);

    gx_get_fontinfo(face, style, size, &ascent, &descent, &leading);

    SNI_BEGIN_RAW_POINTERS;

    GET_FONT_PTR(thisObject)->baseline = (jint)ascent;
    GET_FONT_PTR(thisObject)->height = (jint)(ascent + descent + leading);
    GET_FONT_PTR(thisObject)->size = (jint)size;
    GET_FONT_PTR(thisObject)->sizeRounded = (jint) LCDUI_FONT_SIZE(size);

    SNI_END_RAW_POINTERS;

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:44,代码来源:gxapi_font_kni.c

示例15: Java_com_sun_midp_links_Link_init0

/**
 * private native void init0(int sender, int receiver);
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_links_Link_init0(void)
{
    int sender;
    int receiver;
    rendezvous *rp;

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObj);

    sender = KNI_GetParameterAsInt(1);
    receiver = KNI_GetParameterAsInt(2);
    KNI_GetThisPointer(thisObj);

    rp = rp_create(sender, receiver);
    if (rp == NULL) {
        KNI_ThrowNew(midpOutOfMemoryError, NULL);
    } else {
        setNativePointer(thisObj, rp);
        rp_incref(rp);
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:28,代码来源:midp_link.c


注:本文中的KNI_ReturnVoid函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。