1 package ubc.midp.mobilephoto.sms;
2
3
4 /**
5 * Prompts for text and sends it via an SMS MessageConnection
6 */
7 public class SmsSenderThread implements Runnable { //extends BaseThread {
8
9 private String smsPort;
10 /** The URL to send the message to */
11 private String destinationAddress;
12 private String messageText = "default";
13 private byte[] binData;
14
15
16 public SmsSenderThread(String smsPort, String destinationAddress, String messageText) {
17
18 System.out.println("SmsSenderThread:: 3 Param Constructor: " + smsPort + "," + destinationAddress + "," + messageText);
19 this.messageText = messageText;
20 this.destinationAddress = destinationAddress;
21 this.smsPort = smsPort;
22 }
23
24 /**
25 * Send the message. Called on a separate thread so we don't have
26 * contention for the display
27 */
28 public void run() {
29
30 System.out.println("SmsSenderThread::run: Sending message: " + messageText + " to: " + destinationAddress);
31 SmsMessaging smsMessenger = new SmsMessaging(smsPort, destinationAddress);
32 smsMessenger.sendImage(this.binData);
33 System.out.println("Finishing SMSSender run()");
34 }
35
36 /**
37 * @return Returns the messageText.
38 */
39 public String getMessageText() {
40
41 return messageText;
42 }
43 /**
44 * @param messageText The messageText to set.
45 */
46 public void setMessageText(String messageText) {
47
48 this.messageText = messageText;
49 }
50
51 public void setBinaryData(byte[] data) {
52
53 System.out.println("SmsSenderThread: setBinaryData of length: " + data.length);
54 this.binData = data;
55 }
56
57 /**
58 * @return Returns the smsPort.
59 */
60 public String getSmsPort() {
61
62 return smsPort;
63 }
64 /**
65 * @param smsPort The smsPort to set.
66 */
67 public void setSmsPort(String smsPort) {
68
69 this.smsPort = smsPort;
70 }
71 }
|