Ejemplo n.º 1
0
/**
 * Starts a new process to handle the given URL. The new process executes
 * the value of the <tt>com.sun.midp.midlet.platformRequestCommand</tt>
 * system property. The URL is passed as this process' sole command-line
 * argument.
 *
 * @param pszUrl The 'C' string URL
 *
 * @return true if the platform request is configured
 */
int platformRequest(char* pszUrl) {
    (void)pszUrl;
#if 0
    char *execargs[3];
    STARTUPINFO si;
    PROCESS_INFORMATION pi;

    if (strlen(pszUrl) == 0) {
        /*
         * This is a request to cancel. Since a process was already spawned
         * to handle the previous URL, it too late.
         */
        return 1;
    }

    execargs[0] = (char *)getInternalProp(PLATFORM_REQUEST_KEY);
    if (execargs[0] == NULL) {
        REPORT_WARN(LC_AMS, "PlatformRequest is not configured.");
	return 0;
    }

    execargs[1] = pszUrl;
    /* leave room for a space and zero terminator */
    execargs[2] = (char*)midpMalloc(strlen(execargs[0]) +
                     strlen(execargs[1]) + 2);
    if (execargs[2] == NULL) {
        REPORT_WARN(LC_AMS, "PlatformRequest ran out of memory.");
	return 0;
    }

    strcpy(execargs[2], execargs[0]);
    strcat(execargs[2], " ");
    strcat(execargs[2], execargs[1]);

    memset(&si, 0, sizeof(si));
    si.cb = sizeof(si);

    // spawn the request using the configured URL handler and URL parameter
    /*
     * do not inherit handles
     */
    if (CreateProcess(NULL, execargs[2], NULL, NULL, FALSE, 0,
	NULL, NULL, &si, &pi)) {
        CloseHandle(pi.hProcess);
	CloseHandle(pi.hThread);
    } else {
        REPORT_WARN(LC_AMS, "Spawning a handler process failed. Check the platformRequest configuration. ");
    }

    midpFree(execargs[2]);
#endif
    return 1;
}
Ejemplo n.º 2
0
/**
 * Finds push entries that belong to the given suite. If the available
 * flag is set, return only those entries with live connections (socket)
 * or cached incoming data.
 *
 * @param store The storagename of the suite
 * @param available If set, return only "live" push entries
 *
 * @return A comma delimited list of full-text push entries
 */
char* pushfindsuite(char* store, int available) {
    /* need revisit */
    REPORT_WARN(LC_PUSH, "pushfindsuite: Stubbed out.");
    (void)store;
    (void)available;
    return NULL;
}
Ejemplo n.º 3
0
/**
 * Given the connection string and port number, look up the
 * push entry and return its filter.
 *
 * @param conn the connection string
 * @param port the port number to match
 * @return the filter from the registry
 */
char* pushgetfilter(char* conn, int port) {
    /* need revisit */
    REPORT_WARN(LC_PUSH, "pushgetfilter: Stubbed out.");
    (void)conn;
    (void)port;
    return NULL;
}
Ejemplo n.º 4
0
/**
 * Given the connection string and application ID, look up the
 * push entry and return its filter.
 *
 * @param conn the connection string
 * @param appID The MMS application ID to match
 * @return the filter from the registry
 */
char* pushgetfiltermms(char *conn, char *appID) {
    /* need revisit */
    REPORT_WARN(LC_PUSH, "pushgetfiltermms: Stubbed out.");
    (void)conn;
    (void)appID;
    return NULL;
}
Ejemplo n.º 5
0
/**
 * Removes one entry from the push registry.
 * If the entry is not registered return an error.
 * On successful deletion, write a new copy of the file to disk.
 *
 * @param str The push entry string to be deleted
 * @param store The MIDletSuite storagename
 * @return <tt>0</tt> if successful, <tt>-2</tt> if the entry belongs
 *         to another suite.
 */
int pushdel(char *str, char *store) {
    /* need revisit */
    REPORT_WARN(LC_PUSH, "pushdel: Stubbed out.");
    (void)str;
    (void)store;
    return 0;
}
Ejemplo n.º 6
0
/**
 * Platform handling code for turning off or on
 * indicators for signed MIDlet.
 *
 * @todo Currently indicator does nothing for Java
 * and platform widget modules as we are waiting for
 * UI input.
 */
void anc_show_trusted_indicator(jboolean isTrusted) {
    REPORT_WARN(LC_LOWUI, "anc_show_trusted_indicator: Stubbed out.");
    /* @todo implement security indicator and remove
     * the temporary workaround for warning removal.
     */
    (void)isTrusted;
}
Ejemplo n.º 7
0
void configurePort(char** ppszError, int hPort, long baudRate,
                          unsigned long options) {
    (void)ppszError;
    (void)hPort;
    (void)baudRate;
    (void)options;
    REPORT_WARN(LC_PROTOCOL, "serial_port:configurePort: Stubbed out.");
}
Ejemplo n.º 8
0
long writeToPort(char** ppszError, long hPort, char* pBuffer,
                 long nNumberOfBytesToWrite) {
    (void)ppszError;
    (void)hPort;
    (void)pBuffer;
    (void)nNumberOfBytesToWrite;
    REPORT_WARN(LC_PROTOCOL, "serial_port:writeToPort: Stubbed out.");
}
Ejemplo n.º 9
0
long readFromPort(char** ppszError, long hPort, char* pBuffer,
                 long nNumberOfBytesToRead) {
    (void)ppszError;
    (void)hPort;
    (void)pBuffer;
    (void)nNumberOfBytesToRead;
    REPORT_WARN(LC_PROTOCOL, "serial_port:readFromPort: Stubbed out.");
}
Ejemplo n.º 10
0
long openPortByNumber(char** ppszError, long port, long baudRate,
                      long options) {
    (void)ppszError;
    (void)port;
    (void)baudRate;
    (void)options;
    REPORT_WARN(LC_PROTOCOL, "serial_port:openPortByNumber: Stubbed out.");
}
Ejemplo n.º 11
0
/**
 * Adds one entry to the alarm registry.
 * If the entry already exists, return previous alarm time.
 * On succesful registration, write a new copy of the file to disk.
 *
 * @param str The alarm entry to add
 * @param alarm The absolute time at which this alarm is fired
 * @param lastalarm The place to return the previous alarm time, if it exists
 *
 * @return <tt>0</tt> if successful, <tt>-2</tt> if there was an error
 *         allocating this alarm.
 */
int alarmadd(char* str, jlong alarm, jlong* lastalarm){
    /* need revisit */
    REPORT_WARN(LC_PUSH, "alarmadd: Stubbed out.");
    (void)str;
    (void)alarm;
    (void)lastalarm;
    return -2;
}
Ejemplo n.º 12
0
/**
 * Checks out the handle for the requested connection.
 * The CHECKED_OUT token
 * is left in the registry to indicate that an application is
 * actively using the connection.
 *
 * @param protocol The protocol of the connection
 * @param port The port number of the connection
 * @param store The storage name of the requesting Suite
 *
 * @return <tt>-1</tt> if the connection is not found, other wise returns
 * the previously opened file descriptor.
 */
int pushcheckout(char* protocol, int port, char* store) {
    /* need revisit */
    REPORT_WARN(LC_PUSH, "pushcheckout: Stubbed out.");
    (void)protocol;
    (void)port;
    (void)store;
    return -1;
}
Ejemplo n.º 13
0
int
createTimerHandle(int alarmHandle, jlong time) {
    /* alarmHandle is really an address to push entry */
    REPORT_WARN(LC_PUSH, "createTimerHandle: Stubbed out.");
    (void)alarmHandle;
    (void)time;
    return -1;
}
Ejemplo n.º 14
0
/**
 * starts another native thread.
 * The primary usage of this function is testing of NAMS subsystem 
 * - second thread is used to throw initial events to main application thread.
 *
 * ATTENTION: this is a stub ! 
 * Put real plarform specific thread start here if needed !
 * If platfoprm specific thread routine signature differs from 
 * "midp_ThreadRoutine", use platform speficic thread routine as a wrapper 
 * to prepare parameters for "midp_ThreadRoutine" and to call it ...
 *
 * @param thread thread routine
 * @param param thread routine parameter
 *
 * @return handle of created thread
 */
midp_ThreadId midp_startNativeThread(midp_ThreadRoutine thread, 
    midp_ThreadRoutineParameter param) {

    (void)thread;
    (void)param;
    REPORT_WARN(LC_AMS, "midp_startNativeThread: Stubbed out."); 
    return MIDP_INVALID_NATIVE_THREAD_ID;
}
Ejemplo n.º 15
0
long openPortByName(char** ppszError, char* pszDeviceName, long baudRate,
                    long  options) {
    (void)ppszError;
    (void)pszDeviceName;
    (void)baudRate;
    (void)options;
    REPORT_WARN(LC_PROTOCOL, "serial_port:openPortByName: Stubbed out.");
    return 0;
}
Ejemplo n.º 16
0
static MidpProperties verifyMfMustProperties(MidpProperties mfsmp) {

    /* MUST fields in MANIFEST */
    /* pcsl_string MIDlet-<n> for each MIDlet */
    pcsl_string * midlet_1;
    pcsl_string * name;
    pcsl_string * version;
    pcsl_string * vendor;
    pcsl_string * profile;
    pcsl_string * configuration;

    name = midp_find_property(&mfsmp, &SUITE_NAME_PROP);
    if (pcsl_string_is_null(name)) {
        REPORT_WARN(LC_AMS, "Missing suite name");
        mfsmp.status = NO_SUITE_NAME_PROP;
        return mfsmp;
    }

    vendor = midp_find_property(&mfsmp, &SUITE_VENDOR_PROP);
    if (pcsl_string_is_null(vendor)) {
        REPORT_WARN(LC_AMS, "Missing suite vendor");
        mfsmp.status = NO_SUITE_VENDOR_PROP;
        return mfsmp;
    }

    version = midp_find_property(&mfsmp, &SUITE_VERSION_PROP);
    if (pcsl_string_is_null(version)) {
        REPORT_WARN(LC_AMS, "Missing suite version");
        mfsmp.status = NO_SUITE_VERSION_PROP;
        return mfsmp;
    }
    if (!midpCheckVersion(version)) {
        REPORT_WARN(LC_AMS, "Corrupted suite version");
        mfsmp.status = BAD_SUITE_VERSION_PROP;
        return mfsmp;
    }

    profile = midp_find_property(&mfsmp, &MICROEDITION_PROFILE_PROP);
    if (pcsl_string_is_null(profile)) {
        REPORT_WARN(LC_AMS, "Missing Midp-Profile");
        mfsmp.status = NO_MICROEDITION_PROFILE_PROP;
        return mfsmp;
    }

    configuration = midp_find_property(&mfsmp, &MICROEDITION_CONFIGURATION_PROP);
    if (pcsl_string_is_null(configuration)) {
        REPORT_WARN(LC_AMS, "Missing Midp-Configuration");
        mfsmp.status = NO_MICROEDITION_CONFIGURATION_PROP;
        return mfsmp;
    }

    midlet_1 = midp_find_property(&mfsmp, &MIDLET_ONE_PROP);
    if (pcsl_string_is_null(midlet_1)) {
        REPORT_WARN(LC_AMS, "Missing Midlet-1");
        mfsmp.status = NO_MIDLET_ONE_PROP;
        return mfsmp;
    }
    return mfsmp;
} /* verifyMfMustProperties */
Ejemplo n.º 17
0
/**
 *  Fetch the datagram data into a buffer.
 *
 * @param fd The handle of the datagram port
 * @param ip The ip address of the incoming datagram
 * @param sndport The port from which the data was sent
 * @param buf A pointer to a buffer into which the data should be copied
 * @param len The size of buf
 * @return the length of the datagram data if successful, or <tt>-1</tt>
 *         unsuccessful.
 */
int pusheddatagram (int fd, int *ip, int *sndport, char *buf, int len) {
    /* need revisit */
    REPORT_WARN(LC_PUSH, "pusheddatagram : Stubbed out.");
    (void)fd;
    (void)ip;
    (void)sndport;
    (void)buf;
    (void)len;
    return -1;
}
Ejemplo n.º 18
0
/**
 * Return local timezone ID string. This string is maintained by this 
 * function internally. Caller must NOT try to free it.
 *
 * This function should handle daylight saving time properly. For example,
 * for time zone America/Los_Angeles, during summer time, this function
 * should return GMT-07:00 and GMT-08:00 during winter time.
 *
 * @return Local timezone ID string pointer. The ID string should be in the
 *         format of GMT+/-??:??. For example, GMT-08:00 for PST.
 */
char* getLocalTimeZone() {
    static char tz[12]; /* No longer than "GMT-10:00" */

    REPORT_WARN(LC_CORE, "getLocalTimeZone: Stubbed out."); 
    // Replace the zero with a system function that will return GMT offset
    
    /* UTC time is converted to local time */
    sprintf(tz, "GMT%+03d:00", 0);

    return tz;
}
Ejemplo n.º 19
0
/**
 * Adds one entry to the push registry.
 * If the entry already exists return IO_ERROR_LEN (midpString.h).
 *
 * @param suiteId ID of the suite
 * @param connection generic connection name (no spaces)
 * @param midlet class name of the MIDlet (no spaces)
 * @param filter filter string (no spaces)
 *
 * @return 0 for success, OUT_OF_MEM_LEN for out of memory,
 * IO_ERROR_LEN if already registered
 */
int midpAddPushEntry(SuiteIdType suiteId,
                     const pcsl_string * connection,
                     const pcsl_string * midlet,
                     const pcsl_string * filter) {
    /* need revisit */
    REPORT_WARN(LC_PUSH, "midpAddPushEntry: Stubbed out.");
    (void)suiteId;
    (void)connection;
    (void)midlet;
    (void)filter;
    return 0;
}
Ejemplo n.º 20
0
/**
 * Log the native thread ID for debugging on multi-thread platforms.
 *
 * @param message message to prefix the thread ID
 */
void midp_logThreadId(char* message) {
#if REPORT_LEVEL <= LOG_INFORMATION
    char temp[80];

    REPORT_WARN(LC_EVENTS, "midp_logThreadId: Stubbed out.");
    //put code here to get the thread id

    sprintf(temp, "%s: ThreadID = %d\n", message,
            (int)midp_getCurrentThreadId());
    REPORT_INFO(LC_EVENTS, temp);
#else
    (void)message; // avoid a compiler warning
#endif

}
/**
 * Starts a new process to handle the given URL. The new process executes
 * the value of the <tt>com.sun.midp.midlet.platformRequestCommand</tt>
 * system property. The URL is passed as this process' sole command-line
 * argument.
 *
 * @param pszUrl The 'C' string URL
 *
 * @return true if the platform request is configured
 */
int platformRequest(char* pszUrl) {
    char *execargs[3];

    if (strlen(pszUrl) == 0) {
        /*
         * This is a request to cancel. Since a process was already spawned
         * to handle the previous URL, it too late.
         */
        return 1;
    }

    execargs[0] = (char *)getInternalProperty(PLATFORM_REQUEST_KEY);
    if (execargs[0] == NULL) {
        REPORT_WARN(LC_AMS, "PlatformRequest is not configured.");
	return 0;
    }

    execargs[1] = pszUrl;
    execargs[2] = NULL;

    REPORT_WARN(LC_AMS, "PlatformRequest: stubbed out.");
    // spawn the request using the configured URL handler and URL parameter
    return 1;
}
/**
 * Load Java ImageData instance with image data in RAW format.
 * Image data is provided in native buffer.
 *
 * @param imageData Java ImageData object to be loaded with image data
 * @param buffer pointer to native buffer with raw image data
 * @param length length of the raw image data in the buffer
 *
 * @return KNI_TRUE in the case ImageData is successfully loaded with
 *    raw image data, otherwise KNI_FALSE.
 */
int img_load_imagedata_from_raw_buffer(KNIDECLARGS jobject imageData,
    unsigned char *buffer, int length) {

    int status = KNI_FALSE;
    int imgWidth;
    int imgHeight;

    img_native_error_codes creationError = IMG_NATIVE_IMAGE_NO_ERROR;

    /* pointer to native image structure */
    gxpport_image_native_handle newImagePtr;

    /*
     * Do the decoding of the png in the buffer and initialize
     * class variables.
     */
    gxpport_loadimmutable_from_platformbuffer(buffer, length, KNI_FALSE,
						                      &imgWidth, &imgHeight,
						                      &newImagePtr,
						                      &creationError);

    if (IMG_NATIVE_IMAGE_NO_ERROR == creationError) {
        java_imagedata *dstImageDataPtr = IMGAPI_GET_IMAGEDATA_PTR(imageData);

        dstImageDataPtr->width   = (jint)imgWidth;
        dstImageDataPtr->height  = (jint)imgHeight;
        dstImageDataPtr->nativeImageData  = (jint)newImagePtr;
        status = KNI_TRUE;        
	} else if (IMG_NATIVE_IMAGE_OUT_OF_MEMORY_ERROR == creationError) {
        KNI_ThrowNew(midpOutOfMemoryError, NULL);        
    } else if (IMG_NATIVE_IMAGE_RESOURCE_LIMIT == creationError) {
        KNI_ThrowNew(midpOutOfMemoryError,
                    "Resource limit exceeded for immutable image");
    } else {
        REPORT_WARN(LC_LOWUI,"Warning: could not load cached image;\n");        
    }
    return status;
}
Ejemplo n.º 23
0
KNIEXPORT KNI_RETURNTYPE_OBJECT
KNIDECL(com_sun_midp_chameleon_skins_resources_LoadedSkinData_readStringArray) {
    int arrayLength;
    int i;

    KNI_StartHandles(2);
    KNI_DeclareHandle(returnArray);
    KNI_DeclareHandle(stringHandle);

    do {
        /*
         * First, read array length
         */
        ENSURE_SKIN_DATA_AVAILABILITY(sizeof(jint));
        memcpy((void*)&arrayLength, (void*)gsSkinFileDataPos, sizeof(jint));
        gsSkinFileDataPos += sizeof(jint);


        /*
         * Then create array
         */
        SNI_NewArray(SNI_STRING_ARRAY, arrayLength, returnArray);
        if (KNI_IsNullHandle(returnArray)) {
            KNI_ThrowNew(midpOutOfMemoryError, NULL);
            break;
        }

        /*
         * And finally populate it with strings
         */
        for (i = 0; i < arrayLength; ++i) {
            unsigned char dataLength;
            unsigned char encoding;

            /* read data length */
            ENSURE_SKIN_DATA_AVAILABILITY(sizeof(char));
            dataLength = *((unsigned char*)gsSkinFileDataPos);
            gsSkinFileDataPos += 1;

            /* read encoding */
            ENSURE_SKIN_DATA_AVAILABILITY(sizeof(char));
            encoding = *((unsigned char*)gsSkinFileDataPos);
            gsSkinFileDataPos += 1;

            ENSURE_SKIN_DATA_AVAILABILITY(dataLength * sizeof(char));

            if (encoding == STRING_ENCODING_USASCII) {    
                int j;

                /* 
                 * In case of USASCII encoding, each byte of 
                 * string data corresponds to one string char
                 */
                int stringLength = dataLength;

                /* use gKNIBuffer for storing string chars */
                jchar* stringChars = (jchar*)gKNIBuffer;
                
                /* 
                 * Safety measure to prevent gKNIBuffer overflow 
                 * (which should never happens unless something is broken) 
                 */
                if (stringLength > (int)(KNI_BUFFER_SIZE/sizeof(jchar))) {
                    stringLength = (int)(KNI_BUFFER_SIZE/sizeof(jchar));
                    REPORT_WARN(LC_HIGHUI, 
                            "gKNIBuffer is too small for skin string");
                }

                /* fill string chars array */
                for (j = 0; j < stringLength; ++j) {
                    stringChars[j] = gsSkinFileDataPos[j];
                }

                /* and create string from it */
                KNI_NewString(stringChars, stringLength, stringHandle);
            } else if (encoding == STRING_ENCODING_UTF8) {
                KNI_NewStringUTF((char*)gsSkinFileDataPos, stringHandle);
            } else {
                KNI_ThrowNew(midpIllegalStateException, 
                        "Illegal skin string encoding");
                break;
            }
            
            KNI_SetObjectArrayElement(returnArray, i, stringHandle);

            gsSkinFileDataPos += dataLength;
        }

    } while (0);

    KNI_EndHandlesAndReturnObject(returnArray);
}
Ejemplo n.º 24
0
int
destroyTimerHandle(int timerHandle) {
    (void)timerHandle;
    REPORT_WARN(LC_PUSH, "createTimerHandle: Stubbed out.");
    return 0;
}
Ejemplo n.º 25
0
void freePortError(char* pszError) {
    (void)pszError;
    REPORT_WARN(LC_PROTOCOL, "serial_port:freePortError: Stubbed out.");
}
Ejemplo n.º 26
0
void closePort(long hPort) {
    (void)hPort;
    REPORT_WARN(LC_PROTOCOL, "serial_port:closePort: Stubbed out.");
}
/**
 * Porting implementation for network indicator.
 * It controls the LED as the network indicator, it
 * ONLY works on device. There is no equivalent in emulator.
 */
void anc_set_network_indicator(int counter) {
    REPORT_WARN(LC_LOWUI, "anc_set_network_indicator: Stubbed out."); 
    // Work around for compiler warning
    (void)counter;
}
Ejemplo n.º 28
0
/**
 * Turn Home indicator on or off.
 */ 
void anc_toggle_home_icon(jboolean isHomeOn) {
    REPORT_WARN(LC_LOWUI, "anc_toggle_home_icon: Stubbed out."); 
    (void)isHomeOn;
}
Ejemplo n.º 29
0
/**
 *  Turn on or off the backlight, or toggle it.
 *  The backlight will be turned on to the system configured level.
 *  This function is only valid if QT's COP and QWS is available.
 *
 *  @param mode if <code>mode</code> is:
 *              <code>ANC_BACKLIGHT_ON</code> - turn on the backlight  
 *              <code>ANC_BACKLIGHT_OFF</code> - turn off the backlight  
 *              <code>ANC_BACKLIGHT_TOGGLE</code> - toggle the backlight
 *              <code>ANC_BACKLIGHT_SUPPORTED<code> - do nothing  
 *              (this is used to determine if backlight control is 
 *              supported on a system without  changing the state of 
 *              the backlight.)
 *  @return <code>KNI_TRUE</code> if the system supports backlight 
 *              control, or <code>KNI_FALSE</code> otherwise.
 */
jboolean anc_show_backlight(AncBacklightState mode) {
    REPORT_WARN(LC_LOWUI, "anc_show_backlight: Stubbed out."); 
    (void)mode;
    return KNI_FALSE;
}
Ejemplo n.º 30
0
/**
 * Porting implementation for network indicator.
 * It controls the LED as the network indicator, it
 * ONLY works on device. There is no equivalent in emulator.
 */
void anc_set_network_indicator(AncNetworkIndicatorState status) {
    REPORT_WARN(LC_LOWUI, "anc_set_network_indicator: Stubbed out."); 
    // Work around for compiler warning
    (void)status;
}