now it works!!i just added this code into
SampleSmsApp.this code is from a
sample,SampleWrite.java of commapi2.0.it seems that
the "static" helps!
-----------------
static Enumeration portList;
static CommPortIdentifier portId;
static String messageString = "ATDT64261526
\r";//Hello, world!\n";
static SerialPort serialPort;
static OutputStream outputStream;
public SampleSmsApp() {
}
public static void main(String[] args) {
main(){
Enumeration portList =
CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements())
{
System.out.print\("more...\n"\);
portId = (CommPortIdentifier)
portList.nextElement();
if (portId.getPortType() ==
CommPortIdentifier.PORT_SERIAL)
{
System.out.print\(portId.getName\(\)
+ "\n");
if (false && portId.getName().equals
("COM1"))
{
//if (portId.getName().equals
("/dev/term/a")) {
try {
serialPort = (SerialPort)
portId.open
("SimpleWriteApp", 2000);
} catch (PortInUseException e) {}
try {
outputStream =
serialPort.getOutputStream();
} catch (IOException e) {}
try {
serialPort.setSerialPortParams
(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch
(UnsupportedCommOperationException e) {}
try {
outputStream.write
(messageString.getBytes());
System.out.println
(messageString);
} catch (IOException e) {}
try {
Thread.currentThread().sleep
(5000);
} catch (Exception e) {}
}
}
}
-------------------
SampleSmsApp myApp = new SampleSmsApp();
SmsTerminal term = null;
System.err.println\("SampleSmsApp starting"\);
...
}
but i still think that there is sth. wrong with this
sample.
i am a chinese.i am trying to send sms with local
short message center.now i am working.i think i just
need to changed the HEAD and maybe UD type.i just know
2 kinds of UD type,one is 7bits and one of 2bytes
here is one local sms sample:
at+cmgl=4
+CMGL: 1,1,,22
0891683108502105F0000D91683169123353F200001001136104810
0022010
now i am reading SmsMsgOutgoing.java.i feel strange
that private String smscAddress;
and no public method to set it!
Logged In: NO
Isn't chinese support characters use different character sets?