[Gpephone-devel] portable gsm engine
Robert Csordas
xdever at gmail.com
Wed Nov 21 20:38:13 CET 2007
Dear GPEPhone team!
I am currently working on a GSM engine, because none of the present
Linux-based phone engines works on my phone (HTC Magician). It has
the advantages, that the GSM modem can
be described with very simple scripts. The whole communication,
command and response parsing and conflict-avoiding mechanism is built
into the engine, the script only describes the commands and the
possible responses. It can match the modem's responses with predefined
patters automatically, so needed status codes can be extracted very
easily.This makes the scripts simple. Server has a list of predefined
functions needed to do some functions (for example function
dial(number) is needed to be present in the script to enable dialing),
and the server detects their presence and enables/disables these
functions accordingly (for example if functions for GPRS are found in
script, the GPRS functionality will be automatically available. The
clients (like dialer, phonebook, message-program. etc) communicates
with the engine on a predefined TCP/IP based interface. The server is
modular, it can load external modules for providing extra functions.
The formal definition of the script language (EBNF notation, it will
be extended later, if needed):
--------------------------------------------------------------------------------------------------------------------
identifier = [a-zA-Z][a-zA-Z0-9_]*
number = [0-9]+ | 0[xX][0-9A-Fa-f]+
string = "[\x20-\x7E]"
variable = $[a-zA-Z][a-zA-Z0-9_]*
operator = '+' | '-' | '*' | '/' | '%' | '|' | '&' | '>>' | '<<' | '<'
| '>' | '==' | '>=' | '<=' | '!=' | '='
unary_operator = '-' | '~'
postfix_operator = '++' | '--'
keyword = 'command' string
| 'report' status
expr = variable
| number
| '(' expr ')'
| expr operator expr
| unary_operator expr
| variable postfix_operator
| function_call
stmt = 'if' '(' expr ')' block
| 'for' '(' expr? ';' expr? ';' expr?) block
| 'while' '(' expr ')' block
| 'do' stmts 'while' '(' expr ')'
| function_call
| variable '=' expr
| 'switch' '(' expr ')' '{' (expr ':' block)+ '}'
| keqword
| block
stmts = stmt
| stmts ';' stmt
block = stmt
| '{' stmts '}'
fucntion_call = identifier '(' (expr | ((expr ',')+ expr)) ')'
fucntion_def = identifier '(' (variable | ((variable ',')+ variable))
')' '{' stmts '}'
response_defs = (string '{' stmts '}')+
global_events = 'events' '{' response_def '}' ';'
global_responses = 'global_responses' '{' response_def '}' ';'
program = global_events
global_responses
fucntion_def+
--------------------------------------------------------------------------------------------------------------------
The most basic dial function for the HTC Magician can be described like this:
--------------------------------------------------------------------------------------------------------------------
events{
"+CREG: [int:stat]"{
case_report $stat{
0: OPERATOR_DISCONNECTED;
1: OPERATOR_HOME_REGISTERED;
2: OPERATOR_SEARCHING;
3: OPERATOR_ACCESS_DENIED;
5: OPERATOR_ROAMING;
}
}
};
global_responses{
"OK"{
report OK;
}
};
enable(){
command "AT+CFUN=1";
}
disable(){
command "AT+CFUN=1";
}
select_default_operator(){
command "AT+COPS=0";
}
dial($num){
command "ATD#num#;"{
"NO CARRIER"{
report NO_CARRIER;
}
"NO ANSWER"{
report NO_ANSWER;
}
"BUSY"{
report BUSY;
}
}
}
hangup(){
command "ATH";
}
--------------------------------------------------------------------------------------------------------------------
Are you interested in this project? It will enable,
that Your system will be very easily portable to any GSM modem... The
interpreter is completed, I'm now working on the client interface, and
on the server modules. I think that it will be functional before the
end of this year on in January of next...
It's written in C, and it's under GPL license.
And sorry for my bad English
Robert Csordas
xdever at gmail.com
More information about the Gpephone-devel
mailing list