void initializeWMASupport() { int vmArgc=0; // char *vmArgv[3]; /* CLDC parameters */ LimeFunction *initWMA = NULL; char* resultBytes = NULL; int resultLen = 0; initWMA = NewLimeFunction(WMA_CLIENT_PACKAGE, "WMAClientBridge", "initializeWMASupport"); initWMA->call(initWMA, &resultBytes, &resultLen); if (resultLen < 3) { /* it's too small to be a valid response */ } else { char* resultStr = NULL; char* clientTrafficPort = NULL; char* serverTrafficPort = NULL; char* phoneNum = NULL; char* newlinePtr = NULL; char* keyPtr = NULL; char* valuePtr = NULL; /* make the result null-terminated */ resultStr = (char*)malloc(resultLen + 1); resultStr[resultLen] = '\0'; memcpy(resultStr, resultBytes, resultLen); /* break up the result string into its 3 pieces */ newlinePtr = strrchr(resultStr, '\n'); phoneNum = newlinePtr + 1; *newlinePtr = '\0'; newlinePtr = strrchr(resultStr, '\n'); serverTrafficPort = newlinePtr + 1; *newlinePtr = '\0'; clientTrafficPort = resultStr; smsInPortNumber = atoi(clientTrafficPort); smsOutPortNumber = atoi(serverTrafficPort); devicePhoneNumber = strdup(phoneNum); javacall_set_property("com.sun.midp.io.j2me.sms.PhoneNumber", devicePhoneNumber, JAVACALL_TRUE, JAVACALL_APPLICATION_PROPERTY); free(resultStr); } DeleteLimeFunction(initWMA); }
/** * Initializes the configuration sub-system. * * @return <tt>0</tt> for success, otherwise a non-zero value */ int initializeConfig(void) { int i; if (JAVACALL_OK != javacall_initialize_configurations()) { return -1; } /* Add the full set of properties to JavaCall property database */ for (i = 0; NULL != midp_internalKey[i]; i++) { javacall_set_property(midp_internalKey[i], midp_internalValue[i], 1, JAVACALL_INTERNAL_PROPERTY); } for (i = 0; NULL != midp_systemKey[i]; i++) { javacall_set_property(midp_systemKey[i], midp_systemValue[i], 1, JAVACALL_APPLICATION_PROPERTY); } return 0; }
/** * Sets a property key to the specified value in the application * property set. * * @param key The key to set * @param value The value to set <tt>key</tt> to */ void setSystemProperty(const char* key , const char* value) { javacall_set_property(key, value, KNI_TRUE, JAVACALL_APPLICATION_PROPERTY); }
/** * Sets a property key to the specified value in the internal * property set. * * @param key The key to set * @param value The value to set <tt>key</tt> to */ void setInternalProperty(const char* key , const char* value) { javacall_set_property(key, value, KNI_TRUE, JAVACALL_INTERNAL_PROPERTY); }