aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sms.h2
-rw-r--r--samsung-ipc/Makefile.am1
-rw-r--r--samsung-ipc/sms.c49
-rw-r--r--vapi/samsung-ipc-1.0.vapi96
4 files changed, 148 insertions, 0 deletions
diff --git a/include/sms.h b/include/sms.h
index 45109d1..aecb8c1 100644
--- a/include/sms.h
+++ b/include/sms.h
@@ -55,6 +55,8 @@
void ipc_sms_send_msg(unsigned char *data, unsigned char length, int request_id);
void ipc_sms_deliver_report(int request_id);
+unsigned char* ipc_sms_send_msg_pack(struct ipc_sms_send_msg *msg, char *smsc, unsigned char *pdu, int length);
+
#endif
// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/Makefile.am b/samsung-ipc/Makefile.am
index 03c0f9e..cee8d28 100644
--- a/samsung-ipc/Makefile.am
+++ b/samsung-ipc/Makefile.am
@@ -24,6 +24,7 @@ libsamsung_ipc_la_SOURCES = \
gprs.c \
call.c \
net.c \
+ sms.c \
$(NULL)
if WANT_PROTOCOL_VERISON_CRESPO
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;
+}
+
+
diff --git a/vapi/samsung-ipc-1.0.vapi b/vapi/samsung-ipc-1.0.vapi
index 3219f26..89b44eb 100644
--- a/vapi/samsung-ipc-1.0.vapi
+++ b/vapi/samsung-ipc-1.0.vapi
@@ -989,6 +989,102 @@ namespace SamsungIpc
/* ******************************************************************************** */
+ namespace Sms
+ {
+ [CCode (ctype = "gint8", cname = "IPC_SMS_MSG_", has_type_id = false)]
+ public enum MessageAmountType
+ {
+ MULTIPLE,
+ SINGLE,
+ }
+
+ [CCode (ctype = "gint8", cname = "IPC_SMS_TYPE_", has_type_id = false)]
+ public enum MessageType
+ {
+ POINT_TO_POINT,
+ STATUS_REPORT,
+ OUTGOING,
+ }
+
+ [CCode (cname = "gint8", cname = "IPC_SMS_ACK_", has_type_id = false)]
+ public enum AcknowledgeErrorType
+ {
+ NO_ERROR,
+ PDA_FULL_ERROR,
+ MAILFORMED_REQ_ERROR,
+ UNSPEC_ERROR,
+ }
+
+ [CCode (cname = "struct ipc_sms_incoming_msg")]
+ public struct IncomingMessage
+ {
+ public uint8 msg_type;
+ public uint8 type;
+ public uint16 sim_index;
+ public uint8 msg_tpid;
+ public uint8 length;
+
+ public unowned uint8[] data
+ {
+ get
+ {
+ unowned uint8[] res = (uint8[])(&this);
+ res.length = (int) sizeof( IncomingMessage );
+ return res;
+ }
+ }
+
+ public uint8[] unpack_pdu( Response response )
+ {
+ uint8[] pdu = new uint8[this.length];
+ uint8 *pdu_start = response.data + sizeof( IncomingMessage );
+ Memory.copy(pdu, pdu_start, this.length);
+ return pdu;
+ }
+ }
+
+ [CCode (cname = "struct ipc_sms_send_msg")]
+ public struct SendMessage
+ {
+ public uint8 type;
+ public uint8 msg_type;
+ public uint8 length;
+ public uint8 smsc_len;
+
+ public uint8[] pack(string smsc, uint8[] pdu);
+
+ public unowned uint8[] data
+ {
+ get
+ {
+ unowned uint8[] res = (uint8[])(&this);
+ res.length = (int) sizeof( SendMessage );
+ return res;
+ }
+ }
+ }
+
+ [CCode (cname = "struct ipc_sms_deliv_report_msg")]
+ public struct DeliverReportMessage
+ {
+ public uint8 type;
+ public uint16 error;
+ public uint8 msg_tpid;
+
+ public unowned uint8[] data
+ {
+ get
+ {
+ unowned uint8[] res = (uint8[])(&this);
+ res.length = (int) sizeof( DeliverReportMessage );
+ return res;
+ }
+ }
+ }
+ }
+
+ /* ******************************************************************************** */
+
[CCode (cname = "struct ipc_message_info", destroy_function = "", free_function = "")]
public struct Request
{