/** * Duplicate the SMS message structure by creating a new message and populating * its fields with the data from the source message. * * @param message The source message. * * @return The new message (A clone of the source message), or * <code>NULL</code> if the source message was <code>NULL</code>. */ SmsMessage* jsr120_sms_dup_msg(SmsMessage* sms) { if (sms == NULL) { return NULL; } return jsr120_sms_new_msg(sms->encodingType, sms->msgAddr, sms->sourcePortNum, sms->destPortNum, sms->timeStamp, sms->msgLen, sms->msgBuffer); }
/** * After calling setSMSListeningPort(), a WMA Application will continue to listen for * incoming messages whose destination port number matches the registered port number. * this callback function will be called by platform once an incoming message is ready. * If the incoming message contains more than one protocol (PDU) segments, target device * native layer should concatenate all segments into a completed message and forward to MIDP WMA. * Platform should allocate the msgBuffer and put whole incoming message contents into this buffer. * * @param msgType The encoding type of the incoming message * (GSM 7-bit alphabet, Unicode or 8-bit Binary) * @param sourceAddress The senders address. NULL terminated string. * @param msgBuffer The incoming message body. * @param msgLen The length of the incoming message body. * @param sourcePortNum source port number of the incoming message * @param destPortNum The destination port number of the incoming message.[unsigned short] * @param timeStamp When the message is received (SCT: message Service Center Time)[long]. */ void jsr120_notify_incoming_sms(jchar msgType, char *sourceAddress, unsigned char *msgBuffer, jint msgLen, jchar sourcePortNum, jchar destPortNum, jlong timeStamp) { if (WMA_OK == jsr120_sms_is_message_expected(destPortNum, sourceAddress)) { SmsMessage* sms = jsr120_sms_new_msg( msgType, (unsigned char*)sourceAddress, sourcePortNum, destPortNum, timeStamp, msgLen, msgBuffer); jsr120_sms_pool_add_msg(sms); /* Notify all listeners of the new message. */ jsr120_sms_message_arrival_notifier(sms); } }
/** * callback that needs to be called by platform to handover an incoming SMS intended for Java * * After this function is called, the SMS message should be removed from platform inbox * * @param msgType JAVACALL_SMS_MSG_TYPE_ASCII, or JAVACALL_SMS_MSG_TYPE_BINARY or JAVACALL_SMS_MSG_TYPE_UNICODE_UCS2 1002 * @param sourceAddress the source SMS address for the message. The format of the address parameter * is expected to be compliant with MSIDN, for example,. +123456789 * @param msgBuffer payload of incoming sms * if msgType is JAVACALL_SMS_MSG_TYPE_ASCII then this is a * pointer to char* ASCII string. * if msgType is JAVACALL_SMS_MSG_TYPE_UNICODE_UCS2, then this * is a pointer to javacall_utf16 UCS-2 string. * if msgType is JAVACALL_SMS_MSG_TYPE_BINARY, then this is a * pointer to binary octet buffer. * @param msgBufferLen payload len of incoming sms * @param sourcePortNum the port number that the message originated from * @param destPortNum the port number that the message was sent to * @param timeStamp SMS service center timestamp */ void javanotify_incoming_sms(javacall_sms_encoding msgType, char *sourceAddress, unsigned char *msgBuffer, int msgBufferLen, unsigned short sourcePortNum, unsigned short destPortNum, javacall_int64 timeStamp) { midp_jc_event_union e; SmsMessage* sms; e.eventType = MIDP_JC_EVENT_SMS_INCOMING; sms = jsr120_sms_new_msg( msgType, sourceAddress, sourcePortNum, destPortNum, timeStamp, msgBufferLen, msgBuffer); e.data.smsIncomingEvent.stub = (int)sms; midp_jc_event_send(&e); return; }