aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/call.c
diff options
context:
space:
mode:
authorSimon Busch <morphis@gravedo.de>2011-10-28 19:08:29 +0200
committerSimon Busch <morphis@gravedo.de>2011-10-28 19:08:29 +0200
commit3fcbca9b0c1ea0e8dd2ba2d43b07f8090339755d (patch)
treed2e6c41576854445a41bf634266c0936f033a2e9 /samsung-ipc/call.c
parenta38db5807753c279eba7480c0e63e0b6357fef34 (diff)
downloadexternal_libsamsung-ipc-3fcbca9b0c1ea0e8dd2ba2d43b07f8090339755d.zip
external_libsamsung-ipc-3fcbca9b0c1ea0e8dd2ba2d43b07f8090339755d.tar.gz
external_libsamsung-ipc-3fcbca9b0c1ea0e8dd2ba2d43b07f8090339755d.tar.bz2
Various changes to code and vala binding regarding call API
Signed-off-by: Simon Busch <morphis@gravedo.de>
Diffstat (limited to 'samsung-ipc/call.c')
-rw-r--r--samsung-ipc/call.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/samsung-ipc/call.c b/samsung-ipc/call.c
index 9573a8d..9d94931 100644
--- a/samsung-ipc/call.c
+++ b/samsung-ipc/call.c
@@ -36,3 +36,75 @@ void ipc_call_outgoing_setup(struct ipc_call_outgoing *message, unsigned char ty
strncpy(message->number, number, OUTGOING_NUMBER_MAX_LENGTH);
}
+/**
+ * Retrieve number of calls in list of calls.
+ **/
+unsigned int ipc_call_list_response_get_num_entries(struct ipc_response *response)
+{
+ unsigned int count = 0, n = 0;
+
+ assert(response != NULL);
+ assert(response->data != NULL);
+
+ count = (unsigned int) *((unsigned char*) response->data);
+ return count;
+}
+
+/**
+ * Retrieve one specific entry from a list of calls.
+ **/
+struct ipc_call_list_entry* ipc_call_list_response_get_entry(struct ipc_response *response, unsigned int num)
+{
+ unsigned int count = 0, pos = 1, n = 0;
+ struct ipc_call_list_entry *entry = NULL;
+
+ assert(response != NULL);
+ assert(response->data != NULL);
+
+ count = ipc_call_list_response_get_num_entries(response);
+ if (num > count)
+ return NULL;
+
+ for (n = 0; n < num; n++)
+ {
+ entry = (struct ipc_call_list_entry*) (response->data + pos);
+ pos += (unsigned int) (sizeof(struct ipc_call_list_entry) + entry->number_len);
+ }
+
+ return entry;
+}
+
+/**
+ * Retrieve the number of a call entry in the list of calls
+ **/
+char* ipc_call_list_response_get_entry_number(struct ipc_response *response, unsigned int num)
+{
+ unsigned int count = 0, pos = 1, n = 0;
+ struct ipc_call_list_entry *entry = NULL;
+ char *number = NULL;
+
+ assert(response != NULL);
+ assert(response->data != NULL);
+
+ count = ipc_call_list_response_get_num_entries(response);
+ if (num > count)
+ return NULL;
+
+ for (n = 0; n < num; n++)
+ {
+ entry = (struct ipc_call_list_entry*) (response->data + pos);
+ pos += (unsigned int) (sizeof(struct ipc_call_list_entry) + entry->number_len);
+ }
+
+ if (entry == NULL ||
+ (unsigned char*) (response->data + pos) == NULL ||
+ (unsigned char*) (response->data + pos + entry->number_len) == NULL)
+ return NULL;
+
+ number = (char*) malloc(sizeof(char) * entry->number_len);
+ strncpy(number, response->data + pos, entry->number_len);
+
+ return number;
+}
+
+