Motorola MOTORAZR maxx V6 Developer's Manual page 69

Java me developer guide
Hide thumbs Also See for MOTORAZR maxx V6:
Table of Contents

Advertisement

Java ME Developer Guide
Chapter 9 - JSR-120 - Wireless Messaging API
Creation of client connection, creation of binary message, setting of
payload for binary message and calling of method 'numberOfSegments' for
Binary message:
BinaryMessage binMsg;
MessageConnection connClient;
int MsgLength = 140;
/* Create connection for client mode */
connClient = (MessageConnection) Connector.open("sms://" + outAddr);
/* Create BinaryMessage for client mode */
binMsg = (BinaryMessage)connClient.newMessage(MessageConnection. BIN-
ARY_MESSAGE);
/* Create BINARY of 'size' bytes for BinaryMsg */
public byte[] createBinary(int size) {
int nextByte = 0;
byte[] newBin = new byte[size];
for (int i = 0; i < size; i++) {
nextByte = (rand.nextInt());
newBin[i] = (byte)nextByte;
if ((size > 4) && (i == size / 2)) {
}
}
return newBin;
}
byte[] newBin = createBinary(msgLength);
binMsg.setPayloadData(newBin);
int num = connClient.numberOfSegments(binMsg);
Creation of server connection:
MessageConnection messageConnection =
(MessageConnection)Connector.open("sms://:9532");
Creation of client connection with port number:
MessageConnection messageConnection = (MessageConnection)
Connector.open("sms://+18473297274:9532");
DRAFT - Subject to Change
newBin[i-1] = 0x1b;
newBin[i] = 0x7f;
[69/201]

Advertisement

Table of Contents
loading

Table of Contents