dect
/
libdect
Archived
13
0
Fork 0

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>
This commit is contained in:
Patrick McHardy 2010-07-28 04:17:30 +02:00
parent ed397371ed
commit c76a9cf3d9
4 changed files with 161 additions and 1 deletions

1
example/.gitignore vendored
View File

@ -7,3 +7,4 @@ hijack
pp-access-rights
pp-location-update
pp-detach
pp-list-access

View File

@ -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

86
example/pp-list-access.c Normal file
View File

@ -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;
}

69
include/dect/lia.h Normal file
View File

@ -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 */