コード例 #1
0
ファイル: smsProtocol_javacall.c プロジェクト: sfsy1989/j2me
/**
 * Returns the number of segments that would be needed in the underlying
 * protocol to send a specified message. The specified message is included as a
 * parameter of this function. Note that this method does not actually send the
 * message. It will only calculate the number of protocol segments needed for
 * sending the message.
 *
 * @param msgBuffer The message body.
 * @param msgLen Message body length (in bytes).
 * @param msgType Message type: Binary or Text.
 * @param hasPort indicates if the message includes source or destination port number.
 * @param numSegments The number of message segments that would be required to send the
 *                    message is returned here.
 *
 * @return Returns <code>WMA_OK</code> when successful;
 *      <code>WMA_ERR</code> on error.
 */
WMA_STATUS jsr120_number_of_sms_segments(unsigned char msgBuffer[], jint msgLen, jint msgType,
                                            jboolean hasPort, /* OUT */jint *numSegments) {

    *numSegments = javacall_sms_get_number_of_segments(
            msgType,
            (char*)msgBuffer,
            msgLen,
            (hasPort == JAVACALL_TRUE) ? 11111: 0); /* Need revisit: have to be port number */
    return (*numSegments) ? WMA_OK : WMA_ERR ;
}
コード例 #2
0
/**
 * Returns the number of segments that would be needed in the underlying
 * protocol to send a specified message. The specified message is included as a
 * parameter of this function. Note that this method does not actually send the
 * message. It will only calculate the number of protocol segments needed for
 * sending the message.
 *
 * @param msgBuffer The message body.
 * @param msgLen Message body length (in bytes).
 * @param msgType Message type: Binary or Text.
 * @param hasPort indicates if the message includes source or destination port number.
 * @param numSegments The number of message segments that would be required to send the
 *                    message is returned here.
 *
 * @return Returns <code>WMA_OK</code> when successful;
 *      <code>WMA_ERR</code> on error.
 */
WMA_STATUS jsr120_number_of_sms_segments(unsigned char msgBuffer[], jint msgLen, jint msgType,
                                            jboolean hasPort, /* OUT */jint *numSegments) {

    *numSegments = javacall_sms_get_number_of_segments(
            msgType,
            (char*)msgBuffer,
            msgLen,
            hasPort);
    return (*numSegments) ? WMA_OK : WMA_ERR ;
}