SmsSpammer Class Reference
List of all members.
Member Function Documentation
| void SmsSpammer::commandAction |
( |
Command |
c, |
|
|
Displayable |
s | |
|
) |
| | [inline] |
00041 {
00042 if (c.getCommandType() == Command.EXIT){
00043 notifyDestroyed();
00044 }
00045 if (c == submit){
00046 String phone = t1.getString();
00047 String number = t2.getString();
00048 String message = t3.getString();
00049 int i = Integer.parseInt(number);
00050 int cnt = 0;
00051 while (cnt < i){
00052 this.sendSms(phone, message);
00053 cnt++;
00054 }
00055 }
00056 }
| void SmsSpammer::destroyApp |
( |
boolean |
unconditional |
) |
[inline] |
| void SmsSpammer::pauseApp |
( |
|
) |
[inline] |
| boolean SmsSpammer::sendSms |
( |
String |
number, |
|
|
String |
message | |
|
) |
| | [inline] |
00058 {
00059 boolean result = true;
00060 try {
00061
00062 String addr = "sms://"+number;
00063
00064 MessageConnection conn = (MessageConnection) Connector.open(addr);
00065
00066 TextMessage msg =
00067 (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
00068
00069 msg.setPayloadText(message);
00070
00071 conn.send(msg);
00072 conn.close();
00073 } catch (SecurityException se) {
00074
00075
00076 result = false;
00077 } catch (Exception e) {
00078 result = false;
00079 }
00080 return result;
00081 }
| void SmsSpammer::startApp |
( |
|
) |
[inline] |
00014 {
00015 Display display = Display.getDisplay(this);
00016
00017 t1 = new TextField("Numer to send:", "",30, TextField.PHONENUMBER);
00018 t2 = new TextField("Number of sms:", "",4, TextField.NUMERIC);
00019 t3 = new TextField("Message text:", "",30, TextField.ANY);
00020 submit = new Command("Submit", Command.OK, 1);
00021
00022 Form mainForm = new Form("TinyMIDlet");
00023 mainForm.append("Welcome to the SmsSpammer!");
00024
00025 mainForm.append(t1);
00026 mainForm.append(t2);
00027 mainForm.append(t3);
00028
00029 Command exitCommand = new Command("Exit", Command.EXIT, 0);
00030 mainForm.addCommand(submit);
00031 mainForm.addCommand(exitCommand);
00032 mainForm.setCommandListener(this);
00033
00034 display.setCurrent(mainForm);
00035 }
Member Data Documentation
The documentation for this class was generated from the following file: