From e0bd5f46d10614e5448034be7460d85d4b07bcb3 Mon Sep 17 00:00:00 2001 From: Caiwen Zhang Date: Wed, 19 Dec 2012 17:05:07 +0800 Subject: [PATCH] at_modem: Add modem module skeleton Change-Id: Ibc1f552a752d221c17e14458b455d5e6196ca7f7 --- include/at_modem.h | 25 ++++++++++++++++ src/at_modem.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/include/at_modem.h b/include/at_modem.h index e69de29..60eeab1 100644 --- a/include/at_modem.h +++ b/include/at_modem.h @@ -0,0 +1,25 @@ +/* + * tel-plugin-at_standard + * + * Copyright (c) 2012 Intel Corporation. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __AT_MODEM_H__ +#define __AT_MODEM_H__ + +gboolean at_modem_init(TcorePlugin *p); +void at_modem_exit(TcorePlugin *p); + +#endif diff --git a/src/at_modem.c b/src/at_modem.c index e69de29..d78ceb3 100644 --- a/src/at_modem.c +++ b/src/at_modem.c @@ -0,0 +1,83 @@ +/* + * tel-plugin-at_standard + * + * Copyright (c) 2012 Intel Corporation. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "user_request.h" + +#include "at_modem.h" + +static TReturn get_imei(CoreObject *co, UserRequest *ur) +{ + return TCORE_RETURN_ENOSYS; +} + +static TReturn get_version(CoreObject *co, UserRequest *ur) +{ + return TCORE_RETURN_ENOSYS; +} + +static TReturn set_flight_mode(CoreObject *co, UserRequest *ur) +{ + return TCORE_RETURN_ENOSYS; +} + +static struct tcore_modem_operations modem_ops = { + .power_on = NULL, + .power_off = NULL, + .power_reset = NULL, + .set_flight_mode = set_flight_mode, + .get_imei = get_imei, + .get_version = get_version, + .get_sn = NULL, + .dun_pin_ctrl = NULL, + .get_flight_mode = NULL, +}; + +gboolean at_modem_init(TcorePlugin *p) +{ + CoreObject *co; + + co = tcore_modem_new(p, "modem", &modem_ops, NULL); + if (NULL == co) + return FALSE; + + return TRUE; +} + +void at_modem_exit(TcorePlugin *p) +{ + CoreObject *co; + + if (NULL == p) + return; + + co = tcore_plugin_ref_core_object(p, "modem"); + if (NULL == co) + return; + + tcore_modem_free(co); +} -- 2.7.4