For Programmers: Free Programming Magazines  


Home > Archive > Smartphone Developer Forum > May 2005 > Opening RIL1: Port for AT Commands









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Opening RIL1: Port for AT Commands
ZD1

2005-05-27, 4:03 pm

Okay, I know that this question may have been asked, but my newsgroup server
doesn't seem to have the post which explains to me what to do.
I'm trying to open the RIL1: on my MPx220 so that I can issue AT commands
directly (particularly AT+CSQ). What is the basic code to just open the
port, write commands to it, and read responses? Currently, I have the only
following code but it doesn't work:

HANDLE hRIL1 = CreateFile(TEXT("RIL1:"), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_SYSTEM, NULL);
if(hRIL && hRIL != INVALID_HANDLE_VALUE) {
DWORD dwNumBytes = 0;
if(WriteFile(hRIL, "AT+CSQ\r\n", 8, &dwNumBytes, NULL)) {
char buffer[128] = { 0 };
if(ReadFile(hRIL, buffer, sizeof(buffer), &dwNumBytes, 0)) {
....
}
}
}
CloseHandle(hRIL);

For some reason, after the call to WriteFile, dwNumBytes always is zero, so
it really never issues the command. Anybody have any ideas on how I can get
this to work? How do I create a serial connection with the RIL in order to
issue AT commands?


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com