diff options
author | Simon Busch <morphis@gravedo.de> | 2011-10-20 07:53:17 +0200 |
---|---|---|
committer | Simon Busch <morphis@gravedo.de> | 2011-10-20 07:53:17 +0200 |
commit | eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70 (patch) | |
tree | 6eb3f12235ce8c3ca49a63a2832062a33bb07045 | |
parent | 80080d0b0c13bf24368b84a7636ffd1557654216 (diff) | |
download | external_libsamsung-ipc-eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70.zip external_libsamsung-ipc-eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70.tar.gz external_libsamsung-ipc-eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70.tar.bz2 |
Add helper method to parse imsi from response data
Signed-off-by: Simon Busch <morphis@gravedo.de>
-rw-r--r-- | include/misc.h | 4 | ||||
-rw-r--r-- | samsung-ipc/Makefile.am | 1 | ||||
-rw-r--r-- | samsung-ipc/misc.c | 34 | ||||
-rw-r--r-- | vapi/samsung-ipc-1.0.vapi | 3 |
4 files changed, 39 insertions, 3 deletions
diff --git a/include/misc.h b/include/misc.h index 3aff7e4..4b5c51e 100644 --- a/include/misc.h +++ b/include/misc.h @@ -41,9 +41,7 @@ struct ipc_misc_time_info { char plmn[6]; } __attribute__((__packed__)); -void ipc_misc_me_version(int request_id); -void ipc_misc_me_imsi(int request_id); -void ipc_misc_me_sn(int request_id); +char* ipc_parse_misc_me_imsi(uint8_t *data, unsigned int size); #endif diff --git a/samsung-ipc/Makefile.am b/samsung-ipc/Makefile.am index ec03933..01962a4 100644 --- a/samsung-ipc/Makefile.am +++ b/samsung-ipc/Makefile.am @@ -16,6 +16,7 @@ libsamsung_ipc_la_SOURCES = \ ipc.c \ ipc_util.c \ util.c \ + misc.c \ $(NULL) libsamsung_ipc_la_LIBADD = \ diff --git a/samsung-ipc/misc.c b/samsung-ipc/misc.c new file mode 100644 index 0000000..0bca9c0 --- /dev/null +++ b/samsung-ipc/misc.c @@ -0,0 +1,34 @@ +/** + * 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> + +#define DEFAULT_IMSI_LENGTH 15 + +char* ipc_parse_misc_me_imsi(uint8_t *data, unsigned int size) +{ + if (data == NULL || size != DEFAULT_IMSI_LENGTH + 1 || data[0] != DEFAULT_IMSI_LENGTH) + return NULL; + + char *buffer = (char*) malloc(sizeof(char) * DEFAULT_IMSI_LENGTH); + memcpy(buffer, &data[1], DEFAULT_IMSI_LENGTH); + return buffer; +} diff --git a/vapi/samsung-ipc-1.0.vapi b/vapi/samsung-ipc-1.0.vapi index 70a4bd3..b79f035 100644 --- a/vapi/samsung-ipc-1.0.vapi +++ b/vapi/samsung-ipc-1.0.vapi @@ -995,6 +995,9 @@ namespace SamsungIpc namespace Misc { + [CCode (cname = "ipc_parse_misc_me_imsi")] + public string parse_imsi(uint8[] data); + [CCode (cname = "struct ipc_misc_me_version", destroy_function = "", free_function = "")] public struct VersionMessage { |