Motorola E680 Technical Manual - Page 57

Getting of address

Page 57 highlights

14 JSR 120 - Wireless Messaging API Getting of payload data of received binary message: BinaryMessage binMsg; byte[] payloadData = binMsg.getPayloadData(); Setting of address with port number: message.setAddress("sms://+18473297274:9532"); Setting of address without port number: message.setAddress("sms://+18473297274"); Sending of message: messageConnection.send(message); Receiving of message: Message receivedMessage = messageConnection.receive(); Getting of address: String address = ((TextMessage)message).getAddress(); Getting of timestamp for the message: Message message; System.out.println("Timestamp: " + message.getTimestamp().getTime()); Creation of client connection, creation of binary message, setting of payload for binary message and calling of method 'numberOfSegments(Message)' 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.BINAR Y_MESSAGE); /* Create BINARY of 'size' bytes for BinaryMsg */ public byte[] createBinary(int size) { int nextByte = 0; 57

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107

14
JSR 120 – Wireless Messaging API
57
Getting of payload data of received binary message:
BinaryMessage binMsg;
byte[] payloadData = binMsg.getPayloadData();
Setting of address with port number:
message.setAddress("sms://+18473297274:9532");
Setting of address without port number:
message.setAddress("sms://+18473297274");
Sending of message:
messageConnection.send(message);
Receiving of message:
Message receivedMessage = messageConnection.receive();
Getting of address:
String address = ((TextMessage)message).getAddress();
Getting of timestamp for the message:
Message message;
System.out.println("Timestamp: " +
message.getTimestamp().getTime());
Creation of client connection, creation of binary message, setting of payload for
binary message and
calling of method ‘numberOfSegments(Message)’ 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.BINAR
Y_MESSAGE);
/* Create BINARY of 'size' bytes for BinaryMsg */
public byte[] createBinary(int size) {
int nextByte = 0;