Fake driver

From GnokiiWiki
Jump to: navigation, search

The fake driver is a tool used for testing. It duplicates some functionality of the AT driver but prints commands to stdout instead of sending them to a phone.

Only a subset of libgnokii commands is currently implemented in the fake driver:

  • since 0.6.29 it supports also --savesms (it prints to stdout)
  • since 0.6.30 it supports also smsd (sending and receiving both the internal and the file SMS) and partially xgnokii

Configuration

  • config: fake driver, used for testing
[global]
model = fake
port = ignored
connection = serial # any valid connection type will work

Basic usage

$ echo "This is a test" | gnokii --sendsms 1234
AT+CMGS=23
001100048121430000000E54747A0E4ACF416110BD3CA703^Z

Advanced usage

Since gnokii 0.6.29 the fake driver on non-Windows systems handles the sms_inbox parameter to test reading SMS.

Add this to you configuration:

[fake_driver]
sms_inbox = /tmp/sms

Then create the /tmp/sms directory with some files containing valid PDUs in HEX format; PDU's can be obtained using --sendsms with the fake driver, or read in the debug output printed by --sendsms or by --getsms when using the AT driver; file names are ignored, only the order as seen by readdir() is important.

For more examples see the tests in the testsuite directory which are done using the fake driver.