From 223246228c5224a91147a98dc394ea60efab81ef Mon Sep 17 00:00:00 2001 From: James Maki Date: Wed, 28 Apr 2010 09:57:12 -0500 Subject: optional at command init --- src/sms_main.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/sms_main.c') diff --git a/src/sms_main.c b/src/sms_main.c index 5dda451..f319019 100644 --- a/src/sms_main.c +++ b/src/sms_main.c @@ -52,12 +52,10 @@ static int pb_list(int argc, char **argv) int fd; int ret; - fd = tty_open(Global.core.device, Global.core.baud_rate); + fd = sms_device_open(); if (fd < 0) { - fprintf(stderr, "failed to open tty device %s\n", Global.core.device); return false; } - atcmd_init(fd, Global.core.read_timeout); ret = print_phonebook_list(fd, Global.core.pb_store); @@ -66,6 +64,22 @@ static int pb_list(int argc, char **argv) return ret; } +static int sms_init(int argc, char **argv) +{ + int fd; + + Global.core.sms_init = true; + + fd = sms_device_open(); + if (fd < 0) { + return false; + } + + tty_close(fd); + + return true; +} + static struct sms_cmd top_cmds[] = { { .object = "send", @@ -93,6 +107,10 @@ static struct sms_cmd top_cmds[] = { .object = "pb-list", .call = pb_list, }, + { + .object = "sms-init", + .call = sms_init, + }, { .object = NULL, .call = NULL, -- cgit v1.2.3