السلام عليكــم ورحمـة الله وبركاتــه ،،
عندي سؤال في ال AT COMMAND
عندي برنامج يقوم بقراءة الرسائل من الخلوي
الحمد لله قمت بتجربة البرنامج واشتغل
لكن عندي سؤال
كيف اجعل البرنامج يقرأ الرسائل الجديدة فقط
ويقوم بتحديد
رقم المرسل
تاريخ الرسالة
نص الرسالة
ثم يقوم بحذف هذه الرسالة من صندوق الوارد
ارجو المساعدة لان الموضوع بغاية الاهمية بالنسبة لي
انا استعمل جهاز نوكيا 6600
لاني وجدته الوحديد من عائلة وكيا الحديثة التي تدعم AT COMMAND
الكود هو
import java.io.*;
import java.util.*;
import javax.comm.*;
/**
* Class declaration
*
*
* @author
* @version 1.8, 08/03/00
*/
public class SimpleRead implements Runnable, SerialPortEventListener {
static CommPortIdentifier portId;
static Enumeration portList;
InputStream inputStream;
//static String messageString = "AT+CMGL=\"1\"; \n\r";
static String messageString = "AT+CMGL=\"ALL\"; \n\r";
SerialPort serialPort;
Thread readThread;
static OutputStream outputStream;
/**
* Method declaration
*
*
* @param args
*
* @see
*/
public static void main(String[] args) {
boolean portFound = false;
String defaultPort = "COM7";
//defaultPort.open();
if (args.length > 0) {
defaultPort = args[0];
}
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals(defaultPort)) {
System.out.println("Found port: "+defaultPort);
portFound = true;
SimpleRead reader = new SimpleRead();
}
}
}
if (!portFound) {
System.out.println("port " + defaultPort + " not found.");
}
}
/**
* Constructor declaration
*
*
* @see
*/
public SimpleRead() {
try {
serialPort = (SerialPort) portId.open("SimpleReadApp", 10000);
} catch (PortInUseException e) {}
try {
inputStream = serialPort.getInputStream();
} catch (IOException e) {}
try {
serialPort.addEventListener(this);
} catch (TooManyListenersException e) {}
serialPort.notifyOnDataAvailable(true);
try {
serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {}
readThread = new Thread(this);
readThread.start();
// send at command
try {
outputStream = serialPort.getOutputStream();
} catch (IOException e) {}
System.out.println(
"Writing command to "
+serialPort.getName());
try {
outputStream.write(messageString.getBytes());
} catch (IOException e) {}
try {
Thread.sleep(5000); // Be sure data is xferred before closing
} catch (Exception e) {}
/////////////////////////////////
}
/**
* Method declaration
*
*
* @see
*/
public void run() {
try {
Thread.sleep(20000);
} catch (InterruptedException e) {}
}
/**
* Method declaration
*
*
* @param event
*
* @see
*/
public void serialEvent(SerialPortEvent event) {
switch (event.getEventType()) {
case SerialPortEvent.BI:
case SerialPortEvent.OE:
case SerialPortEvent.FE:
case SerialPortEvent.PE:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.RI:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;
case SerialPortEvent.DATA_AVAILABLE:
byte[] readBuffer = new byte[200];
try {
while (inputStream.available() > 0) {
int numBytes = inputStream.read(readBuffer);
}
System.out.println(new String(readBuffer));
} catch (IOException e) {}
break;
}
}
}لقد وجدت على الموقع
http://www.activexperts.com/xmstoolkit/atcommands/nokia/
اوامر at command
لكن لا يوجد شيء للتفصيل
كيفية الاستخدام
؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟