diff options
author | Xia Wang <xiaw@google.com> | 2010-08-09 16:13:13 -0700 |
---|---|---|
committer | Xia Wang <xiaw@google.com> | 2010-08-09 17:00:17 -0700 |
commit | e9be34c22789d2cecd7704498c5a20547490863d (patch) | |
tree | bb2d8e324cbe115e066d57c726be39fe52ebadcd /telephony/mockril/src | |
parent | fce21b5a3365da20e48655001e7cc0dacca67831 (diff) | |
download | frameworks_base-e9be34c22789d2cecd7704498c5a20547490863d.zip frameworks_base-e9be34c22789d2cecd7704498c5a20547490863d.tar.gz frameworks_base-e9be34c22789d2cecd7704498c5a20547490863d.tar.bz2 |
Add setRadioState to MockRilController and the corresponding test case.
Add test case for setRadioState command in Mock Ril
Change-Id: I6934bc291f58743d98295b816600a6e7b980bdb1
Diffstat (limited to 'telephony/mockril/src')
-rw-r--r-- | telephony/mockril/src/com/android/internal/telephony/mockril/MockRilController.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/telephony/mockril/src/com/android/internal/telephony/mockril/MockRilController.java b/telephony/mockril/src/com/android/internal/telephony/mockril/MockRilController.java index 0bf321e..a5139bd 100644 --- a/telephony/mockril/src/com/android/internal/telephony/mockril/MockRilController.java +++ b/telephony/mockril/src/com/android/internal/telephony/mockril/MockRilController.java @@ -104,4 +104,32 @@ public class MockRilController { else return -1; } + + /** + * Set the radio state of mock ril to the given state + * @param state for given radio state + * @return true if the state is set successful, false if it fails + */ + public boolean setRadioState(int state) { + RilCtrlCmds.CtrlReqRadioState req = new RilCtrlCmds.CtrlReqRadioState(); + if (state < 0 || state > RilCmds.RADIOSTATE_NV_READY) { + Log.v(TAG, "the give radio state is not valid."); + return false; + } + req.setState(state); + if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_RADIO_STATE, 0, 0, req)) { + Log.v(TAG, "send set radio state request failed."); + return false; + } + Msg response = getCtrlResponse(); + if (response == null) { + Log.v(TAG, "failed to get response for setRadioState"); + return false; + } + response.printHeader(TAG); + RilCtrlCmds.CtrlRspRadioState resp = + response.getDataAs(RilCtrlCmds.CtrlRspRadioState.class); + int curstate = resp.getState(); + return curstate == state; + } } |