diff options
author | Simon Busch <morphis@gravedo.de> | 2011-11-23 19:18:10 +0100 |
---|---|---|
committer | Simon Busch <morphis@gravedo.de> | 2011-11-23 19:18:10 +0100 |
commit | 76e3d409b866f6dadc90e69f3d3e5e49f30a344b (patch) | |
tree | 073de5aae863155ddc38c5eee2f14eeb8c08a130 /samsung-ipc/sms.c | |
parent | 41e793e99e305b9148b7a8271a5bdd1e9b03e77e (diff) | |
download | external_libsamsung-ipc-76e3d409b866f6dadc90e69f3d3e5e49f30a344b.zip external_libsamsung-ipc-76e3d409b866f6dadc90e69f3d3e5e49f30a344b.tar.gz external_libsamsung-ipc-76e3d409b866f6dadc90e69f3d3e5e49f30a344b.tar.bz2 |
vapi: bind SMS structures and methods
Signed-off-by: Simon Busch <morphis@gravedo.de>
Diffstat (limited to 'samsung-ipc/sms.c')
-rw-r--r-- | samsung-ipc/sms.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/samsung-ipc/sms.c b/samsung-ipc/sms.c new file mode 100644 index 0000000..f4b7a37 --- /dev/null +++ b/samsung-ipc/sms.c @@ -0,0 +1,49 @@ +/** + * This file is part of libsamsung-ipc. + * + * Copyright (C) 2011 Simon Busch <morphis@gravedo.de> + * + * libsamsung-ipc is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * libsamsung-ipc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <radio.h> +#include <string.h> +#include <assert.h> + +unsigned char* ipc_sms_send_msg_pack(struct ipc_sms_send_msg *msg, char *smsc, + unsigned char *pdu, int pdu_length) +{ + unsigned char *data = NULL, *p = NULL; + unsigned int data_length = 0, smsc_len = 0; + + assert(smsc != NULL); + assert(pdu != NULL); + + smsc_len = strlen(smsc); + data_length = smsc_len + pdu_length + sizeof(struct ipc_sms_send_msg); + data = (unsigned char*) malloc(sizeof(unsigned char) * data_length); + memset(data, 0, data_length); + + p = data; + memcpy(p, &msg, sizeof(struct ipc_sms_send_msg)); + p += sizeof(struct ipc_sms_send_msg); + memcpy(p, (char*) (smsc + 1), smsc_len); + p += smsc_len; + memcpy(p, pdu, pdu_length); + + return data; +} + + |