|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.bluetooth.AtParser
public class AtParser
An AT (Hayes command) Parser based on (a subset of) the ITU-T V.250 standard.
Conforment with the subset of V.250 required for implementation of the Bluetooth Headset and Handsfree Profiles, as per Bluetooth SIP specifications. Also implements some V.250 features not required by Bluetooth - such as chained commands.
Command handlers are registered with an AtParser object. These handlers are invoked when command lines are processed by AtParser's process() method.
The AtParser object accepts a new command line to parse via its process() method. It breaks each command line into one or more commands. Each command is parsed for name, type, and (optional) arguments, and an appropriate external handler method is called through the AtCommandHandler interface. The command types are
Basic commands cannot be chained in this implementation. For Bluetooth headset/handsfree use this is acceptable, because they only use the basic commands ATA and ATD, which are not allowed to be chained. For general V.250 use we would need to improve this class to allow Basic command chaining - however its tricky to get right becuase there is no deliminator for Basic command chaining.
Extended commands can be chained. For example:
AT+VGM?;+VGM=14;+CIMI
This is equivalent to:
AT+VGM? AT+VGM=14 AT+CIMI Except that only one final result code is return (although several intermediate responses may be returned), and as soon as one command in the chain fails the rest are abandonded.
Handlers are registered by there command name via register(Char c, ...) or register(String s, ...). Handlers for Basic command should be registered by the basic command character, and handlers for Extended commands should be registered by String.
Refer to:
| Constructor Summary | |
|---|---|
AtParser()
Create a new AtParser. |
|
| Method Summary | |
|---|---|
AtCommandResult |
process(String raw_input)
Processes an incoming AT command line. |
void |
register(Character command,
AtCommandHandler handler)
Register a Basic command handler. |
void |
register(String command,
AtCommandHandler handler)
Register an Extended command handler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AtParser()
No handlers are registered.
| Method Detail |
|---|
public void register(Character command,
AtCommandHandler handler)
Basic command handlers are later called via their
handleBasicCommand(String args) method.
command - Command name - a single characterhandler - Handler to register
public void register(String command,
AtCommandHandler handler)
Extended command handlers are later called via:
handleActionCommand()
handleGetCommand()
handleSetCommand()
handleTestCommand()
command - Command name - can be multiple charactershandler - Handler to registerpublic AtCommandResult process(String raw_input)
This method will invoke zero or one command handler methods for each command in the command line.
raw_input - The AT input, without EOL deliminator (e.g.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||