A. Listing Program Data Logger GSM Telemetry
/****************************************************
Project : Sistem Informasi Tinggi Muka Air Bendungan Secara Interaktif
Dengan Media Seluler
Version : V1.7
Date : 18/01/2011
Author : Coys
Company : TE-UNEJ '06
Comments : Semoga Bermanfaat
Chip type : ATmega16
Program type : Application
Clock frequency : 11.059200 MHz
Memory model : Small
External SRAM size : 0
Data Stack size : 256
*****************************************************/
/*~~~~~~~~~~> Bismillahirrahmanirrohim
#endasm
//***************************************** Global Variable
char gsmtswl[7]={'g','s','m','t','s','w','l'};
char gsmtsst[7]={'g','s','m','t','s','s','t'};
char regno[3]={'r','e','g'};
char pulsa[6]={'c','r','e','d','i','t'};
char hfiy[3]={'0','9','2'};
char dsen1[3]={'5','3','2'};
char dsen2[3]={'3','2','1'};
unsigned char m, i, a, r, k, h, w, t, l, o, v, u,
x, z, ke, ho, mi, se, da, mo, ye, sim,
buf[32], credit_cek, credit[30], data_prd, dt[4],
dta[4], number[15], karakter[20], petik=34, petik2,
phone[12], ram, ram1, ram_bebas, take_char[100];
unsigned int y, addr, addrh, addrl, count, counter,
pls, req, set_data, set_time, sigm, time;
float data, jrk, sms_req[30], timer, wl;
eeprom unsigned char time_MR=0, mem_pb=2, periodic_data=10;
eeprom unsigned int periodic_time=60;
//***************************************** UART
#define RXB8 1
#define TXB8 0
#define UPE 2
#define OVR 3
#define FE 4
#define UDRE 5
#define RXC 7
#define FRAMING_ERROR (1
// This flag is set on USART Receiver buffer overflow
bit rx_buffer_overflow;
// USART Receiver interrupt service routine
interrupt [USART_RXC] void usart_rx_isr(void)
{
char status,data;
status=UCSRA;
data=UDR;
if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0)
{
rx_buffer[rx_wr_index]=data;
if (++rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0;
if (++rx_counter == RX_BUFFER_SIZE)
{
rx_counter=0;
rx_buffer_overflow=1;
};
};
}
#ifndef _DEBUG_TERMINAL_IO_
// Get a character from the USART Receiver buffer
#define _ALTERNATE_GETCHAR_
#pragma used+
char getchar(void)
{
char data;
while (rx_counter==0);
data=rx_buffer[rx_rd_index];
if (++rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0;
#asm("cli")
--rx_counter;
#asm("sei")
return data;
}
#pragma used-
#endif
//***************************************** Read a byte from the EEPROM
unsigned char eeprom_read(unsigned char addressh, unsigned char addressl)
{
unsigned char data;
i2c_start();
i2c_write(eeprom_addr);
i2c_write(addressh);
i2c_write(addressl);
i2c_start();
i2c_write(eeprom_addr | 1);
data=i2c_read(0);
i2c_stop();
return data;
}
//***************************************** Write a byte to the EEPROM
void eeprom_write(unsigned char addressh, unsigned char addressl, unsigned char data)
{
i2c_start();
i2c_write(eeprom_addr);
i2c_write(addressh);
i2c_write(addressl);
i2c_write(data);
i2c_stop();
delay_ms(15);
}
//***************************************** Write Data to EEPROM
void wr_dt_to_eeprom(void)
{
dt[0]=*((char*)&wl);
dt[1]=*((char*)&wl+1);
dt[2]=*((char*)&wl+2);
dt[3]=*((char*)&wl+3);
x=eeprom_read(0x3f, 0xff);
y=eeprom_read(0x40, 0x00);
if(y==0x3f && x==0xfc)
{
x=0;
y=0;
eeprom_write(0x3f, 0xff, x);
eeprom_write(0x40, 0x00, y);
}
for(a=0; a255)
{
x=0;
y++;
eeprom_write(0x40, 0x00, y);
}
eeprom_write(0x3f, 0xff, x);
}
}
//***************************************** Read Data from EEPROM
void rd_dt_eeprom(unsigned char jml2)
{
sigm=jml2*4;
x=eeprom_read(0x3f, 0xff);
y=eeprom_read(0x40, 0x00);
y=8;
addrl=addr&0x00ff;
for(a=0; a255)
{
addrl=0;
addrh++;
}
}
*((char*)&data)=dta[0];
*((char*)&data+1)=dta[1];
*((char*)&data+2)=dta[2];
*((char*)&data+3)=dta[3];
}
//***************************************** Data Request
void dt_req(unsigned char jml1)
{
r=1;
i=jml1;
while(i!=0)
{
rd_dt_eeprom(i);
sms_req[r]=data;
r++;
i--;
delay_ms(10);
}
}
//***************************************** Delete Message
void delete_SMS(unsigned char del)
{
printf("at+cmgd=%d\x0D",del);
while (getchar()!='O');
while (getchar()!='K');
}
//***************************************** Send Message
void send_SMS(unsigned char jml)
{
dt_req(jml);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send SMS Warning
if(jml==1)
{
printf("at+cmgf=1\x0D");
while (getchar()!='O');
while (getchar()!='K');
delete_SMS(z);
printf("at+cmgw=%c085749722092%c\x0D",petik,petik);
while(getchar()!=62);
printf("GSMTS WARNING SYSTEM\x0D");
printf("Time : %02d:%02d %02d/%02d/%02d\x0D",ho,mi,da,mo,ye);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Siaga
if(sms_req[1]>35 && sms_req[1]40 && sms_req[1]
while (getchar()!='O');
while (getchar()!='K');
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Awas
else if(sms_req[1]>45)
{
printf("Status : Awas\x0D");
printf("Water level: %3.2f cm",sms_req[1]);
putchar(26);
while (getchar()!='O');
while (getchar()!='K');
}
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("Sending SMS");
delay_ms(300);
printf("at+cmss=1\x0D");
while (getchar()!='O');
while (getchar()!='K');
for(l=1; l=14 && v
lcd_gotoxy(12,0);
lcd_putsf("'OK'");
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reset Array sms_req
sms_req[1]=0;
delete_SMS(1);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send SMS Data Periodic
else if(jml==periodic_data && m>=time)
{
printf("at+cmgf=1\x0D");
while (getchar()!='O');
while (getchar()!='K');
delete_SMS(z);
printf("at+cmgw=%c085749722092%c\x0D",petik,petik);
while(getchar()!=62);
printf("GSMTS WATER LEVEL (cm)\x0D");
printf("Time : %02d:%02d %02d/%02d/%02d\x0D",ho,mi,da,mo,ye);
for(k=1; k
while (ram1!='K')
{
ram1=getchar();
if(v>=14 && v
{
printf("%d. %3.2f",k,sms_req[k]);
putchar(13);
}
putchar(26);
while (getchar()!='O');
while (getchar()!='K');
printf("at+cmss=1\x0D");
while (getchar()!='O');
while (getchar()!='K');
lcd_gotoxy(12,1);
lcd_putsf("'OK'");
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reset Array sms_req
for(t=1; t
while (getchar()!='K');
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SMS Add Number
else if(att==2)
{
printf("at+cmgw=%c%c%c%c%c%c%c%c%c%c%c%c%c%c\x0D",petik,karakter[4],karakt
er[5],karakter[6],karakter[7],karakter[8],karakter[9],karakter[10],karakter[11],karakter[12],ka
rakter[13],karakter[14],karakter[15],petik);
while(getchar()!=62);
printf("Your Number was Registered on GSM Telemetry System");
putchar(26);
while (getchar()!='O');
while (getchar()!='K');
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SMS Access Permission Denied
else if(att==3)
{
printf("at+cmgw=%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\x0D",petik,number[0],n
umber[1],number[2],number[3],number[4],number[5],number[6],number[7],number[8],numb
er[9],number[10],number[11],number[12],number[13],petik);
while(getchar()!=62);
printf("Access Permission Denied");
putchar(26);
while (getchar()!='O');
while (getchar()!='K');
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SMS Credits
else if(att==4)
{
petik2=34;
printf("at+cmgw=%c085749722092%c\x0D",petik2,petik2);
while(getchar()!=62);
printf("Time : %02d:%02d %02d/%02d/%02d\x0D",ho,mi,da,mo,ye);
printf("Your Credits : Rp %d",pls);
putchar(26);
while (getchar()!='O');
while (getchar()!='K');
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SMS Req Credits
else if(att==5)
{
petik2=34;
printf("at+cmgw=%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\x0D",petik2,number[0],
number[1],number[2],number[3],number[4],number[5],number[6],number[7],number[8],num
ber[9],number[10],number[11],number[12],number[13],petik2);
while(getchar()!=62);
printf("Time : %02d:%02d %02d/%02d/%02d\x0D",ho,mi,da,mo,ye);
printf("Your Credits : Rp %d",pls);
putchar(26);
while (getchar()!='O');
while (getchar()!='K');
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send SMS Set_Time
else if(att==6)
{
time=periodic_time;
data_prd=periodic_data;
printf("at+cmgw=%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\x0D",petik,number[0],n
umber[1],number[2],number[3],number[4],number[5],number[6],number[7],number[8],numb
er[9],number[10],number[11],number[12],number[13],petik);
while(getchar()!=62);
printf("Time : %02d:%02d %02d/%02d/%02d\x0D",ho,mi,da,mo,ye);
printf("Time for Periodic Data:%d minute\x0D",time);
printf("Total Data:%d data",periodic_data);
putchar(26);
while (getchar()!='O');
while (getchar()!='K');
}
printf("at+cmss=1\x0D");
while (getchar()!='O');
while (getchar()!='K');
lcd_gotoxy(12,1);
lcd_putsf("'OK'");
delete_SMS(z);
}
//***************************************** Add No of Client
void add_phone(void)
{
printf("at+cpbw=,%c%c%c%c%c%c%c%c%c%c%c%c%c%c\x0D",petik,karakter[4],karakt
er[5],karakter[6],karakter[7],karakter[8],karakter[9],karakter[10],karakter[11],karakter[12],ka
rakter[13],karakter[14],karakter[15],petik);
while (getchar()!='O');
while (getchar()!='K');
}
//***************************************** Credits Cek
void cek_credit(void)
{
o=0;
w=0;
credit_cek=0;
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("Pulsa:");
printf("atd*123#;\x0D");
while (credit_cek!='K')
{
credit_cek=getchar();
if(w>=20 && w
{
pls=((credit[0]-'0')*10)+(credit[1]-'0');
}
sprintf(buf,"Rp %d",pls);
lcd_gotoxy(6,0);
lcd_puts(buf);
lcd_gotoxy (0,1);
lcd_putsf("Sending SMS");
delay_ms(1000);
}
//***************************************** Read SMS
void read_SMS()
{
for(z=1; z=23 && x
sim++;
}
if(x>=66 && x
(number[13]==dsen1[2]))||
((number[11]==dsen2[0])&&
(number[12]==dsen2[1])&&
(number[13]==dsen2[2]))))
{
set_time=((karakter[7]-'0')*100)+((karakter[8]-'0')*10)+(karakter[9]-'0');
set_data=((karakter[10]-'0')*10)+(karakter[11]-'0');
periodic_time=set_time;
periodic_data=set_data;
lcd_clear();
lcd_gotoxy (0,0);
sprintf(buf,"Tm & dt:%d %d",set_time,set_data);
lcd_puts(buf);
lcd_gotoxy (0,1);
lcd_putsf("Sending SMS");
send_SMS_att(6);
delay_ms(500);
}
else
{
lcd_clear();
lcd_gotoxy (0,0);
lcd_putsf("Access Denied");
lcd_gotoxy (0,1);
lcd_putsf("Sending SMS");
send_SMS_att(3);
delay_ms(500);
}
}
else if(karakter[0]=='r' || karakter[0]=='R')
{
if(((karakter[1]==regno[1])&&
(karakter[2]==regno[2]))&&
(((number[11]==hfiy[0])&&
(number[12]==hfiy[1])&&
(number[13]==hfiy[2]))||
((number[11]==dsen1[0])&&
(number[12]==dsen1[1])&&
(number[13]==dsen1[2]))||
((number[11]==dsen2[0])&&
(number[12]==dsen2[1])&&
(number[13]==dsen2[2]))))
{
add_phone();
mem_pb=mem_pb+1;
lcd_clear();
lcd_gotoxy (0,0);
lcd_putsf("Add New Number");
lcd_gotoxy (0,1);
lcd_putsf("Sending SMS");
send_SMS_att(2);
delay_ms(500);
}
else
{
lcd_clear();
lcd_gotoxy (0,0);
lcd_putsf("Access Denied");
lcd_gotoxy (0,1);
lcd_putsf("Sending SMS");
send_SMS_att(3);
delay_ms(500);
}
}
else if(karakter[0]=='c' || karakter[0]=='C')
{
if(((karakter[1]==pulsa[1])&&
(karakter[2]==pulsa[2])&&
(karakter[3]==pulsa[3])&&
(karakter[4]==pulsa[4])&&
(karakter[5]==pulsa[5]))&&
((number[11]==hfiy[0])&&
(number[12]==hfiy[1])&&
(number[13]==hfiy[2])))
{
cek_credit();
send_SMS_att(5);
delay_ms(500);
}
else
{
lcd_clear();
lcd_gotoxy (0,0);
lcd_putsf("Access Denied");
lcd_gotoxy (0,1);
lcd_putsf("Sending SMS");
send_SMS_att(3);
delay_ms(500);
}
}
else
{
lcd_clear();
lcd_gotoxy (1,0);
lcd_putsf("Vry Err Syntac");
lcd_gotoxy (0,1);
lcd_putsf("Sending SMS");
send_SMS_att(1);
delay_ms(500);
}
for(t=0; t
// Port B
PORTB=0x00; DDRB=0x00;
// Port C
PORTC=0x00; DDRC=0x00;
// Port D
PORTD=0x00; DDRD=0x00;
// Timer/Counter 0
TCCR0=0x00; TCNT0=0x00; OCR0=0x00;
// Timer/Counter 1
TCCR1A=0x00; TCCR1B=0x00; TCNT1H=0x00; TCNT1L=0x00; ICR1H=0x00;
ICR1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00;
// Timer/Counter 2
ASSR=0x00; TCCR2=0x00; TCNT2=0x00; OCR2=0x00;
// Ext. Interrupt(s)
GICR|=0x40; MCUCR=0x03; MCUCSR=0x00; GIFR=0x40;
// Timer(s)/Counter(s) Interrupt(s)
TIMSK=0x01;
// USART
UCSRA=0x00; UCSRB=0x98; UCSRC=0x86; UBRRH=0x00; UBRRL=0x05;
// I2C Bus
i2c_init();
// DS1307
rtc_init(0,0,0);
// LCD Module
lcd_init(16);
// Global enable interrupts
#asm("sei")
//load time SMS multiple recipient
m=time_MR;
//Detecting Hardware
lcd_gotoxy(0,0);
lcd_putsf("Cek Hardware");
lcd_gotoxy(0,1);
lcd_putsf("RTC");
delay_ms(500);
if (i2c_start() == 0) sprintf(buf, "NO BUS");
else if (i2c_write(0xD0)) sprintf(buf, "'OK'");
else sprintf(buf, "'ERROR'");
i2c_stop();
lcd_gotoxy(4,1);
lcd_puts(buf);
delay_ms(1000);
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("Cek Hardware");
lcd_gotoxy(0,1);
lcd_putsf("EEPROM");
delay_ms(500);
if (i2c_start() == 0) sprintf(buf, "NO BUS");
else if (i2c_write(0xA0)) sprintf(buf, "'OK'");
else sprintf(buf, "'ERROR'");
i2c_stop();
lcd_gotoxy(7,1);
lcd_puts(buf);
delay_ms(1000);
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("Cek Hardware");
lcd_gotoxy(0,1);
lcd_putsf("GSM SIM300");
delay_ms(500);
printf("ate0\x0D");
while (getchar()!='O');
while (getchar()!='K');
delay_ms(500);
printf("at+cmgf=1\x0D");
while (getchar()!='O');
while (getchar()!='K');
delete_SMS(1);
delete_SMS(2);
lcd_gotoxy (11,1);
lcd_putsf("'OK'");
delay_ms(1000);
//rtc_set_time(16,12,30);
//rtc_set_date(18,12,10);
for(h=0; h
{
lcd_clear();
delay_ms(200);
lcd_gotoxy(4,0);
lcd_putsf("~READY~");
delay_ms(700);
}
while (1)
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Get Time
rtc_get_time(&ho,&mi,&se);
rtc_get_date(&da,&mo,&ye);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Water Level
DirSig=1;
SigOut=0;
delay_us(5);
SigOut=1;
delay_us(5);
SigOut=0;
delay_us(500);
DirSig=0;
SigOut=1;
while(SigIn==0);
#asm("sei")
TCCR0|=0x04;
while(SigIn==1 && TCCR0==0x04);
TCCR0&=0xFB;
counter=TCNT0;
timer=(float)counter*0.000023148148;
jrk=timer*34442*0.5;
delay_ms(10);
TCNT0=0;
wl=51.08-jrk;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Display
lcd_clear();
sprintf(buf,"%02d:%02d:%02d %02d%02d%02d",ho,mi,se,da,mo,ye);
lcd_gotoxy(0,0);
lcd_puts(buf);
sprintf(buf,"J:%3.2f",wl);
lcd_gotoxy(0,1);
lcd_puts(buf);
time=periodic_time;
sprintf(buf,"T:%d",time);
lcd_gotoxy(10,1);
lcd_puts(buf);
delay_ms(500);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Data Log + Data periodic Transmit
if(se==0)
{
wr_dt_to_eeprom();
m++;
if(m>=time)
{
data_prd=periodic_data;
send_SMS(data_prd);
m=0;
}
time_MR=m;
delay_ms(1000);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SMS Warning
if(se==2 && wl>=35) send_SMS(1);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Cek New SMS
if(se==30) read_SMS();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Credits Cek
if(ho==7 && mi==0 && se==20)
{
cek_credit();
send_SMS_att(4);
}
};
}
B. Listing Program Aplikasi Seluler GSM Telemetry
package GSM_TS;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import org.netbeans.microedition.lcdui.LoginScreen;
import org.netbeans.microedition.lcdui.SplashScreen;
import org.netbeans.microedition.lcdui.WaitScreen;
import org.netbeans.microedition.lcdui.wma.SMSComposer;
import org.netbeans.microedition.util.SimpleCancellableTask;
/**
* @author hfiy
*/
public class GSMTS extends MIDlet implements CommandListener {
private boolean midletPaused = false;
private Form form4;
private StringItem stringItem;
private StringItem stringItem2;
private StringItem stringItem3;
private StringItem stringItem4;
private StringItem stringItem5;
private StringItem stringItem6;
private Form form5;
private StringItem stringItem1;
private SplashScreen splashScreen;
private List list;
private SMSComposer smsComposer4;
private SMSComposer smsComposer;
private WaitScreen waitScreen;
private SplashScreen splashScreen2;
private SplashScreen splashScreen1;
private SMSComposer smsComposer1;
private SMSComposer smsComposer2;
private Form form;
private ImageItem imageItem3;
private TextField textField1;
private TextField textField;
private Spacer spacer;
private SplashScreen splashScreen3;
private SMSComposer smsComposer3;
private Form form2;
private TextField textField3;
private ImageItem imageItem1;
private Form form1;
private TextField textField2;
private ImageItem imageItem;
private Form form3;
private TextField textField4;
private ImageItem imageItem2;
private LoginScreen loginScreen;
private Alert alert;
private WaitScreen waitScreen1;
private Command helpCommand;
private Command itemCommand;
private Command okCommand;
private Command exitCommand;
private Command backCommand;
private Command okCommand1;
private Command okCommand3;
private Command backCommand1;
private Ticker ticker6;
private Ticker ticker7;
private SimpleCancellableTask task;
private Image image4;
private Image image3;
private Ticker ticker1;
private Image image5;
private Font font2;
private Font font1;
private Font font3;
private Image image8;
private Image image9;
private Image image6;
private Image image7;
private Image image1;
private Image image2;
private Ticker ticker4;
private Ticker ticker5;
private Ticker ticker2;
private SimpleCancellableTask task1;
/**
* The GSMTS constructor.
*/
public GSMTS() {
}
/**
* Initilizes the application.
* It is called only once when the MIDlet is started. The method is called before the
startMIDlet method.
*/
private void initialize() {
}
/**
* Performs an action assigned to the Mobile Device - MIDlet Started point.
*/
public void startMIDlet() {
switchDisplayable(null, getSplashScreen());
}
/**
* Performs an action assigned to the Mobile Device - MIDlet Resumed point.
*/
public void resumeMIDlet() {
}
/**
* Switches a current displayable in a display. The display instance is taken
from getDisplay method. This method is used by all actions in the design for
switching displayable.
* @param alert the Alert which is temporarily set to the display; if null,
then nextDisplayable is set immediately
* @param nextDisplayable the Displayable to be set
*/
public void switchDisplayable(Alert alert, Displayable nextDisplayable) {
Display display = getDisplay();
if (alert == null) {
display.setCurrent(nextDisplayable);
} else {
display.setCurrent(alert, nextDisplayable);
}
}
/**
* Called by a system to indicated that a command has been invoked on a particular
displayable.
* @param command the Command that was invoked
* @param displayable the Displayable where the command was invoked
*/
public void commandAction(Command command, Displayable displayable) {
if (displayable == form) {
if (command == backCommand) {
switchDisplayable(null, getList());
} else if (command == okCommand1) {
switchDisplayable(null, getSmsComposer3());
}
} else if (displayable == form1) {
if (command == backCommand1) {
switchDisplayable(null, getList());
} else if (command == okCommand3) {
switchDisplayable(null, getSmsComposer());
}
} else if (displayable == form2) {
if (command == backCommand1) {
switchDisplayable(null, getList());
} else if (command == okCommand3) {
switchDisplayable(null, getSmsComposer1());
}
} else if (displayable == form3) {
if (command == backCommand1) {
switchDisplayable(null, getList());
} else if (command == okCommand3) {
switchDisplayable(null, getSmsComposer2());
}
} else if (displayable == form4) {
if (command == backCommand) {
switchDisplayable(null, getList());
}
} else if (displayable == form5) {
if (command == backCommand) {
switchDisplayable(null, getList());
}
} else if (displayable == list) {
if (command == List.SELECT_COMMAND) {
listAction();
} else if (command == exitCommand) {
switchDisplayable(null, getSplashScreen3());
} else if (command == helpCommand) {
switchDisplayable(null, getForm4());
} else if (command == itemCommand) {
switchDisplayable(null, getForm5());
} else if (command == okCommand) {
listAction();
}
} else if (displayable == loginScreen) {
if (command == LoginScreen.LOGIN_COMMAND) {
switchDisplayable(null, getWaitScreen1());
}
} else if (displayable == smsComposer) {
if (command == SMSComposer.SEND_COMMAND) {
switchDisplayable(null, getWaitScreen());
} else if (command == backCommand) {
switchDisplayable(null, getForm1());
}
} else if (displayable == smsComposer1) {
if (command == SMSComposer.SEND_COMMAND) {
switchDisplayable(null, getWaitScreen());
} else if (command == backCommand) {
switchDisplayable(null, getForm2());
}
} else if (displayable == smsComposer2) {
if (command == SMSComposer.SEND_COMMAND) {
switchDisplayable(null, getWaitScreen());
} else if (command == backCommand) {
switchDisplayable(null, getForm3());
}
} else if (displayable == smsComposer3) {
if (command == SMSComposer.SEND_COMMAND) {
switchDisplayable(null, getWaitScreen());
} else if (command == backCommand) {
switchDisplayable(null, getForm());
}
} else if (displayable == smsComposer4) {
if (command == SMSComposer.SEND_COMMAND) {
switchDisplayable(null, getWaitScreen());
}
} else if (displayable == splashScreen) {
if (command == SplashScreen.DISMISS_COMMAND) {
switchDisplayable(null, getLoginScreen());
}
} else if (displayable == splashScreen1) {
if (command == SplashScreen.DISMISS_COMMAND) {
switchDisplayable(null, getList());
}
} else if (displayable == splashScreen2) {
if (command == SplashScreen.DISMISS_COMMAND) {
switchDisplayable(null, getList());
}
} else if (displayable == splashScreen3) {
if (command == SplashScreen.DISMISS_COMMAND) {
exitMIDlet();
}
} else if (displayable == waitScreen) {
if (command == WaitScreen.FAILURE_COMMAND) {
switchDisplayable(null, getSplashScreen2());
} else if (command == WaitScreen.SUCCESS_COMMAND) {
switchDisplayable(null, getSplashScreen1());
}
} else if (displayable == waitScreen1) {
if (command == WaitScreen.FAILURE_COMMAND) {
switchDisplayable(getAlert(), getLoginScreen());
} else if (command == WaitScreen.SUCCESS_COMMAND) {
switchDisplayable(null, getList());
}
}
}
/**
* Returns an initiliazed instance of splashScreen component.
* @return the initialized component instance
*/
public SplashScreen getSplashScreen() {
if (splashScreen == null) {
splashScreen = new SplashScreen(getDisplay());
splashScreen.setTitle("");
splashScreen.setCommandListener(this);
splashScreen.setFullScreenMode(true);
splashScreen.setImage(getImage2());
splashScreen.setText("GSM TELEMETRY SYSTEM");
splashScreen.setTextFont(getFont3());
}
return splashScreen;
}
/**
* Returns an initiliazed instance of list component.
* @return the initialized component instance
*/
public List getList() {
if (list == null) {
list = new List("TELEMTRY SYSTEM", Choice.IMPLICIT);
list.append("Water Level Request", getImage1());
list.append("Flowmeter Request", getImage6());
list.append("Add New Number Client", getImage7());
list.append("Set Time Periodic Data", getImage8());
list.append("Credits", getImage9());
list.setTicker(getTicker1());
list.addCommand(getOkCommand());
list.addCommand(getExitCommand());
list.addCommand(getHelpCommand());
list.addCommand(getItemCommand());
list.setCommandListener(this);
list.setFitPolicy(Choice.TEXT_WRAP_DEFAULT);
list.setSelectedFlags(new boolean[] { false, false, false, false, false });
list.setFont(0, getFont2());
list.setFont(1, getFont2());
list.setFont(2, getFont2());
list.setFont(3, getFont2());
list.setFont(4, getFont2());
}
return list;
}
/**
* Performs an action assigned to the selected list element in the list component.
*/
public void listAction() {
String __selectedString = getList().getString(getList().getSelectedIndex());
if (__selectedString != null) {
if (__selectedString.equals("Water Level Request")) {
switchDisplayable(null, getForm1());
} else if (__selectedString.equals("Flowmeter Request")) {
switchDisplayable(null, getForm2());
} else if (__selectedString.equals("Add New Number Client")) {
switchDisplayable(null, getForm3());
} else if (__selectedString.equals("Set Time Periodic Data")) {
switchDisplayable(null, getForm());
} else if (__selectedString.equals("Credits")) {
switchDisplayable(null, getSmsComposer4());
}
}
}
/**
* Returns an initiliazed instance of okCommand component.
* @return the initialized component instance
*/
public Command getOkCommand() {
if (okCommand == null) {
okCommand = new Command("Ok", Command.OK, 0);
}
return okCommand;
}
/**
* Returns an initiliazed instance of exitCommand component.
* @return the initialized component instance
*/
public Command getExitCommand() {
if (exitCommand == null) {
exitCommand = new Command("Exit", Command.EXIT, 0);
}
return exitCommand;
}
/**
* Returns an initiliazed instance of waitScreen component.
* @return the initialized component instance
*/
public WaitScreen getWaitScreen() {
if (waitScreen == null) {
waitScreen = new WaitScreen(getDisplay());
waitScreen.setTitle("waitScreen");
waitScreen.setCommandListener(this);
waitScreen.setTask(getTask());
}
return waitScreen;
}
/**
* Returns an initiliazed instance of splashScreen1 component.
* @return the initialized component instance
*/
public SplashScreen getSplashScreen1() {
if (splashScreen1 == null) {
splashScreen1 = new SplashScreen(getDisplay());
splashScreen1.setTitle("");
splashScreen1.setCommandListener(this);
splashScreen1.setFullScreenMode(true);
splashScreen1.setImage(getImage3());
splashScreen1.setText("Message Sent");
splashScreen1.setTextFont(getFont1());
splashScreen1.setTimeout(3000);
}
return splashScreen1;
}
/**
* Returns an initiliazed instance of splashScreen2 component.
* @return the initialized component instance
*/
public SplashScreen getSplashScreen2() {
if (splashScreen2 == null) {
splashScreen2 = new SplashScreen(getDisplay());
splashScreen2.setTitle("");
splashScreen2.setCommandListener(this);
splashScreen2.setFullScreenMode(true);
splashScreen2.setImage(getImage4());
splashScreen2.setText("Message Failed");
splashScreen2.setTextFont(getFont1());
splashScreen2.setTimeout(3000);
}
return splashScreen2;
}
/**
* Returns an initiliazed instance of task component.
* @return the initialized component instance
*/
public SimpleCancellableTask getTask() {
if (task == null) {
task = new SimpleCancellableTask();
task.setExecutable(new org.netbeans.microedition.util.Executable() {
public void execute() throws Exception {
}
});
}
return task;
}
/**
* Returns an initiliazed instance of smsComposer1 component.
* @return the initialized component instance
*/
public SMSComposer getSmsComposer1() {
smsComposer1 = null;
if (smsComposer1 == null) {
String text3 = textField3.getString();
String fm = "gsmtsfm"+text3;
smsComposer1 = new SMSComposer(getDisplay());
smsComposer1.setTitle("GSM Telemetry");
smsComposer1.setTicker(getTicker4());
smsComposer1.addCommand(SMSComposer.SEND_COMMAND);
smsComposer1.addCommand(getBackCommand());
smsComposer1.setCommandListener(this);
smsComposer1.setBGColor(-1);
smsComposer1.setFGColor(-13487361);
smsComposer1.setPhoneNumber("087757860673");
smsComposer1.setMessage(fm);
smsComposer1.setPhoneNumberLabel("No.");
smsComposer1.setMessageLabel("");
}
return smsComposer1;
}
/**
* Returns an initiliazed instance of smsComposer2 component.
* @return the initialized component instance
*/
public SMSComposer getSmsComposer2() {
smsComposer2 = null;
if (smsComposer2 == null) {
String text4 = textField4.getString();
String no = "Reg "+text4;
smsComposer2 = new SMSComposer(getDisplay());
smsComposer2.setTitle("GSM Telemetry");
smsComposer2.setTicker(getTicker5());
smsComposer2.addCommand(SMSComposer.SEND_COMMAND);
smsComposer2.addCommand(getBackCommand());
smsComposer2.setCommandListener(this);
smsComposer2.setBGColor(-1);
smsComposer2.setFGColor(-13487361);
smsComposer2.setPhoneNumber("087757860673");
smsComposer2.setMessage(no);
smsComposer2.setPhoneNumberLabel("No.");
smsComposer2.setMessageLabel("");
}
return smsComposer2;
}
/**
* Returns an initiliazed instance of image3 component.
* @return the initialized component instance
*/
public Image getImage3() {
if (image3 == null) {
try {
image3 = Image.createImage("/gnome-session-reboot.png");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
return image3;
}
/**
* Returns an initiliazed instance of image4 component.
* @return the initialized component instance
*/
public Image getImage4() {
if (image4 == null) {
try {
image4 = Image.createImage("/applet-critical.png");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
return image4;
}
/**
* Returns an initiliazed instance of ticker1 component.
* @return the initialized component instance
*/
public Ticker getTicker1() {
if (ticker1 == null) {
ticker1 = new Ticker("Welcome on GSM Telemetry System");
}
return ticker1;
}
/**
* Returns an initiliazed instance of form component.
* @return the initialized component instance
*/
public Form getForm() {
if (form == null) {
form = new Form(" Time Setting", new Item[] { getTextField(), getSpacer(),
getTextField1(), getImageItem3() });
form.addCommand(getBackCommand());
form.addCommand(getOkCommand1());
form.setCommandListener(this);
}
return form;
}
/**
* Returns an initiliazed instance of backCommand component.
* @return the initialized component instance
*/
public Command getBackCommand() {
if (backCommand == null) {
backCommand = new Command("Back", "Back", Command.BACK, 1);
}
return backCommand;
}
/**
* Returns an initiliazed instance of font1 component.
* @return the initialized component instance
*/
public Font getFont1() {
if (font1 == null) {
font1 = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD,
Font.SIZE_MEDIUM);/
}
return font1;
}
/**
* Returns an initiliazed instance of image5 component.
* @return the initialized component instance
*/
public Image getImage5() {
if (image5 == null) {
try {
image5 = Image.createImage("/logo.png");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
return image5;
}
/**
* Returns an initiliazed instance of font2 component.
* @return the initialized component instance
*/
public Font getFont2() {
if (font2 == null) {
font2 = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN,
Font.SIZE_SMALL);
}
return font2;
}
/**
* Returns an initiliazed instance of font3 component.
* @return the initialized component instance
*/
public Font getFont3() {
if (font3 == null) {
font3 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD,
Font.SIZE_SMALL);
}
return font3;
}
/**
* Returns an initiliazed instance of image1 component.
* @return the initialized component instance
*/
public Image getImage1() {
if (image1 == null) {
try {
image1 = Image.createImage("/blankon2.png");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
return image1;
}
/**
* Returns an initiliazed instance of image6 component.
* @return the initialized component instance
*/
public Image getImage6() {
if (image6 == null) {
try {
image6 = Image.createImage("/redhat.png");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
return image6;
}
/**
* Returns an initiliazed instance of image7 component.
* @return the initialized component instance
*/
public Image getImage7() {
if (image7 == null) {
try {
image7 = Image.createImage("/freebsd.png");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
return image7;
}
/**
* Returns an initiliazed instance of image8 component.
* @return the initialized component instance
*/
public Image getImage8() {
if (image8 == null) {
try {
image8 = Image.createImage("/osx.png");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
return image8;
}
/**
* Returns an initiliazed instance of image9 component.
* @return the initialized component instance
*/
public Image getImage9() {
if (image9 == null) {
try {
image9 = Image.createImage("/ubuntu1.png");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
return image9;
}
/**
* Returns an initiliazed instance of textField component.
* @return the initialized component instance
*/
public TextField getTextField() {
if (textField == null) {
textField = new TextField("Time Setting (minute)", null, 3, TextField.NUMERIC);
}
return textField;
}
/**
* Returns an initiliazed instance of okCommand1 component.
* @return the initialized component instance
*/
public Command getOkCommand1() {
if (okCommand1 == null) {
okCommand1 = new Command("Send", Command.OK, 0);
}
return okCommand1;
}
/**
* Returns an initiliazed instance of splashScreen3 component.
* @return the initialized component instance
*/
public SplashScreen getSplashScreen3() {
if (splashScreen3 == null) {
splashScreen3 = new SplashScreen(getDisplay());
splashScreen3.setTitle("");
splashScreen3.setCommandListener(this);
splashScreen3.setFullScreenMode(true);
splashScreen3.setImage(getImage2());
splashScreen3.setTimeout(3000);
}
return splashScreen3;
}
/**
* Returns an initiliazed instance of smsComposer component.
* @return the initialized component instance
*/
public SMSComposer getSmsComposer() {
smsComposer = null;
if (smsComposer == null) {
String text2 = textField2.getString();
String wl = "gsmtswl"+text2;
smsComposer = new SMSComposer(getDisplay());
smsComposer.setTitle("GSM Telemetry");
smsComposer.setTicker(getTicker2());
smsComposer.addCommand(SMSComposer.SEND_COMMAND);
smsComposer.addCommand(getBackCommand());
smsComposer.setCommandListener(this);
smsComposer.setBGColor(-1);
smsComposer.setFGColor(-13487361);
smsComposer.setPhoneNumber("087757860673");
smsComposer.setMessage(wl);
smsComposer.setPhoneNumberLabel("No.");
smsComposer.setMessageLabel("");
}
return smsComposer;
}
/**
* Returns an initiliazed instance of spacer component.
* @return the initialized component instance
*/
public Spacer getSpacer() {
if (spacer == null) {
spacer = new Spacer(16, 1);
}
return spacer;
}
/**
* Returns an initiliazed instance of image2 component.
* @return the initialized component instance
*/
public Image getImage2() {
if (image2 == null) {
try {
image2 = Image.createImage("/Untitled.png");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
return image2;
}
/**
* Returns an initiliazed instance of smsComposer3 component.
* @return the initialized component instance
*/
public SMSComposer getSmsComposer3() {
smsComposer3 = null;
if (smsComposer3 == null) {
String text = textField.getString();
String text1 = textField1.getString();
String time = "gsmtsst"+text+text1;
smsComposer3 = new SMSComposer(getDisplay());
smsComposer3.setTitle("GSM Telemetry");
smsComposer3.setTicker(getTicker6());
smsComposer3.addCommand(SMSComposer.SEND_COMMAND);
smsComposer3.addCommand(getBackCommand());
smsComposer3.setCommandListener(this);
smsComposer3.setBGColor(-1);
smsComposer3.setFGColor(-13487361);
smsComposer3.setPhoneNumber("087757860673");
smsComposer3.setMessage(time);
smsComposer3.setPhoneNumberLabel("No.");
smsComposer3.setMessageLabel("");
}
return smsComposer3;
}
/**
* Returns an initiliazed instance of form1 component.
* @return the initialized component instance
*/
public Form getForm1() {
if (form1 == null) {
form1 = new Form("Water level Data", new Item[] { getTextField2(), getImageItem()
});
form1.addCommand(getBackCommand1());
form1.addCommand(getOkCommand3());
form1.setCommandListener(this);
}
return form1;
}
/**
* Returns an initiliazed instance of textField2 component.
* @return the initialized component instance
*/
public TextField getTextField2() {
if (textField2 == null) {
textField2 = new TextField("Size Req Data (max 50)", null, 2, TextField.NUMERIC);
}
return textField2;
}
/**
* Returns an initiliazed instance of form2 component.
* @return the initialized component instance
*/
public Form getForm2() {
if (form2 == null) {
form2 = new Form("Flow Meter Data", new Item[] { getTextField3(),
getImageItem1() });
form2.addCommand(getOkCommand3());
form2.addCommand(getBackCommand1());
form2.setCommandListener(this);
}
return form2;
}
/**
* Returns an initiliazed instance of textField3 component.
* @return the initialized component instance
*/
public TextField getTextField3() {
if (textField3 == null) {
textField3 = new TextField(" Size Req Data (max 50)", null, 2,
TextField.NUMERIC);
}
return textField3;
}
/**
* Returns an initiliazed instance of form3 component.
* @return the initialized component instance
*/
public Form getForm3() {
if (form3 == null) {
form3 = new Form("Add Number Client", new Item[] { getTextField4(),
getImageItem2() });
form3.addCommand(getOkCommand3());
form3.addCommand(getBackCommand1());
form3.setCommandListener(this);
}
return form3;
}
/**
* Returns an initiliazed instance of textField4 component.
* @return the initialized component instance
*/
public TextField getTextField4() {
if (textField4 == null) {
textField4 = new TextField("Number New Client", null, 12, TextField.NUMERIC);
}
return textField4;
}
/**
* Returns an initiliazed instance of backCommand1 component.
* @return the initialized component instance
*/
public Command getBackCommand1() {
if (backCommand1 == null) {
backCommand1 = new Command("Back", Command.BACK, 0);
}
return backCommand1;
}
/**
* Returns an initiliazed instance of okCommand3 component.
* @return the initialized component instance
*/
public Command getOkCommand3() {
if (okCommand3 == null) {
okCommand3 = new Command("Send", Command.OK, 0);
}
return okCommand3;
}
/**
* Returns an initiliazed instance of imageItem component.
* @return the initialized component instance
*/
public ImageItem getImageItem() {
if (imageItem == null) {
imageItem = new ImageItem("", getImage5(), ImageItem.LAYOUT_CENTER |
Item.LAYOUT_TOP | Item.LAYOUT_BOTTOM | Item.LAYOUT_VCENTER, "Water
Level Request", Item.BUTTON);
imageItem.setPreferredSize(-1, -1);
}
return imageItem;
}
/**
* Returns an initiliazed instance of imageItem1 component.
* @return the initialized component instance
*/
public ImageItem getImageItem1() {
if (imageItem1 == null) {
imageItem1 = new ImageItem("", getImage5(), ImageItem.LAYOUT_CENTER |
Item.LAYOUT_TOP | Item.LAYOUT_BOTTOM | Item.LAYOUT_VCENTER, "", Item.BUTTON);
}
return imageItem1;
}
/**
* Returns an initiliazed instance of imageItem2 component.
* @return the initialized component instance
*/
public ImageItem getImageItem2() {
if (imageItem2 == null) {
imageItem2 = new ImageItem("", getImage5(), ImageItem.LAYOUT_CENTER |
Item.LAYOUT_TOP | Item.LAYOUT_BOTTOM | Item.LAYOUT_VCENTER, "", Item.BUTTON);
}
return imageItem2;
}
/**
* Returns an initiliazed instance of loginScreen component.
* @return the initialized component instance
*/
public LoginScreen getLoginScreen() {
if (loginScreen == null) {
loginScreen = new LoginScreen(getDisplay());
loginScreen.setLabelTexts("Username", "Password");
loginScreen.setTitle("");
loginScreen.addCommand(LoginScreen.LOGIN_COMMAND);
loginScreen.setCommandListener(this);
loginScreen.setFullScreenMode(true);
loginScreen.setBGColor(-3355444);
loginScreen.setFGColor(0);
loginScreen.setUseLoginButton(true);
loginScreen.setLoginButtonText("Login");
}
return loginScreen;
}
/**
* Returns an initiliazed instance of waitScreen1 component.
* @return the initialized component instance
*/
public WaitScreen getWaitScreen1() {
if (waitScreen1 == null) {
waitScreen1 = new WaitScreen(getDisplay());
waitScreen1.setTitle("waitScreen1");
waitScreen1.setCommandListener(this);
waitScreen1.setText("please wait...");
waitScreen1.setTask(getTask1());
}
return waitScreen1;
}
/**
* Returns an initiliazed instance of alert component.
* @return the initialized component instance
*/
public Alert getAlert() {
if (alert == null) {
alert = new Alert("", "Wrong username or password", null, null);
alert.setTimeout(Alert.FOREVER);
}
return alert;
}
/**
* Returns an initiliazed instance of task1 component.
* @return the initialized component instance
*/
public SimpleCancellableTask getTask1() {
if (task1 == null) {
task1 = new SimpleCancellableTask();
task1.setExecutable(new org.netbeans.microedition.util.Executable() {
public void execute() throws Exception {
login();
}
});
}
return task1;
}
/**
* Returns an initiliazed instance of smsComposer4 component.
* @return the initialized component instance
*/
public SMSComposer getSmsComposer4() {
smsComposer4 = null;
if (smsComposer4 == null) {
smsComposer4 = new SMSComposer(getDisplay());
smsComposer4.setTitle("GSM Telemetry");
smsComposer4.setTicker(getTicker7());
smsComposer4.addCommand(SMSComposer.SEND_COMMAND);
smsComposer4.setCommandListener(this);
smsComposer4.setBGColor(-1);
smsComposer4.setFGColor(-13487361);
smsComposer4.setPhoneNumber("087757860673");
smsComposer4.setMessage("credit");
smsComposer4.setPhoneNumberLabel("No.");
smsComposer4.setMessageLabel("");
}
return smsComposer4;
}
/**
* Returns an initiliazed instance of ticker2 component.
* @return the initialized component instance
*/
public Ticker getTicker2() {
if (ticker2 == null) {
ticker2 = new Ticker("Permintaan Data Ketinggian Air");
}
return ticker2;
}
/**
* Returns an initiliazed instance of ticker4 component.
* @return the initialized component instance
*/
public Ticker getTicker4() {
if (ticker4 == null) {
ticker4 = new Ticker("Permintaan Data Kecepatan Air");
}
return ticker4;
}
/**
* Returns an initiliazed instance of ticker5 component.
* @return the initialized component instance
*/
public Ticker getTicker5() {
if (ticker5 == null) {
ticker5 = new Ticker("Menembahkan Nomor Baru Pada Perangkat");
}
return ticker5;
}
/**
* Returns an initiliazed instance of ticker6 component.
* @return the initialized component instance
*/
public Ticker getTicker6() {
if (ticker6 == null) {
ticker6 = new Ticker("Mengubah Waktu Pengiriman Data Periodik");
}
return ticker6;
}
/**
* Returns an initiliazed instance of ticker7 component.
* @return the initialized component instance
*/
public Ticker getTicker7() {
if (ticker7 == null) {
ticker7 = new Ticker("Cek Pulsa Data Logger");
}
return ticker7;
}
/**
* Returns an initiliazed instance of imageItem3 component.
* @return the initialized component instance
*/
public ImageItem getImageItem3() {
if (imageItem3 == null) {
imageItem3 = new ImageItem("", getImage5(), ImageItem.LAYOUT_CENTER |
Item.LAYOUT_TOP | Item.LAYOUT_BOTTOM | Item.LAYOUT_VCENTER |
ImageItem.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_VSHRINK |
Item.LAYOUT_VEXPAND, "");
}
return imageItem3;
}
/**
* Returns an initiliazed instance of textField1 component.
* @return the initialized component instance
*/
public TextField getTextField1() {
if (textField1 == null) {
textField1 = new TextField("Total Data (max 50)", null, 2, TextField.NUMERIC);
}
return textField1;
}
/**
* Returns an initiliazed instance of form4 component.
* @return the initialized component instance
*/
public Form getForm4() {
if (form4 == null) {
form4 = new Form("Help", new Item[] { getStringItem(), getStringItem2(),
getStringItem3(), getStringItem4(), getStringItem5(), getStringItem6() });
form4.addCommand(getBackCommand());
form4.setCommandListener(this);
}
return form4;
}
/**
* Returns an initiliazed instance of stringItem component.
* @return the initialized component instance
*/
public StringItem getStringItem() {
if (stringItem == null) {
stringItem = new StringItem("Petunjuk Penggunaan \"GSM Telemetry\"", "",
Item.PLAIN);
stringItem.setLayout(ImageItem.LAYOUT_DEFAULT);
stringItem.setFont(getFont2());
}
return stringItem;
}
/**
* Returns an initiliazed instance of helpCommand component.
* @return the initialized component instance
*/
public Command getHelpCommand() {
if (helpCommand == null) {
helpCommand = new Command("Help", "Help", Command.HELP, 1);
}
return helpCommand;
}
/**
* Returns an initiliazed instance of form5 component.
* @return the initialized component instance
*/
public Form getForm5() {
if (form5 == null) {
form5 = new Form("About", new Item[] { getStringItem1() });
form5.addCommand(getBackCommand());
form5.setCommandListener(this);
}
return form5;
}
/**
* Returns an initiliazed instance of stringItem1 component.
* @return the initialized component instance
*/
public StringItem getStringItem1() {
if (stringItem1 == null) {
stringItem1 = new StringItem("", "GSM Telemetry v1.01\nDeveloped
by:\nCoys_Hfiy");
stringItem1.setLayout(ImageItem.LAYOUT_CENTER | Item.LAYOUT_TOP |
Item.LAYOUT_BOTTOM | Item.LAYOUT_VCENTER |
ImageItem.LAYOUT_NEWLINE_AFTER);
stringItem1.setFont(getFont2());
stringItem1.setPreferredSize(-1, -1);
}
return stringItem1;
}
/**
* Returns an initiliazed instance of itemCommand component.
* @return the initialized component instance
*/
public Command getItemCommand() {
if (itemCommand == null) {
itemCommand = new Command("Item", "About", Command.SCREEN, 1);
}
return itemCommand;
}
/**
* Returns an initiliazed instance of stringItem2 component.
* @return the initialized component instance
*/
public StringItem getStringItem2() {
if (stringItem2 == null) {
stringItem2 = new StringItem("Water Level Request ->", "Menu untuk meminta data
ketinggian permukaan air. Jumlah yang diminta maksimal 50 data dan nilai Data yang
dimasukkan harus dalam format 2 angka, misalnya jumlah data yang diminta adalah 5 maka
nilai yang diinputkan adalah 05");
stringItem2.setLayout(ImageItem.LAYOUT_DEFAULT);
stringItem2.setFont(getFont2());
stringItem2.setPreferredSize(-1, -1);
}
return stringItem2;
}
/**
* Returns an initiliazed instance of stringItem3 component.
* @return the initialized component instance
*/
public StringItem getStringItem3() {
if (stringItem3 == null) {
stringItem3 = new StringItem("Flow Meter Request ->", "Menu untuk meminta data
kecepatan aliran air. Jumlah yang diminta maksimal 50 data dan nilai Data yang dimasukkan
harus dalam format 2 angka, misalnya jumlah data yang diminta adalah 5 maka nilai yang
diinputkan adalah 05");
stringItem3.setFont(getFont2());
}
return stringItem3;
}
/**
* Returns an initiliazed instance of stringItem4 component.
* @return the initialized component instance
*/
public StringItem getStringItem4() {
if (stringItem4 == null) {
stringItem4 = new StringItem("Add New Number Client ->", "Menu untuk
menambahkan nomor baru pada sistem telemetri. Masukkan 12 angka nomor seluler yang
akan didaftarkan pada sistem telemetri");
stringItem4.setFont(getFont2());
}
return stringItem4;
}
/**
* Returns an initiliazed instance of stringItem5 component.
* @return the initialized component instance
*/
public StringItem getStringItem5() {
if (stringItem5 == null) {
stringItem5 = new StringItem("Set Time Periodic Data ->", "Menu untuk mengubah
jumlah dan waktu pengiriman data Periodik. Nilai waktu yang diinputkan dalam satuan menit
dengan format 3 angka sedangkan nilai jumlah data dalam format 2 angka dan jumlah
maksimal 50 data, misalnya waktu disetting setiap 90 menit dan jumlah data adalah 30 data
maka nilai yang diinputkan pada form \u201CTime Setting\u201D adalah 090 dan pada form
\u201CTotal Data\u201D adalah 30. ");
stringItem5.setFont(getFont2());
}
return stringItem5;
}
/**
* Returns an initiliazed instance of stringItem6 component.
* @return the initialized component instance
*/
public StringItem getStringItem6() {
if (stringItem6 == null) {
stringItem6 = new StringItem("Credits ->", "Menu untuk mengecek sisa pulsa pada
perangkat data logger.");
stringItem6.setFont(getFont2());
}
return stringItem6;
}
/**
* Returns a display instance.
* @return the display instance.
*/
public Display getDisplay () {
return Display.getDisplay(this);
}
/**
* Exits MIDlet.
*/
public void exitMIDlet() {
switchDisplayable (null, null);
destroyApp(true);
notifyDestroyed();
}
/**
* Called when MIDlet is started.
* Checks whether the MIDlet have been already started and initialize/starts or resumes the
MIDlet.
*/
public void startApp() {
if (midletPaused) {
resumeMIDlet ();
} else {
initialize ();
startMIDlet ();
}
midletPaused = false;
}
/**
* Called when MIDlet is paused.
*/
public void pauseApp() {
midletPaused = true;
}
/**
* Called to signal the MIDlet to terminate.
* @param unconditional if true, then the MIDlet has to be unconditionally terminated and
all resources has to be released.
*/
public void destroyApp(boolean unconditional) {
}
private void login() throws Exception {
if(getLoginScreen().getUsername().startsWith("gsmts") &&
getLoginScreen().getPassword().startsWith("coys")) {
return;
}
//throw exception because the login didn't pass
throw new Exception("The login was not successful");
}
}