Exemplo n.º 1
0
/** 
 * Returns number of slots which available for selection.
 * @param slot_cnt Buffer for number of slots.
 * @return JSR177_STATUSCODE_OK if all done successfuly, JSR177_STATUSCODE_FAIL otherwise
 */
JSR177_STATUSCODE jsr177_get_slot_count(jint *slot_cnt) {
    int s_cnt;
    javacall_result result = javacall_carddevice_get_slot_count(&s_cnt);
    switch (result) {
    case JAVACALL_OK:
        *slot_cnt = s_cnt;
        return JSR177_STATUSCODE_OK;
    case JAVACALL_FAIL:
    default:
        return JSR177_STATUSCODE_FAIL;
    }
}
Exemplo n.º 2
0
/**
 * Gets number of slots on a device. 
 * <p>Java declaration:
 * <pre>
 * private native int getSlotCount0();
 * </pre>
 * @return Number of slots on a device. In case of error
 * returns 0.
 */
KNIEXPORT KNI_RETURNTYPE_INT 
KNIDECL(com_sun_cardreader_PlatformCardDevice_getSlotCount0) {
    jint retcode;
    javacall_int32 num;
    if (javacall_carddevice_get_slot_count(&num) == JAVACALL_OK) {
        if (num > 0) {
            retcode = num;
        } else {
            retcode = 0;
        }
    } else {
        retcode = 0;
    }
    KNI_ReturnInt(retcode);
}