summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2010-07-28 04:17:30 +0200
committerPatrick McHardy <kaber@trash.net>2010-07-28 09:08:31 +0200
commitc76a9cf3d92166091b4fe42e829d9649d520d07c (patch)
tree28d955183996fe5e6f5dc01abdde0a9f7ca4a0de
parented397371ed55fed8633174c0b4d236da01cde700 (diff)
example: add (non-working) PP list access (LiA) example
So far doesn't work properly with my FP, it doesn't answer, but also doesn't time out, so it appears to be somewhat working. Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--example/.gitignore1
-rw-r--r--example/Makefile.in6
-rw-r--r--example/pp-list-access.c86
-rw-r--r--include/dect/lia.h69
4 files changed, 161 insertions, 1 deletions
diff --git a/example/.gitignore b/example/.gitignore
index b3dba19..8cbc580 100644
--- a/example/.gitignore
+++ b/example/.gitignore
@@ -7,3 +7,4 @@ hijack
pp-access-rights
pp-location-update
pp-detach
+pp-list-access
diff --git a/example/Makefile.in b/example/Makefile.in
index f29508f..9af4e7b 100644
--- a/example/Makefile.in
+++ b/example/Makefile.in
@@ -1,7 +1,7 @@
CFLAGS += $(EVENT_CFLAGS)
LDFLAGS += -Wl,-rpath $(PWD)/src -Lsrc -ldect $(EVENT_LDFLAGS)
PROGRAMS += cc ss mm-fp mm-pp discover hijack
-PROGRAMS += pp-access-rights pp-location-update pp-detach
+PROGRAMS += pp-access-rights pp-location-update pp-detach pp-list-access
destdir := usr/share/dect/examples
@@ -34,6 +34,10 @@ pp-detach-destdir := $(destdir)
pp-detach-obj += $(pp-common-obj)
pp-detach-obj += pp-detach.o
+pp-list-access-destdir := $(destdir)
+pp-list-access-obj += $(pp-common-obj)
+pp-list-access-obj += pp-list-access.o
+
mm-pp-destdir := $(destdir)
mm-pp-obj += $(common-obj)
mm-pp-obj += mm-pp.o
diff --git a/example/pp-list-access.c b/example/pp-list-access.c
new file mode 100644
index 0000000..55c7bfa
--- /dev/null
+++ b/example/pp-list-access.c
@@ -0,0 +1,86 @@
+/*
+ * DECT PP List Access (LiA) example
+ *
+ * Copyright (c) 2010 Patrick McHardy <kaber@trash.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <dect/libdect.h>
+#include <dect/auth.h>
+#include <dect/lia.h>
+#include "common.h"
+
+static const struct dect_ipui ipui = {
+ .put = DECT_IPUI_N,
+ .pun.n.ipei = {
+ .emc = 0x0ba8,
+ .psn = 0xa782a,
+ },
+};
+
+static void dect_iwu_info_req(struct dect_handle *dh, struct dect_call *call)
+{
+ struct dect_ie_iwu_to_iwu iwu_to_iwu;
+ struct dect_mncc_iwu_info_param req = {
+ .iwu_to_iwu = &iwu_to_iwu,
+ };
+
+ iwu_to_iwu.sr = true;
+ iwu_to_iwu.pd = DECT_IWU_TO_IWU_PD_LIST_ACCESS;
+ iwu_to_iwu.len = 3;
+ iwu_to_iwu.data[0] = DECT_LIA_CMD_START_SESSION;
+ iwu_to_iwu.data[1] = DECT_LIA_LIST_DECT_SYSTEM_SETTINGS;
+ iwu_to_iwu.data[2] = 0x0;
+
+ dect_mncc_iwu_info_req(dh, call, &req);
+}
+
+static void dect_mncc_connect_ind(struct dect_handle *dh, struct dect_call *call,
+ struct dect_mncc_connect_param *param)
+{
+ struct dect_mncc_connect_param reply = {};
+
+ dect_mncc_connect_res(dh, call, &reply);
+ dect_iwu_info_req(dh, call);
+}
+
+static void dect_open_call(struct dect_handle *dh, const struct dect_ipui *ipui)
+{
+ struct dect_ie_basic_service basic_service;
+ struct dect_mncc_setup_param req = {
+ .basic_service = &basic_service,
+ };
+ struct dect_call *call;
+
+ call = dect_call_alloc(dh);
+ if (call == NULL)
+ return;
+
+ basic_service.class = DECT_CALL_CLASS_NORMAL;
+ basic_service.service = DECT_SERVICE_BASIC_SPEECH_DEFAULT;
+
+ dect_mncc_setup_req(dh, call, ipui, &req);
+}
+
+static struct dect_cc_ops cc_ops = {
+ .mncc_connect_ind = dect_mncc_connect_ind,
+};
+
+static struct dect_ops ops = {
+ .cc_ops = &cc_ops,
+};
+
+int main(int argc, char **argv)
+{
+ dect_pp_auth_init(&ops, &ipui);
+ dect_common_init(&ops, argv[1]);
+
+ dect_open_call(dh, &ipui);
+ dect_event_loop();
+
+ dect_common_cleanup(dh);
+ return 0;
+}
diff --git a/include/dect/lia.h b/include/dect/lia.h
new file mode 100644
index 0000000..1059254
--- /dev/null
+++ b/include/dect/lia.h
@@ -0,0 +1,69 @@
+/*
+ * DECT List Access (LiA)
+ *
+ * Copyright (c) 2010 Patrick McHardy <kaber@trash.net>
+ */
+
+#ifndef _LIBDECT_DECT_LIA_H
+#define _LIBDECT_DECT_LIA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup cc
+ * @{
+ * @defgroup lia List Access (LiA)
+ * @{
+ */
+
+/**
+ * LiA List Identifiers
+ */
+enum dect_lia_lists {
+ DECT_LIA_LIST_SUPPORTED_LISTS = 0x0, /**< List of supported lists */
+ DECT_LIA_LIST_MISSED_CALLS = 0x1, /**< Missed calls list */
+ DECT_LIA_LIST_OUTGOING_CALLS = 0x2, /**< Outgoing calls list */
+ DECT_LIA_LIST_INCOMING_ACCEPTED_CALLS = 0x3, /**< Incoming accepted calls list */
+ DECT_LIA_LIST_ALL_CALLS = 0x4, /**< All calls list */
+ DECT_LIA_LIST_CONTACTS = 0x5, /**< Contact list */
+ DECT_LIA_LIST_INTERNAL_NAMES = 0x6, /**< Internal names list */
+ DECT_LIA_LIST_DECT_SYSTEM_SETTINGS = 0x7, /**< DECT system settings list */
+ DECT_LIA_LIST_LINE_SETTINGS = 0x8, /**< Line settings list */
+};
+
+/**
+ * LiA List Access Commands
+ */
+enum dect_lia_commands {
+ DECT_LIA_CMD_START_SESSION = 0x00,
+ DECT_LIA_CMD_START_SESSION_CONFIRM = 0x01,
+ DECT_LIA_CMD_END_SESSION = 0x02,
+ DECT_LIA_CMD_END_SESSION_CONFIRM = 0x03,
+ DECT_LIA_CMD_QUERY_ENTRY_FIELDS = 0x04,
+ DECT_LIA_CMD_QUERY_ENTRY_FIELDS_CONFIRM = 0x05,
+ DECT_LIA_CMD_READ_ENTRIES = 0x06,
+ DECT_LIA_CMD_READ_ENTRIES_CONFIRM = 0x07,
+ DECT_LIA_CMD_EDIT_ENTRY = 0x08,
+ DECT_LIA_CMD_EDIT_ENTRY_CONFIRM = 0x09,
+ DECT_LIA_CMD_SAVE_ENTRY = 0x0a,
+ DECT_LIA_CMD_SAVE_ENTRY_CONFIRM = 0x0b,
+ DECT_LIA_CMD_DELETE_ENTRY = 0x0c,
+ DECT_LIA_CMD_DELETE_ENTRY_CONFIRM = 0x0d,
+ DECT_LIA_CMD_DELETE_LIST = 0x0e,
+ DECT_LIA_CMD_DELETE_LIST_CONFIRM = 0x0f,
+ DECT_LIA_CMD_SEARCH_ENTRIES = 0x10,
+ DECT_LIA_CMD_SEARCH_ENTRIES_CONFIRM = 0x11,
+ DECT_LIA_CMD_NEGATIVE_ACKNOWLEDGEMENT = 0x12,
+ DECT_LIA_CMD_DATA_PACKET = 0x13,
+ DECT_LIA_CMD_DATA_PACKET_LAST = 0x14,
+};
+
+/** @} */
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _LIBDECT_DECT_LIA_H */