tracy teo

Greenhorn
+ Follow
since Aug 24, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by tracy teo

Hi.. how can i convert a byte array to a string and display the string on the screen.. if possible can provide me with the code.Thanks
18 years ago
Hi I have added a few phone number into the RMS but how can I get a list of all the numbers that I have stored inside? The number stored in RMS is in bytes, so I have to convert them back to string in order to view them.. Can anyone help me.. thanks alots..
18 years ago
sms
hi.. I also need help in the delete record part..
Currently, my delete record subroutine can only delete record 2 because my recordID, I have set to 2.. What can I do, (example: I will send the recordID to be deleted by sms and upon receiving the sms, it will delete according to the recordID that I have sent) May I know how i do it?
thanks
18 years ago
sms
HI thanks for your reply.. I have tried it out and it is working thanks..
Now I need your help in RMS.. Example, I will send a sms to get a list of record in the RMS and they will reply me the list of records that are stored in the RMS to my cellphone. records in RMS are stored as bytes but when it reply me , it have to change the bytes into String before it can send to me for reading.

below is my source code :




so if possible, can you provide me with the list record source code or help. Thanks
18 years ago
sms
Hi.. I am having a problem here. After the client sent a sms to the server, the server will receive the sms and compare the text sent. If the text received is 'addrecord', it will go into a sub routine called addrecord and if it receive the text is 'deleterecord', it will go into the deleterecord sub routine.. but now, after I have received the sms, i can go into the compare sub routine to compare?? why?

18 years ago
Morning.. Oh ok.. Is WATCHDOG API..It can be use to reboot the Nokia 12 module if the JAVA VM or IMlet fails to execute..Maybe I asked in the wrong way and make you ..Actually I read alots of materials regarding WATCHDOG API and also understand what they are used for but I'm not sure how to implement it into the program so if the IMlet fails to execute, the timeout value will count towards zero and the Nokia 12 module will reset. Therefore the watchdog timer must be placed in the application's main loop . This way it protects against Java VM and IMlet failures such as program deadlock. At the same time, have to set the timeout value at the start of the program. When the program start, the watchdog will start to count toward zero. When zero is reached, nokia 12 module will restart. Therefore what I'm supported to do is reset the timeout value after every run so it will not restart the nokia 12 and interrupt the program when it is running half way..

(1)The correct use of the watchdog timer requires that it be set using a feasible timeout value and refresged at the correct locations in the Java code.(2)Location of the watchdog timer in the code should be such that it ensures that the Nokaia 12 module restarts if the IMlet fails to d the tasks it was designed to do.

So do you have any solution for it? Thanks alot
18 years ago
HI For the solution that you have provided, is only part of it. I'm still not sure how to implement Watchdog into the source code

What I expected from the outcome:
When I start the program, the watchdog at the same time will start to down down 0..This is the code for starting the watchdog and setting the timeout value.




The maximum number of time I will send the sms to inform the owner is 5 times..After 5 times, if he still never reply the sms, Watchdog timeout will continue to count till 0 and restart the nokia12i. So what I wanted to know is that how to implement Watchdog into the source code? I'm still not very sure how to use Watchdog..Eg..you need to insert Watchdog halfway into your code to check whether the program is working properly right? But I'm not very sure like at where is the best place for you to insert the Watchdog into the code.. Do you get what I meant?
18 years ago
so can you provide me some solution after reading my problem.. Thanks alot
18 years ago



Sorry because I'm first time using it so not very sure. Is this the right way??
18 years ago
Hi thanks for your reply..I have went to the java.sun and looked at the code.. Yup quite a detail explaination .. Thanks..
18 years ago
public class sender extends MIDlet
{
public TextMessage txtMessage = null;
public MessageConnection smsconn = null;

public void send() {
try {

//Set the message text.
txtMessage.setPayloadText("Alarm trigger");
//Send the message.
smsconn.send(txtMessage);
log("Message sending completed");

} catch (Exception e) {}
}

//To start the MIDlet
protected void startApp () throws MIDletStateChangeException
{
//Start the timer
log("timer started");
WatchdogTimer wd = new WatchdogTimer();
//After start, count towards 0, nokia12 reset after reached 0
wd.setTimeout(30 * 60); // 30 minutes

//Set the correct target address
String targetAddress = "sms://+0180555555:5678";//send a sms to +0180555555 using port 5678
String targetAddress1 = "sms://+0123456789:5678";//send a sms to +0123456789 using port 5678
String url = "sms://:5678";
int counter = 0;

log("Send SMS Program");
try {
while (counter <= 4) {
//Open the message connection.
smsconn = (MessageConnection)Connector.open(url);
//Creating a text message to be send.
txtMessage = (TextMessage)smsconn.newMessage(MessageConnection.TEXT_MESSAGE);
txtMessage.setAddress(targetAddress);
send();
txtMessage.setAddress(targetAddress1);
send();
smsconn.close();
log("Go to reply message");
//replyMessage();
Thread.sleep(30000);
++counter;
}
log("sent 5 times");
//use watchdog to restart if there is no action taken by owner!!!
} catch(Exception e) {/* handle error */ }
}

//A required method
public void destroyApp (boolean unconditional) throws MIDletStateChangeException
{
}

//A required method
public void pauseApp () {}

private void log(String msg) {
SerialPortLogger.getInstance().write(msg);
}
}


Hi.. I'm adding a watchdog into my program.. Above is the program codes that I have written to send a sms.. I need a watchdog to reset everything if there is no reply message by the user after sending 5 times.. so what code shall I add in after the line [log("sent 5 times")] in order to restart after the watchdog count down to 0 And in between of the program when it is running,I need to check whether there is any error with the program and are they running in the right order..I believed that I can use watchdog to do all theses right..but I'm not sure at which interval I must insert the watchdog to make sure the program is running ok
And can also tell me how to write the code or is there any website where it will provide me a clear understanding on how to implement watchdog into the program..thanks
18 years ago
Hi.. I'm supported to write a rms codes where I can add record, delete record and check whether the record store is empty or not..First, when I start the program, it will go to the record store and check whether there is any record inside. If there is record inside, it will get out of the record store and run the main operation. However, if there is no record found, it will create a record store and add record inside. After adding the record, it will get out of the record store and go to the main operation. At anytime in between the main operation, I can go back to the record store and delete old record and add new record.


This is the RMS code that I have written:


I'm not very sure of the RMS setting and do you think this program code is oki and at the same time, can this program code work and give me the outcome that I have mentioned? Thanks hope someone can help mi

[ August 28, 2005: Message edited by: tracy teo ]
[ August 29, 2005: Message edited by: Mark Spritzler ]
18 years ago
yup thanz.. I knew what u meant.. I have tried it out and have managed to solved the problem.. thanz for all of ur reply..
18 years ago
Hello.. How do I send sms to more than 1 person at the same time? When the car was being stolen, the nokia 12i have to send sms to inform the owner and maybe his wife also. I have written the j2me codes but i can onli send to one number.

This is how i have wrote:
//define the individual phone number
String targetAddress = "sms://+18005555555:5678";
String targetAddress1 = "sms://+0123456789:5678";

//set the address to be send to
txtMessage.setAddress(targetAddress1);
txtMessage.setAddress(targetAddress);

however, it only manages to sent to the targetAddress1.. Why?
18 years ago
Hi.. I need some help with my J2ME project. I'm doing a wireless vehicle security & alert system for my final year project. The project is roughtly about, when your vehicle is being used by unauthorized persons, an alarm will trigger and send a sms to inform the owner so the owner can take action. However, maybe due to poor reception, the owner might not receive the 1st sms. Therefore, I have to do something like maybe 10mins later if there is no any reply sms by the owner, i have to send out the same sms to him again. I have to send out at least 5 times if there is no reply from him(for every new sending, the time interval mus be longer eg. 1st time 5 mins, 2nd time 10 mins..). If after sending maybe the 3rd time, the owner send back a command, than I have to get out of the sending loop and carry out the command send by the owner(Maybe to trigger back the alarm). So now I'm not sure of how to get out of the loop if by the 3rd time or anytime, there is a reply message by the owner and also not sure how to increase the time interval.. Another porblem is that I'm not very sure of how to apply Watchdog into the program to check for hang or errors. What must be included in the watchdog setup? Hope someone can get back to me as soon as possible.. thanks
18 years ago