本文整理汇总了C++中KNI_GetParameterAsInt函数的典型用法代码示例。如果您正苦于以下问题:C++ KNI_GetParameterAsInt函数的具体用法?C++ KNI_GetParameterAsInt怎么用?C++ KNI_GetParameterAsInt使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KNI_GetParameterAsInt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Java_com_sun_j2me_location_PlatformLocationProvider_getLastLocationImpl
/* JAVADOC COMMENT ELIDED */
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_j2me_location_PlatformLocationProvider_getLastLocationImpl() {
jint provider;
jboolean ret;
KNI_StartHandles(2);
KNI_DeclareHandle(string_obj);
KNI_DeclareHandle(locationInfo);
provider = KNI_GetParameterAsInt(1);
KNI_GetParameterAsObject(2, locationInfo);
ret = getLocation(locationInfo, string_obj, getProviderInfo(provider));
KNI_EndHandles();
KNI_ReturnBoolean(ret);
}
示例2: Java_javax_microedition_khronos_egl_EGL10Impl__1putWindowContents
/* private native void _putWindowContents( Graphics winGraphics , int pixmapPointer ) ; */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_khronos_egl_EGL10Impl__1putWindowContents() {
jint pixmap = KNI_GetParameterAsInt(2);
KNI_StartHandles(1);
KNI_DeclareHandle(graphicsHandle);
KNI_GetParameterAsObject(1, graphicsHandle);
#ifdef DEBUG
printf("JSR239_putWindowContents(0x%x, 0x%x)\n",
graphicsHandle, pixmap);
#endif
JSR239_putWindowContents(graphicsHandle, (JSR239_Pixmap *)pixmap, 0);
KNI_EndHandles();
KNI_ReturnVoid();
}
示例3: Java_javax_microedition_lcdui_DateFieldLFImpl_setDate0
/**
*
* The datetime parameter coming from java is in milliseconds since the
* epoch 00:00 1/1/1970. It is needed to translate this value to the native
* date/time representation. (for example, QT uses the same epoch, but in
* resolution of seconds rather than milliseconds).
*
* private native void setDate0 ( int nativeId , long date ) ;
* @param date in milliseconds since 00:00 1/1/1970
*/
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_lcdui_DateFieldLFImpl_setDate0() {
MidpItem *dfPtr = NULL;
MidpError err;
jint nativeId = KNI_GetParameterAsInt(1);
jlong date = KNI_GetParameterAsLong(2); /* Long occupies two parameters */
dfPtr = (MidpItem *)nativeId;
err = lfpport_datefield_set_date(dfPtr,(long)(date/1000));
if (err != KNI_OK) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
}
KNI_ReturnVoid();
}
示例4: KNIDECL
/**
* Native connection registry method to check in connections that are in
* launch pending state for a specific MIDlet.
*
* @param suiteId Suite ID of the MIDlet as zero terminated ASCII byte array
* @param className Class name of the MIDlet as zero terminated ASCII byte
* array
*/
KNIEXPORT void
KNIDECL(com_sun_midp_io_j2me_push_ConnectionRegistry_checkInByMidlet0) {
SuiteIdType suiteId;
KNI_StartHandles(1);
KNI_DeclareHandle(classNameObj);
suiteId = KNI_GetParameterAsInt(1);
KNI_GetParameterAsObject(2, classNameObj);
SNI_BEGIN_RAW_POINTERS;
pushcheckinbymidlet(/*(char*)JavaByteArray(suiteIdObj)*/ suiteId,
(char*)JavaByteArray(classNameObj));
SNI_END_RAW_POINTERS;
KNI_EndHandles();
KNI_ReturnVoid();
}
示例5: KNIDECL
/* JAVADOC COMMENT ELIDED */
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_j2me_location_LocationPersistentStorage_updateLandmarkImpl) {
jint landmarkID;
javacall_result res;
javacall_landmarkstore_landmark *landmark;
jint numAddressFields;
KNI_StartHandles(3);
KNI_DeclareHandle(landmarkObj);
KNI_DeclareHandle(stringObj);
GET_PARAMETER_AS_UTF16_STRING(1, storeName)
landmarkID = KNI_GetParameterAsInt(2);
KNI_GetParameterAsObject(3, landmarkObj);
numAddressFields = KNI_GetIntField(landmarkObj,
landmarkImplFieldID.numAddressInfoFields);
landmark = JAVAME_MALLOC(SIZE_OF_LANDMARK_INFO(numAddressFields));
if (landmark != NULL) {
if (fill_landmark(landmarkObj, landmark, stringObj) == KNI_TRUE) {
res = javacall_landmarkstore_landmark_update(storeName,
(javacall_handle)landmarkID, landmark);
switch (res) {
case JAVACALL_OK:
/* Landmark updated successfully */
break;
case JAVACALL_INVALID_ARGUMENT:
/* wrong landmark ID */
KNI_ThrowNew(jsropIllegalArgumentException,
"Landmark does not belong to this store");
break;
default:
/* operation Failed */
KNI_ThrowNew(jsropIOException, "I/O error");
break;
}
}
JAVAME_FREE(landmark);
}
RELEASE_UTF16_STRING_PARAMETER
KNI_EndHandles();
KNI_ReturnVoid();
}
示例6: Java_com_sun_j2me_location_PlatformLocationProvider_getStateImpl
/* JAVADOC COMMENT ELIDED */
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_j2me_location_PlatformLocationProvider_getStateImpl() {
jsr179_state state = JSR179_OUT_OF_SERVICE;
jint provider = KNI_GetParameterAsInt(1);
jint ret=0; /* out of service */
if (stateValue.filled == KNI_FALSE) {
KNI_StartHandles(1);
KNI_DeclareHandle(clazz);
KNI_FindClass("javax/microedition/location/LocationProvider", clazz);
if(!KNI_IsNullHandle(clazz)) {
stateValue.available = KNI_GetStaticIntField(clazz,
KNI_GetStaticFieldID(clazz, "AVAILABLE", "I"));
stateValue.temporarilyUnavailable = KNI_GetStaticIntField(clazz,
KNI_GetStaticFieldID(clazz, "TEMPORARILY_UNAVAILABLE", "I"));
stateValue.outOfService = KNI_GetStaticIntField(clazz,
KNI_GetStaticFieldID(clazz, "OUT_OF_SERVICE", "I"));
stateValue.filled = KNI_TRUE;
}
KNI_EndHandles();
}
if (stateValue.filled == KNI_TRUE) {
jsr179_provider_state((jsr179_handle)provider, &state);
switch(state) {
case JSR179_AVAILABLE:
ret = stateValue.available;
break;
case JSR179_TEMPORARILY_UNAVAILABLE:
ret = stateValue.temporarilyUnavailable;
break;
case JSR179_OUT_OF_SERVICE:
default:
ret = stateValue.outOfService;
break;
}
}
KNI_ReturnInt(ret);
}
示例7: KNIDECL
/**
* Gets the MIDlet name for the given registered push connection.
* <p>
* Java declaration:
* <pre>
* getEntry0([B[BI)I
* </pre>
*
* @param connection The connection to add to the push registry
* @param midlet A byte array to store the MIDlet name
* @param midletsize The size of <tt>midlet</tt>
*
* @return <tt>0</tt> if successful, otherwise <tt>-1</tt>
*
* @throw IOException if the registry entry is too long.
*/
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_midp_io_j2me_push_ConnectionRegistry_getEntry0) {
int midletsize;
char *regentry;
int regsize ;
int ret = -1;
int connLen;
char *szConn = NULL;
midletsize = KNI_GetParameterAsInt(3);
KNI_StartHandles(2);
KNI_DeclareHandle(conn);
KNI_DeclareHandle(regObject);
KNI_GetParameterAsObject(1, conn);
connLen = KNI_GetArrayLength(conn);
ret = -1;
if ((szConn = midpMalloc(connLen)) != NULL) {
KNI_GetRawArrayRegion(conn, 0, connLen, (jbyte*)szConn);
KNI_GetParameterAsObject(2, regObject);
regentry = pushfindconn(szConn);
if (NULL != regentry) {
regsize = strlen(regentry) + 1;
if (regsize < midletsize) {
KNI_SetRawArrayRegion(regObject, 0, regsize,
(jbyte*)regentry);
ret = 0;
}
else {
KNI_ThrowNew(midpIOException, "registration too long");
}
}
midpFree(szConn);
}
else {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
}
KNI_EndHandles();
KNI_ReturnInt(ret);
}
示例8: KNIDECL
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_midp_midletsuite_MIDletSuiteImpl_lockMIDletSuite) {
jboolean isUpdate;
SuiteIdType suiteId;
int status;
suiteId = KNI_GetParameterAsInt(1);
isUpdate = KNI_GetParameterAsBoolean(2);
/* Throw an exception here if we have an error */
status = lock_storage(suiteId, isUpdate);
if (status < 0) {
if (status == OUT_OF_MEM_LEN) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
} else if (status == SUITE_LOCKED) {
KNI_ThrowNew(midletsuiteLocked, NULL);
}
}
KNI_ReturnVoid();
}
示例9: Java_com_sun_jsr082_bluetooth_btspp_BTSPPNotifierImpl_pushCheckout
/*
* Checks out (takes ownership of) an active server connection maintained
* by push subsystem.
*
* @param url URL used during registration of the push entry
* @param suiteId suite id
* @return true if the operation succeeds, false otherwise
*/
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_com_sun_jsr082_bluetooth_btspp_BTSPPNotifierImpl_pushCheckout(void)
{
jboolean retval = KNI_FALSE;
MidpString wsUrl;
SuiteIdType suiteId;
char *szUrl;
bt_port_t port;
jfieldID notifHandleID = NULL;
jfieldID pushHandleID = NULL;
KNI_StartHandles(3);
KNI_DeclareHandle(thisHandle);
KNI_DeclareHandle(urlHandle);
KNI_DeclareHandle(classHandle);
KNI_GetClassPointer(classHandle);
GET_FIELDID(classHandle, "handle", "I", notifHandleID)
GET_FIELDID(classHandle, "pushHandle", "I", pushHandleID)
KNI_GetThisPointer(thisHandle);
KNI_GetParameterAsObject(1, urlHandle);
suiteId = KNI_GetParameterAsInt(2);
wsUrl = midpNewString(urlHandle);
szUrl = midpJcharsToChars(wsUrl);
if (bt_push_parse_url(szUrl, &port, NULL) == JAVACALL_OK) {
if (pushcheckout(szUrl, 0, (char*)midp_suiteid2chars(suiteId)) == -2) {
KNI_ThrowNew(midpIOException, "Port already in use.");
} else {
javacall_handle handle;
bt_pushid_t pushid = bt_push_checkout_server(&port, &handle, NULL);
if (pushid != BT_INVALID_PUSH_HANDLE) {
KNI_SetIntField(thisHandle, pushHandleID, (jint)pushid);
KNI_SetIntField(thisHandle, notifHandleID, (jint)handle);
retval = KNI_TRUE;
}
}
}
midpFree(szUrl);
MIDP_FREE_STRING(wsUrl);
KNI_EndHandles();
KNI_ReturnBoolean(retval);
}
示例10: Java_com_sun_midp_jsr82emul_DeviceEmul_initDevice
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_midp_jsr82emul_DeviceEmul_initDevice() {
LOG("DeviceEmul_initDevice()");
KNI_StartHandles(1);
KNI_DeclareHandle(buf);
KNI_GetParameterAsObject(1, buf);
memcpy(emul_data.local_addr, JavaByteArray(buf), BT_ADDRESS_SIZE);
KNI_EndHandles();
emul_data.device_class_base = DEFAULT_COD;
emul_data.device_class = loadCod();
emul_data.access_code = KNI_GetParameterAsInt(2);
state |= DEVICE_INITED;
midp_thread_signal(JSR82_SIGNAL, BTE_SIGNAL_HANDLE, 0);
KNI_ReturnInt((jint)emul_data.device_class);
}
示例11: KNIDECL
/**
* Gets an ARGB integer array from this <tt>ImmutableImage</tt>. The
* array consists of values in the form of 0xAARRGGBB.
* <p>
* Java declaration:
* <pre>
* getRGB([IIIIIII)V
* </pre>
*
* @param rgbData The target integer array for the ARGB data
* @param offset Zero-based index of first ARGB pixel to be saved
* @param scanlen Number of intervening pixels between pixels in
* the same column but in adjacent rows
* @param x The x coordinate of the upper left corner of the
* selected region
* @param y The y coordinate of the upper left corner of the
* selected region
* @param width The width of the selected region
* @param height The height of the selected region
*/
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(javax_microedition_lcdui_ImageData_getRGB) {
int height = KNI_GetParameterAsInt(7);
int width = KNI_GetParameterAsInt(6);
int y = KNI_GetParameterAsInt(5);
int x = KNI_GetParameterAsInt(4);
int scanlength = KNI_GetParameterAsInt(3);
int offset = KNI_GetParameterAsInt(2);
int *rgbBuffer;
java_imagedata *srcImageDataPtr;
gxpport_mutableimage_native_handle srcImageNativeData;
img_native_error_codes error = IMG_NATIVE_IMAGE_NO_ERROR;
KNI_StartHandles(2);
KNI_DeclareHandle(rgbData);
KNI_DeclareHandle(thisObject);
KNI_GetParameterAsObject(1, rgbData);
KNI_GetThisPointer(thisObject);
SNI_BEGIN_RAW_POINTERS;
rgbBuffer = JavaIntArray(rgbData);
srcImageDataPtr = IMGAPI_GET_IMAGEDATA_PTR(thisObject);
srcImageNativeData =
(gxpport_mutableimage_native_handle)srcImageDataPtr->nativeImageData;
if (srcImageDataPtr->isMutable) {
gxpport_get_mutable_argb(srcImageNativeData,
rgbBuffer, offset, scanlength,
x, y, width, height,
&error);
} else {
gxpport_get_immutable_argb(srcImageNativeData,
rgbBuffer, offset, scanlength,
x, y, width, height,
&error);
}
SNI_END_RAW_POINTERS;
if (error != IMG_NATIVE_IMAGE_NO_ERROR) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
}
KNI_EndHandles();
KNI_ReturnVoid();
}
示例12: KNIDECL
/* protected native int nGetVolume ( int mediaType ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_mmedia_DirectVolume_nGetVolume) {
jint handle = KNI_GetParameterAsInt(1);
javacall_result ret = JAVACALL_FAIL;
long volume;
KNIPlayerInfo* pKniInfo = (KNIPlayerInfo*)handle;
MMP_DEBUG_STR("[kni_volume] +nGetVolume\n");
if (pKniInfo && pKniInfo->pNativeHandle) {
ret = javacall_media_get_volume(pKniInfo->pNativeHandle, &volume);
} else {
MMP_DEBUG_STR("[nGetVolume] Invalid native handle");
}
if (ret != JAVACALL_OK) {
volume = -1;
}
KNI_ReturnInt((int)volume);
}
示例13: KNIDECL
/**
* Native method void removeComponent(int componentId) of
* com.sun.midp.midletsuite.DynamicComponentStorage.
* <p>
* Removes a dynamic component given its ID.
* <p>
* If the component is in use it must continue to be available
* to the other components that are using it.
*
* @param componentId ID of the component ot remove
*
* @throws IllegalArgumentException if the component cannot be found
* @throws MIDletSuiteLockedException is thrown, if the component is
* locked
*/
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_midp_midletsuite_DynamicComponentStorage_removeComponent) {
MIDPError status;
MidletSuiteData* pData;
ComponentIdType componentId = KNI_GetParameterAsInt(1);
do {
/* check that the component exists */
pData = get_component_data(componentId);
if (pData == NULL) {
status = NOT_FOUND;
break;
}
status = begin_transaction(TRANSACTION_REMOVE_COMPONENT,
componentId, NULL);
if (status != ALL_OK) {
break;
}
status = delete_components_files(pData->suiteId, componentId);
if (status != ALL_OK) {
break;
}
(void)remove_from_component_list_and_save(pData->suiteId, componentId);
} while(0);
(void)finish_transaction();
if (status == SUITE_LOCKED) {
KNI_ThrowNew(midletsuiteLocked, NULL);
} else if (status == BAD_PARAMS || status == NOT_FOUND) {
KNI_ThrowNew(midpIllegalArgumentException, "bad component ID");
} else if (status != ALL_OK) {
KNI_ThrowNew(midpRuntimeException,
(status == OUT_OF_MEMORY) ? "Out of memory!" : "Remove failed");
}
KNI_ReturnVoid();
}
示例14: Java_javax_microedition_lcdui_DateFieldLFImpl_getDate0
/**
* The datetime parameter returned to java must be in milliseconds since the
* epoch 00:00 1/1/1970.
* It is needed to translate the native value to the java date/time
* representation. (for example, QT uses the same epoch, but in
* resolution of seconds rather than milliseconds, so it is needed to multiply
* the value by 1000 to pass to java).
*
* private native long getDate0 ( int nativeId ) ;
* @return date in milliseconds since 00:00 1/1/1970
*/
KNIEXPORT KNI_RETURNTYPE_LONG
Java_javax_microedition_lcdui_DateFieldLFImpl_getDate0() {
MidpItem *dfPtr = NULL;
MidpError err;
jint nativeId = KNI_GetParameterAsInt(1);
jlong returnValue = 0L ;
dfPtr = (MidpItem *)nativeId;
err = lfpport_datefield_get_date((long*)(void*)&returnValue, dfPtr);
if (err != KNI_OK) {
KNI_ThrowNew(midpOutOfMemoryError, NULL);
}
returnValue *= 1000;
KNI_ReturnLong(returnValue);
}
示例15: KNIDECL
/**
* Delete all messages registered against specified suite ID.
*
* @param msid The MIDlet suite ID.
*
*/
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_midp_wma_WMACleanupMonitor_deleteMessages0) {
/** The MIDP String version of the Midlet suite ID. */
int msid = UNUSED_APP_ID;
/* Pick up the Midlet Suite ID string. */
msid = KNI_GetParameterAsInt(1);
/*
* Invoke a native function that will delete all messages
* registered against msid.
*/
jsr120_sms_cleanup_midlet_suite(msid);
jsr120_cbs_delete_midlet_suite_msg(msid);
#if ENABLE_JSR_205
jsr205_mms_delete_midlet_suite_msg(msid);
#endif
KNI_ReturnVoid();
}