blob: d6c8cc617169edec032ce4d31cd3e7406a1884db [file]
// SPDX-License-Identifier: GPL-2.0-or-later
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2014 Intel Corporation. All rights reserved.
*
*
*/
#include <sys/socket.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include "src/shared/hfp.h"
#include "src/shared/tester.h"
#include "src/shared/util.h"
struct session {
bool completed;
guint step;
};
struct context {
guint watch_id;
int fd_server;
int fd_client;
struct hfp_gw *hfp;
struct hfp_hf *hfp_hf;
const struct test_data *data;
unsigned int pdu_offset;
struct session session;
};
struct test_pdu {
bool valid;
uint8_t *data;
size_t size;
enum hfp_gw_cmd_type type;
bool fragmented;
};
struct test_data {
char *test_name;
struct test_pdu *pdu_list;
hfp_result_func_t result_func;
hfp_response_func_t response_func;
hfp_hf_result_func_t hf_result_func;
GIOFunc test_handler;
};
#define data(args...) ((const unsigned char[]) { args })
#define raw_pdu(args...) \
{ \
.valid = true, \
.data = util_memdup(data(args), sizeof(data(args))), \
.size = sizeof(data(args)), \
}
#define data_end() \
{ \
.valid = false, \
}
#define type_pdu(cmd_type, args...) \
{ \
.valid = true, \
.data = util_memdup(data(args), sizeof(data(args))), \
.size = sizeof(data(args)), \
.type = cmd_type, \
}
#define frg_pdu(args...) \
{ \
.valid = true, \
.data = util_memdup(data(args), sizeof(data(args))), \
.size = sizeof(data(args)), \
.fragmented = true, \
}
#define define_test(name, function, result_function, args...) \
do { \
const struct test_pdu pdus[] = { \
args, { } \
}; \
static struct test_data data; \
data.test_name = g_strdup(name); \
data.pdu_list = util_memdup(pdus, sizeof(pdus)); \
data.result_func = result_function; \
tester_add(name, &data, NULL, function, NULL); \
data.test_handler = test_handler; \
} while (0)
#define define_hf_test(name, function, result_func, response_function, \
args...)\
do { \
const struct test_pdu pdus[] = { \
args, { } \
}; \
static struct test_data data; \
data.test_name = g_strdup(name); \
data.pdu_list = util_memdup(pdus, sizeof(pdus)); \
data.hf_result_func = result_func; \
data.response_func = response_function; \
tester_add(name, &data, NULL, function, NULL); \
data.test_handler = test_hf_handler; \
} while (0)
static void print_debug(const char *str, void *user_data)
{
const char *prefix = user_data;
if (tester_use_debug())
tester_debug("%s%s", prefix, str);
}
static void test_free(gconstpointer user_data)
{
const struct test_data *data = user_data;
struct test_pdu *pdu;
int i;
for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
g_free(pdu->data);
g_free(data->test_name);
g_free(data->pdu_list);
}
static void destroy_context(struct context *context)
{
if (context->watch_id)
g_source_remove(context->watch_id);
if (context->hfp)
hfp_gw_unref(context->hfp);
if (context->hfp_hf)
hfp_hf_unref(context->hfp_hf);
test_free(context->data);
g_free(context);
}
static gboolean context_quit(gpointer user_data)
{
struct context *context = user_data;
if (context == NULL)
return FALSE;
destroy_context(context);
tester_test_passed();
return FALSE;
}
static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
gpointer user_data)
{
struct context *context = user_data;
const struct test_pdu *pdu;
pdu = &context->data->pdu_list[context->pdu_offset++];
g_assert(!pdu->valid);
context->watch_id = 0;
context_quit(context);
return FALSE;
}
static gboolean send_pdu(gpointer user_data)
{
struct context *context = user_data;
const struct test_pdu *pdu;
ssize_t len;
pdu = &context->data->pdu_list[context->pdu_offset++];
if (!pdu)
return FALSE;
if (!pdu->valid) {
context->data->response_func(HFP_RESULT_OK, 0, context);
return FALSE;
}
len = write(context->fd_server, pdu->data, pdu->size);
g_assert_cmpint(len, ==, pdu->size);
pdu = &context->data->pdu_list[context->pdu_offset];
if (pdu->fragmented || (!pdu->valid && context->data->response_func))
g_idle_add(send_pdu, context);
return FALSE;
}
static gboolean test_hf_handler(GIOChannel *channel, GIOCondition cond,
gpointer user_data)
{
struct context *context = user_data;
gchar buf[60];
gsize bytes_read;
GError *error = NULL;
if (cond & (G_IO_HUP | G_IO_ERR | G_IO_NVAL))
goto done;
/* dummy read */
g_io_channel_read_chars(channel, buf, 60, &bytes_read, &error);
send_pdu(context);
return TRUE;
done:
context->watch_id = 0;
context_quit(context);
return FALSE;
}
static void cmd_handler(const char *command, void *user_data)
{
struct context *context = user_data;
const struct test_pdu *pdu;
unsigned int cmd_len = strlen(command);
pdu = &context->data->pdu_list[context->pdu_offset++];
g_assert(cmd_len == pdu->size);
g_assert(!memcmp(command, pdu->data, cmd_len));
hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
}
static void prefix_handler(struct hfp_context *result,
enum hfp_gw_cmd_type type, void *user_data)
{
struct context *context = user_data;
const struct test_pdu *pdu;
pdu = &context->data->pdu_list[context->pdu_offset++];
g_assert(type == pdu->type);
hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
}
static struct context *create_context(gconstpointer data)
{
struct context *context = g_new0(struct context, 1);
GIOChannel *channel;
int err, sv[2];
const struct test_data *d = data;
err = socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sv);
g_assert(err == 0);
channel = g_io_channel_unix_new(sv[1]);
g_io_channel_set_close_on_unref(channel, TRUE);
g_io_channel_set_encoding(channel, NULL, NULL);
g_io_channel_set_buffered(channel, FALSE);
context->watch_id = g_io_add_watch(channel,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
d->test_handler, context);
g_assert(context->watch_id > 0);
g_io_channel_unref(channel);
context->fd_server = sv[1];
context->fd_client = sv[0];
context->data = data;
return context;
}
static void test_init(gconstpointer data)
{
struct context *context = create_context(data);
context->hfp = hfp_gw_new(context->fd_client);
g_assert(context->hfp);
g_assert(hfp_gw_set_close_on_unref(context->hfp, true));
hfp_gw_unref(context->hfp);
context->hfp = NULL;
context_quit(context);
}
static void test_command_handler(gconstpointer data)
{
struct context *context = create_context(data);
const struct test_pdu *pdu;
ssize_t len;
bool ret;
context->hfp = hfp_gw_new(context->fd_client);
g_assert(context->hfp);
pdu = &context->data->pdu_list[context->pdu_offset++];
ret = hfp_gw_set_close_on_unref(context->hfp, true);
g_assert(ret);
ret = hfp_gw_set_command_handler(context->hfp, cmd_handler,
context, NULL);
g_assert(ret);
len = write(context->fd_server, pdu->data, pdu->size);
g_assert_cmpint(len, ==, pdu->size);
context_quit(context);
}
static void test_register(gconstpointer data)
{
struct context *context = create_context(data);
const struct test_pdu *pdu;
ssize_t len;
bool ret;
context->hfp = hfp_gw_new(context->fd_client);
g_assert(context->hfp);
pdu = &context->data->pdu_list[context->pdu_offset++];
ret = hfp_gw_set_close_on_unref(context->hfp, true);
g_assert(ret);
if (context->data->result_func) {
ret = hfp_gw_register(context->hfp, context->data->result_func,
(char *)pdu->data, context, NULL);
g_assert(ret);
}
pdu = &context->data->pdu_list[context->pdu_offset++];
len = write(context->fd_server, pdu->data, pdu->size);
g_assert_cmpint(len, ==, pdu->size);
context_quit(context);
}
static void test_fragmented(gconstpointer data)
{
struct context *context = create_context(data);
bool ret;
context->hfp = hfp_gw_new(context->fd_client);
g_assert(context->hfp);
ret = hfp_gw_set_close_on_unref(context->hfp, true);
g_assert(ret);
g_idle_add(send_pdu, context);
}
static void test_send_and_close(gconstpointer data)
{
struct context *context = create_context(data);
bool ret;
context->hfp = hfp_gw_new(context->fd_client);
g_assert(context->hfp);
ret = hfp_gw_set_close_on_unref(context->hfp, true);
g_assert(ret);
send_pdu(context);
hfp_gw_unref(context->hfp);
context->hfp = NULL;
context_quit(context);
}
static void check_ustring_1(struct hfp_context *result,
enum hfp_gw_cmd_type type, void *user_data)
{
struct context *context = user_data;
const struct test_pdu *pdu;
unsigned int i = 3, j = 0;
char str[10];
pdu = &context->data->pdu_list[context->pdu_offset++];
g_assert(type == pdu->type);
g_assert(hfp_context_get_unquoted_string(result, str, sizeof(str)));
while (context->data->pdu_list[1].data[i] != '\r') {
g_assert(j < sizeof(str));
g_assert(str[j] == context->data->pdu_list[1].data[i]);
i++;
j++;
}
g_assert(str[j] == '\0');
hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
}
static void check_ustring_2(struct hfp_context *result,
enum hfp_gw_cmd_type type, void *user_data)
{
struct context *context = user_data;
const struct test_pdu *pdu;
char str[10];
memset(str, 'X', sizeof(str));
pdu = &context->data->pdu_list[context->pdu_offset++];
g_assert(type == pdu->type);
g_assert(!hfp_context_get_unquoted_string(result, str, 3));
g_assert(str[3] == 'X');
hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
}
static void check_string_1(struct hfp_context *result,
enum hfp_gw_cmd_type type, void *user_data)
{
struct context *context = user_data;
const struct test_pdu *pdu;
unsigned int i = 4, j = 0;
char str[10];
pdu = &context->data->pdu_list[context->pdu_offset++];
g_assert(type == pdu->type);
g_assert(hfp_context_get_string(result, str, sizeof(str)));
while (context->data->pdu_list[1].data[i] != '\"') {
g_assert(j < sizeof(str));
g_assert(str[j] == context->data->pdu_list[1].data[i]);
i++;
j++;
}
g_assert(context->data->pdu_list[1].data[i] == '\"');
g_assert(str[j] == '\0');
hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
}
static void check_string_2(struct hfp_context *result,
enum hfp_gw_cmd_type type, void *user_data)
{
struct context *context = user_data;
const struct test_pdu *pdu;
char str[10];
memset(str, 'X', sizeof(str));
pdu = &context->data->pdu_list[context->pdu_offset++];
g_assert(type == pdu->type);
g_assert(!hfp_context_get_string(result, str, 3));
g_assert(str[3] == 'X');
hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
}
static void check_string_3(struct hfp_context *result,
enum hfp_gw_cmd_type type, void *user_data)
{
struct context *context = user_data;
const struct test_pdu *pdu;
pdu = &context->data->pdu_list[context->pdu_offset++];
g_assert(type == pdu->type);
hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
}
static void test_hf_init(gconstpointer data)
{
struct context *context = create_context(data);
context->hfp_hf = hfp_hf_new(context->fd_client);
g_assert(context->hfp_hf);
g_assert(hfp_hf_set_close_on_unref(context->hfp_hf, true));
hfp_hf_unref(context->hfp_hf);
context->hfp_hf = NULL;
context_quit(context);
}
static bool unsolicited_resp = false;
static void hf_unsolicited_resp_cb(struct hfp_context *context,
void *user_data) {
unsolicited_resp = true;
}
static void hf_response_with_data(enum hfp_result res,
enum hfp_error cme_err,
void *user_data)
{
struct context *context = user_data;
g_assert(unsolicited_resp);
unsolicited_resp = false;
hfp_hf_disconnect(context->hfp_hf);
}
static void hf_cme_error_response_cb(enum hfp_result res,
enum hfp_error cme_err,
void *user_data)
{
struct context *context = user_data;
g_assert_cmpint(res, ==, HFP_RESULT_CME_ERROR);
g_assert_cmpint(cme_err, ==, 30);
hfp_hf_disconnect(context->hfp_hf);
}
static void hf_response_cb(enum hfp_result res, enum hfp_error cme_err,
void *user_data)
{
struct context *context = user_data;
hfp_hf_disconnect(context->hfp_hf);
}
static void test_hf_send_command(gconstpointer data)
{
struct context *context = create_context(data);
const struct test_pdu *pdu;
bool ret;
context->hfp_hf = hfp_hf_new(context->fd_client);
g_assert(context->hfp_hf);
ret = hfp_hf_set_close_on_unref(context->hfp_hf, true);
g_assert(ret);
if (context->data->response_func) {
if (context->data->hf_result_func) {
pdu = &context->data->pdu_list[context->pdu_offset++];
ret = hfp_hf_register(context->hfp_hf,
context->data->hf_result_func,
(char *)pdu->data,
NULL, NULL);
g_assert(ret);
}
pdu = &context->data->pdu_list[context->pdu_offset++];
ret = hfp_hf_send_command(context->hfp_hf,
context->data->response_func,
context, (char *)pdu->data);
g_assert(ret);
}
context_quit(context);
}
static void hf_chld_result_handler(struct hfp_context *hf_context,
void *user_data)
{
struct context *context = user_data;
char str[3];
g_assert(hf_context);
g_assert(hfp_context_get_unquoted_string(hf_context, str,
sizeof(str)));
g_assert_cmpstr(str, ==, "1");
g_assert(hfp_context_get_unquoted_string(hf_context, str,
sizeof(str)));
g_assert_cmpstr(str, ==, "2x");
hfp_hf_disconnect(context->hfp_hf);
}
static void hf_chld_skip_field(struct hfp_context *hf_context,
void *user_data)
{
struct context *context = user_data;
char str[3];
g_assert(hf_context);
hfp_context_skip_field(hf_context);
g_assert(hfp_context_get_unquoted_string(hf_context, str,
sizeof(str)));
g_assert_cmpstr(str, ==, "2x");
hfp_hf_disconnect(context->hfp_hf);
}
static void hf_clcc_result_handler(struct hfp_context *hf_context,
void *user_data)
{
struct context *context = user_data;
char name[10];
uint32_t val1, val2;
g_assert(hf_context);
g_assert(hfp_context_open_container(hf_context));
g_assert(hfp_context_get_string(hf_context, name, sizeof(name)));
g_assert_cmpstr(name, ==, "call");
g_assert(hfp_context_open_container(hf_context));
g_assert(hfp_context_get_number(hf_context, &val1));
g_assert_cmpint(val1, ==, 0);
g_assert(hfp_context_get_number(hf_context, &val1));
g_assert_cmpint(val1, ==, 1);
g_assert(hfp_context_close_container(hf_context));
g_assert(hfp_context_close_container(hf_context));
g_assert(hfp_context_open_container(hf_context));
g_assert(hfp_context_get_string(hf_context, name, sizeof(name)));
g_assert_cmpstr(name, ==, "callsetup");
g_assert(hfp_context_open_container(hf_context));
g_assert(hfp_context_get_range(hf_context, &val1, &val2));
g_assert_cmpint(val1, ==, 0);
g_assert_cmpint(val2, ==, 3);
g_assert(hfp_context_close_container(hf_context));
g_assert(hfp_context_close_container(hf_context));
hfp_hf_disconnect(context->hfp_hf);
}
static void hf_result_handler(struct hfp_context *result,
void *user_data)
{
struct context *context = user_data;
hfp_hf_disconnect(context->hfp_hf);
}
static void test_hf_unsolicited(gconstpointer data)
{
struct context *context = create_context(data);
bool ret;
context->hfp_hf = hfp_hf_new(context->fd_client);
g_assert(context->hfp_hf);
ret = hfp_hf_set_close_on_unref(context->hfp_hf, true);
g_assert(ret);
if (context->data->hf_result_func) {
const struct test_pdu *pdu;
pdu = &context->data->pdu_list[context->pdu_offset++];
ret = hfp_hf_register(context->hfp_hf,
context->data->hf_result_func,
(char *)pdu->data, context,
NULL);
g_assert(ret);
}
send_pdu(context);
}
static void test_hf_robustness(gconstpointer data)
{
struct context *context = create_context(data);
bool ret;
context->hfp_hf = hfp_hf_new(context->fd_client);
g_assert(context->hfp_hf);
ret = hfp_hf_set_close_on_unref(context->hfp_hf, true);
g_assert(ret);
send_pdu(context);
hfp_hf_unref(context->hfp_hf);
context->hfp_hf = NULL;
context_quit(context);
}
#define MINIMAL_SLC_SESSION(service, call, callsetup, callheld) \
raw_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', ':', \
' ', '0', '\r', '\n'), \
frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', '+', 'C', 'I', 'N', 'D', ':', ' '), \
frg_pdu('(', '\"', 's', 'e', 'r', 'v', 'i', 'c', 'e'), \
frg_pdu('\"', ',', '(', '0', ',', '1', ')', ')', ','), \
frg_pdu('(', '\"', 'c', 'a', 'l', 'l', '\"', ','), \
frg_pdu('(', '0', ',', '1', ')', ')', ','), \
frg_pdu('(', '\"', 'c', 'a', 'l', 'l', 's', 'e', 't'), \
frg_pdu('u', 'p', '\"', ',', '(', '0', '-', '3', ')'), \
frg_pdu(')', ','), \
frg_pdu('(', '\"', 'c', 'a', 'l', 'l', 'h', 'e', 'l'), \
frg_pdu('d', '\"', ',', '(', '0', '-', '2', ')', ')'), \
frg_pdu(',', '(', '\"', 's', 'i', 'g', 'n', 'a', 'l'), \
frg_pdu('\"', ',', '(', '0', '-', '5', ')', ')', ','), \
frg_pdu('(', '\"', 'r', 'o', 'a', 'm', '\"', ',', '('), \
frg_pdu('0', ',', '1', ')', ')', ','), \
frg_pdu('(', '\"', 'b', 'a', 't', 't', 'c', 'h', 'g'), \
frg_pdu('\"', ',', '(', '0', '-', '5', ')', ')', ','), \
frg_pdu('\r', '\n'), \
frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', '+', 'C', 'I', 'N', 'D', ':', ' '), \
frg_pdu(service, ',', call, ',', callsetup, ',', callheld, ','), \
frg_pdu('5', ',', '0', ',', '5', '\r', '\n'), \
frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', '+', 'C', 'O', 'P', 'S', ':', ' '), \
frg_pdu('0', ',', '0', ',', '\"', 'T', 'E', 'S', 'T'), \
frg_pdu('\"', '\r', '\n'), \
frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n')
#define FULL_SLC_SESSION(service, call, callsetup, callheld) \
raw_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', ':', \
' ', '1', '6', '3', '8', '3', '\r', '\n'), \
frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', '+', 'C', 'I', 'N', 'D', ':', ' ', \
'(', '\"', 's', 'e', 'r', 'v', 'i', 'c', 'e', '\"', ',', \
'(', '0', ',', '1', ')', ')', ',', \
'(', '\"', 'c', 'a', 'l', 'l', '\"', ',', '(', '0', ',', \
'1', ')', ')', ',', \
'(', '\"', 'c', 'a', 'l', 'l', 's', 'e', 't', 'u', 'p', \
'\"', ',', '(', '0', '-', '3', ')', ')', ',', \
'(', '\"', 'c', 'a', 'l', 'l', 'h', 'e', 'l', 'd', '\"', \
',', '(', '0', '-', '2', ')', ')', ',', \
'(', '\"', 's', 'i', 'g', 'n', 'a', 'l', '\"', ',', '(', \
'0', '-', '5', ')', ')', ',', \
'(', '\"', 'r', 'o', 'a', 'm', '\"', ',', '(', '0', ',', \
'1', ')', ')', ',', \
'(', '\"', 'b', 'a', 't', 't', 'c', 'h', 'g', '\"', ',', \
'(', '0', '-', '5', ')', ')', ',', '\r', '\n'), \
frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', '+', 'C', 'I', 'N', 'D', ':', ' ', service, ',', \
call, ',', callsetup, ',', callheld, ',', '5', ',', '0', \
',', '5', '\r', '\n'), \
frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', '+', 'C', 'H', 'L', 'D', ':', '(', '0', \
',', '1', ',', '1', 'x', ',', '2', ',', '2', 'x', \
',', '3', ',', '4', ')', '\r', '\n'), \
frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', '+', 'C', 'O', 'P', 'S', ':', ' ', '0', ',', \
'0', ',', '\"', 'T', 'E', 'S', 'T', '\"', '\r', '\n'), \
frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n')
static void hf_cmd_complete(enum hfp_result res, enum hfp_error cme_err,
void *user_data)
{
g_assert_cmpint(res, ==, HFP_RESULT_OK);
}
static void hf_cmd_error(enum hfp_result res, enum hfp_error cme_err,
void *user_data)
{
g_assert_cmpint(res, ==, HFP_RESULT_ERROR);
}
static void hf_session_ready_cb(enum hfp_result res, enum hfp_error cme_err,
void *user_data)
{
struct context *context = user_data;
const char *test_name = context->data->test_name;
g_assert_cmpint(res, ==, HFP_RESULT_OK);
context->session.completed = true;
if (tester_use_debug())
tester_debug("HF session ready");
if (g_str_equal(test_name, "/HFP/HF/OCL/BV-01-C")) {
bool ret;
if (tester_use_debug())
tester_debug("calling last dialed number");
ret = hfp_hf_dial(context->hfp_hf, "", hf_cmd_complete,
context);
g_assert(ret);
} else if (g_str_equal(test_name, "/HFP/HF/OCL/BV-02-C")) {
bool ret;
if (tester_use_debug())
tester_debug("calling last dialed number");
ret = hfp_hf_dial(context->hfp_hf, "", hf_cmd_error,
context);
g_assert(ret);
} else if (g_str_equal(test_name, "/HFP/HF/OCM/BV-01-C")) {
bool ret;
if (tester_use_debug())
tester_debug("calling memory 1");
ret = hfp_hf_dial(context->hfp_hf, ">1", hf_cmd_complete,
context);
g_assert(ret);
} else if (g_str_equal(test_name, "/HFP/HF/OCM/BV-02-C")) {
bool ret;
if (tester_use_debug())
tester_debug("calling memory 1");
ret = hfp_hf_dial(context->hfp_hf, ">1", hf_cmd_error,
context);
g_assert(ret);
} else if (g_str_equal(test_name, "/HFP/HF/OCN/BV-01-C")) {
bool ret;
if (tester_use_debug())
tester_debug("calling number");
ret = hfp_hf_dial(context->hfp_hf, "1234567", hf_cmd_complete,
context);
g_assert(ret);
}
}
static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val,
void *user_data)
{
struct context *context = user_data;
const char *test_name = context->data->test_name;
if (!context->session.completed) {
switch (indicator) {
case HFP_INDICATOR_SERVICE:
if (g_str_equal(test_name, "/HFP/HF/PSI/BV-03-C") ||
g_str_equal(test_name, "/HFP/HF/TRS/BV-01-C") ||
g_str_equal(test_name,
"/hfp_hf/test_session_minimal"))
g_assert_cmpint(val, ==, 0);
else
g_assert_cmpint(val, ==, 1);
break;
case HFP_INDICATOR_CALL:
g_assert_cmpint(val, ==, 0);
break;
case HFP_INDICATOR_CALLSETUP:
if (g_str_equal(test_name, "/HFP/HF/ICA/BV-07-C"))
g_assert_cmpint(val, ==, 1);
else
g_assert_cmpint(val, ==, 0);
break;
case HFP_INDICATOR_CALLHELD:
g_assert_cmpint(val, ==, 0);
break;
case HFP_INDICATOR_SIGNAL:
g_assert_cmpint(val, ==, 5);
break;
case HFP_INDICATOR_ROAM:
g_assert_cmpint(val, ==, 0);
break;
case HFP_INDICATOR_BATTCHG:
g_assert_cmpint(val, ==, 5);
break;
case HFP_INDICATOR_LAST:
default:
tester_test_failed();
}
return;
}
if (g_str_equal(test_name, "/HFP/HF/PSI/BV-01-C")) {
g_assert_cmpint(indicator, ==, HFP_INDICATOR_SIGNAL);
g_assert_cmpint(val, ==, 3);
} else if (g_str_equal(test_name, "/HFP/HF/PSI/BV-02-C")) {
context->session.step++;
g_assert_cmpint(indicator, ==, HFP_INDICATOR_ROAM);
g_assert_cmpint(val, ==, context->session.step % 2);
} else if (g_str_equal(test_name, "/HFP/HF/PSI/BV-03-C")) {
g_assert_cmpint(indicator, ==, HFP_INDICATOR_BATTCHG);
g_assert_cmpint(val, ==, 3);
} else if (g_str_equal(test_name, "/HFP/HF/TRS/BV-01-C")) {
context->session.step++;
g_assert_cmpint(indicator, ==, HFP_INDICATOR_SERVICE);
g_assert_cmpint(val, ==, context->session.step % 2);
}
}
static void hf_update_inband_ring(bool enabled, void *user_data)
{
struct context *context = user_data;
const char *test_name = context->data->test_name;
if (tester_use_debug())
tester_debug("in-band ring updated: %u", enabled);
if (g_str_equal(test_name, "/HFP/HF/ICA/BV-01-C"))
g_assert_cmpint(enabled, ==, true);
else if (g_str_equal(test_name, "/HFP/HF/ICA/BV-02-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C-full"))
g_assert_cmpint(enabled, ==, !!context->session.step);
else if (g_str_equal(test_name, "/HFP/HF/ICA/BV-03-C")) {
g_assert_cmpint(enabled, ==, !!context->session.step);
context->session.step++;
}
}
static void hf_update_operator(const char *operator_name, void *user_data)
{
struct context *context = user_data;
const char *test_name = context->data->test_name;
if (tester_use_debug())
tester_debug("operator updated: %s", operator_name);
if (g_str_equal(test_name, "/HFP/HF/PSI/BV-04-C"))
g_assert_cmpstr(operator_name, ==, "TEST");
}
static void hf_call_added(uint id, enum hfp_call_status status,
void *user_data)
{
struct context *context = user_data;
const char *test_name = context->data->test_name;
if (tester_use_debug())
tester_debug("call %d added: status %u", id, status);
if (g_str_equal(test_name, "/HFP/HF/CIT/BV-01-C") ||
g_str_equal(test_name, "/HFP/HF/CLI/BV-01-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-06-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-07-C") ||
g_str_equal(test_name, "/HFP/HF/ICR/BV-01-C") ||
g_str_equal(test_name, "/HFP/HF/TCA/BV-01-C") ||
g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) {
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_INCOMING);
} else if (g_str_equal(test_name, "/HFP/HF/ICA/BV-01-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-02-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-03-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C-full") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-07-C-full")) {
bool ret;
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_INCOMING);
if (tester_use_debug())
tester_debug("call %d: answering call", id);
ret = hfp_hf_call_answer(context->hfp_hf, id, hf_cmd_complete,
context);
g_assert(ret);
} else if (g_str_equal(test_name, "/HFP/HF/OCL/BV-01-C")) {
const char *number;
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_DIALING);
number = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_null(number);
} else if (g_str_equal(test_name, "/HFP/HF/OCM/BV-01-C")) {
const char *number;
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_DIALING);
number = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_cmpstr(number, ==, ">1");
} else if (g_str_equal(test_name, "/HFP/HF/OCN/BV-01-C")) {
const char *number;
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_DIALING);
number = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_cmpstr(number, ==, "1234567");
} else if (g_str_equal(test_name, "/HFP/HF/TCA/BV-04-C")) {
bool ret;
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_DIALING);
if (tester_use_debug())
tester_debug("call %d: ending call", id);
ret = hfp_hf_call_hangup(context->hfp_hf, id, hf_cmd_complete,
context);
g_assert(ret);
} else if (g_str_equal(test_name, "/HFP/HF/TWC/BV-01-C")) {
bool ret;
switch (context->session.step) {
case 0:
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_INCOMING);
if (tester_use_debug())
tester_debug("call %d: answering call", id);
ret = hfp_hf_call_answer(context->hfp_hf, id,
hf_cmd_complete,
context);
g_assert(ret);
break;
case 1:
g_assert_cmpint(id, ==, 2);
g_assert_cmpint(status, ==, CALL_STATUS_HELD);
if (tester_use_debug())
tester_debug("call %d: ending held call", id);
ret = hfp_hf_call_hangup(context->hfp_hf, id,
hf_cmd_complete,
context);
g_assert(ret);
break;
default:
tester_debug("Unexpected session.step");
tester_test_failed();
}
context->session.step++;
} else if (g_str_equal(test_name, "/HFP/HF/TWC/BV-02-C")) {
bool ret;
switch (context->session.step) {
case 0:
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_INCOMING);
if (tester_use_debug())
tester_debug("call %d: answering call", id);
ret = hfp_hf_call_answer(context->hfp_hf, id,
hf_cmd_complete,
context);
g_assert(ret);
break;
case 1:
g_assert_cmpint(id, ==, 2);
g_assert_cmpint(status, ==, CALL_STATUS_HELD);
if (tester_use_debug())
tester_debug("call %d: "
"release and answer calls",
id);
ret = hfp_hf_release_and_accept(context->hfp_hf,
hf_cmd_complete,
context);
g_assert(ret);
break;
default:
tester_debug("Unexpected session.step");
tester_test_failed();
}
context->session.step++;
} else if (g_str_equal(test_name, "/HFP/HF/TWC/BV-03-C")) {
bool ret;
switch (context->session.step) {
case 0:
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_INCOMING);
if (tester_use_debug())
tester_debug("call %d: answering call", id);
ret = hfp_hf_call_answer(context->hfp_hf, id,
hf_cmd_complete,
context);
g_assert(ret);
break;
case 2:
g_assert_cmpint(id, ==, 2);
g_assert_cmpint(status, ==, CALL_STATUS_HELD);
if (tester_use_debug())
tester_debug("call %d: swap calls", id);
ret = hfp_hf_swap_calls(context->hfp_hf,
hf_cmd_complete,
context);
g_assert(ret);
break;
default:
tester_debug("Unexpected session.step");
tester_test_failed();
}
context->session.step++;
}
}
static void hf_call_line_id_updated(uint id, const char *number,
unsigned int type,
void *user_data)
{
struct context *context = user_data;
const char *test_name = context->data->test_name;
const char *str;
if (tester_use_debug())
tester_debug("call %d line id updated: %s, %u", id, number,
type);
g_assert_cmpint(id, ==, 1);
g_assert_cmpstr(number, ==, "1234567");
g_assert_cmpint(type, ==, 129);
str = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_cmpstr(number, ==, str);
if (g_str_equal(test_name, "/HFP/HF/ENO/BV-01-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-07-C") ||
g_str_equal(test_name, "/HFP/HF/TCA/BV-01-C") ||
g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) {
bool ret;
if (tester_use_debug())
tester_debug("call %d: answering call", id);
ret = hfp_hf_call_answer(context->hfp_hf, id, hf_cmd_complete,
context);
g_assert(ret);
} else if (g_str_equal(test_name, "/HFP/HF/ICR/BV-01-C")) {
bool ret;
if (tester_use_debug())
tester_debug("call %d: rejecting call", id);
ret = hfp_hf_call_hangup(context->hfp_hf, id, hf_cmd_complete,
context);
g_assert(ret);
}
}
static void hf_call_removed(uint id, void *user_data)
{
struct context *context = user_data;
const char *test_name = context->data->test_name;
if (tester_use_debug())
tester_debug("call %d removed", id);
if (g_str_equal(test_name, "/HFP/HF/TWC/BV-01-C")) {
switch (context->session.step) {
case 2:
g_assert_cmpint(id, ==, 2);
break;
case 3:
g_assert_cmpint(id, ==, 1);
break;
default:
tester_debug("Unexpected session.step");
tester_test_failed();
}
context->session.step++;
} else if (g_str_equal(test_name, "/HFP/HF/TWC/BV-02-C")) {
switch (context->session.step) {
case 2:
g_assert_cmpint(id, ==, 1);
break;
case 3:
g_assert_cmpint(id, ==, 2);
break;
default:
tester_debug("Unexpected session.step");
tester_test_failed();
}
context->session.step++;
} else if (g_str_equal(test_name, "/HFP/HF/TWC/BV-03-C")) {
switch (context->session.step) {
case 8:
g_assert_cmpint(id, ==, 1);
break;
case 9:
g_assert_cmpint(id, ==, 2);
break;
default:
tester_debug("Unexpected session.step");
tester_test_failed();
}
context->session.step++;
} else
g_assert_cmpint(id, ==, 1);
}
static void hf_call_status_updated(uint id, enum hfp_call_status status,
void *user_data)
{
struct context *context = user_data;
const char *test_name = context->data->test_name;
if (tester_use_debug())
tester_debug("call %d updated: status %u", id, status);
if (g_str_equal(test_name, "/HFP/HF/ICA/BV-01-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-03-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C-full") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-06-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-07-C") ||
g_str_equal(test_name, "/HFP/HF/ICA/BV-07-C-full") ||
g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) {
const char *number;
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
number = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_cmpstr(number, ==, "1234567");
} else if (g_str_equal(test_name, "/HFP/HF/ICA/BV-02-C")) {
const char *number;
bool ret;
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
number = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_cmpstr(number, ==, "1234567");
context->session.step++;
if (context->session.step == 1) {
if (tester_use_debug())
tester_debug("call %d: ending call", id);
ret = hfp_hf_call_hangup(context->hfp_hf, id,
hf_cmd_complete,
context);
g_assert(ret);
}
} else if (g_str_equal(test_name, "/HFP/HF/ICR/BV-01-C")) {
if (tester_use_debug())
tester_debug("Error: unexpected update");
tester_test_failed();
} else if (g_str_equal(test_name, "/HFP/HF/OCL/BV-01-C")) {
const char *number;
g_assert_cmpint(id, ==, 1);
if (context->session.step == 0)
g_assert_cmpint(status, ==, CALL_STATUS_ALERTING);
else
g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
number = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_null(number);
context->session.step++;
} else if (g_str_equal(test_name, "/HFP/HF/OCM/BV-01-C")) {
const char *number;
g_assert_cmpint(id, ==, 1);
if (context->session.step == 0)
g_assert_cmpint(status, ==, CALL_STATUS_ALERTING);
else
g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
number = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_cmpstr(number, ==, ">1");
context->session.step++;
} else if (g_str_equal(test_name, "/HFP/HF/OCN/BV-01-C")) {
const char *number;
g_assert_cmpint(id, ==, 1);
if (context->session.step == 0)
g_assert_cmpint(status, ==, CALL_STATUS_ALERTING);
else
g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
number = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_cmpstr(number, ==, "1234567");
context->session.step++;
} else if (g_str_equal(test_name, "/HFP/HF/TCA/BV-01-C")) {
const char *number;
bool ret;
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
number = hfp_hf_call_get_number(context->hfp_hf, id);
g_assert_cmpstr(number, ==, "1234567");
if (tester_use_debug())
tester_debug("call %d: ending call", id);
ret = hfp_hf_call_hangup(context->hfp_hf, id, hf_cmd_complete,
context);
g_assert(ret);
} else if (g_str_equal(test_name, "/HFP/HF/TWC/BV-03-C")) {
bool ret;
switch (context->session.step) {
case 1:
case 5:
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
break;
case 3:
g_assert_cmpint(id, ==, 1);
g_assert_cmpint(status, ==, CALL_STATUS_HELD);
break;
case 4:
g_assert_cmpint(id, ==, 2);
g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
if (tester_use_debug())
tester_debug("call %d: swap calls", id);
ret = hfp_hf_swap_calls(context->hfp_hf,
hf_cmd_complete,
context);
g_assert(ret);
break;
case 6:
g_assert_cmpint(id, ==, 2);
g_assert_cmpint(status, ==, CALL_STATUS_HELD);
if (tester_use_debug())
tester_debug("call %d: swap calls", id);
ret = hfp_hf_release_and_accept(context->hfp_hf,
hf_cmd_complete,
context);
g_assert(ret);
break;
case 7:
g_assert_cmpint(id, ==, 2);
g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
break;
default:
tester_debug("Unexpected session.step");
tester_test_failed();
}
context->session.step++;
}
}
static struct hfp_hf_callbacks hf_session_callbacks = {
.session_ready = hf_session_ready_cb,
.update_indicator = hf_update_indicator,
.update_operator = hf_update_operator,
.update_inband_ring = hf_update_inband_ring,
.call_added = hf_call_added,
.call_removed = hf_call_removed,
.call_status_updated = hf_call_status_updated,
.call_line_id_updated = hf_call_line_id_updated,
};
static void test_hf_session_done(enum hfp_result res, enum hfp_error cme_err,
void *user_data)
{
struct context *context = user_data;
hfp_hf_disconnect(context->hfp_hf);
}
static void test_hf_session(gconstpointer data)
{
struct context *context = create_context(data);
bool ret;
context->hfp_hf = hfp_hf_new(context->fd_client);
g_assert(context->hfp_hf);
ret = hfp_hf_set_debug(context->hfp_hf, print_debug, "hfp-hf:", NULL);
g_assert(ret);
ret = hfp_hf_set_close_on_unref(context->hfp_hf, true);
g_assert(ret);
ret = hfp_hf_session_register(context->hfp_hf, &hf_session_callbacks,
context);
g_assert(ret);
ret = hfp_hf_session(context->hfp_hf);
g_assert(ret);
}
int main(int argc, char *argv[])
{
tester_init(&argc, &argv);
define_test("/hfp/test_init", test_init, NULL, data_end());
define_test("/hfp/test_cmd_handler_1", test_command_handler, NULL,
raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F', '\r'),
raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F'),
data_end());
define_test("/hfp/test_cmd_handler_2", test_command_handler, NULL,
raw_pdu('A', 'T', 'D', '1', '2', '3', '4', '\r'),
raw_pdu('A', 'T', 'D', '1', '2', '3', '4'),
data_end());
define_test("/hfp/test_register_1", test_register, prefix_handler,
raw_pdu('+', 'B', 'R', 'S', 'F', '\0'),
raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F', '\r'),
type_pdu(HFP_GW_CMD_TYPE_COMMAND, 0),
data_end());
define_test("/hfp/test_register_2", test_register, prefix_handler,
raw_pdu('+', 'B', 'R', 'S', 'F', '\0'),
raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F', '=', '\r'),
type_pdu(HFP_GW_CMD_TYPE_SET, 0),
data_end());
define_test("/hfp/test_register_3", test_register, prefix_handler,
raw_pdu('+', 'B', 'R', 'S', 'F', '\0'),
raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F', '?', '\r'),
type_pdu(HFP_GW_CMD_TYPE_READ, 0),
data_end());
define_test("/hfp/test_register_4", test_register, prefix_handler,
raw_pdu('+', 'B', 'R', 'S', 'F', '\0'),
raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F', '=', '?',
'\r'),
type_pdu(HFP_GW_CMD_TYPE_TEST, 0),
data_end());
define_test("/hfp/test_register_5", test_register, prefix_handler,
raw_pdu('D', '\0'),
raw_pdu('A', 'T', 'D', '1', '2', '3', '4', '5', '\r'),
type_pdu(HFP_GW_CMD_TYPE_SET, 0),
data_end());
define_test("/hfp/test_fragmented_1", test_fragmented, NULL,
frg_pdu('A'), frg_pdu('T'), frg_pdu('+'), frg_pdu('B'),
frg_pdu('R'), frg_pdu('S'), frg_pdu('F'), frg_pdu('\r'),
data_end());
define_test("/hfp/test_ustring_1", test_register, check_ustring_1,
raw_pdu('D', '\0'),
raw_pdu('A', 'T', 'D', '0', '1', '2', '3', '\r'),
type_pdu(HFP_GW_CMD_TYPE_SET, 0),
data_end());
define_test("/hfp/test_ustring_2", test_register, check_ustring_2,
raw_pdu('D', '\0'),
raw_pdu('A', 'T', 'D', '0', '1', '2', '3', '\r'),
type_pdu(HFP_GW_CMD_TYPE_SET, 0),
data_end());
define_test("/hfp/test_string_1", test_register, check_string_1,
raw_pdu('D', '\0'),
raw_pdu('A', 'T', 'D', '\"', '0', '1', '2', '3', '\"',
'\r'),
type_pdu(HFP_GW_CMD_TYPE_SET, 0),
data_end());
define_test("/hfp/test_string_2", test_register, check_string_2,
raw_pdu('D', '\0'),
raw_pdu('A', 'T', 'D', '\"', '0', '1', '2', '3', '\"',
'\r'),
type_pdu(HFP_GW_CMD_TYPE_SET, 0),
data_end());
define_test("/hfp/test_corrupted_1", test_register, check_string_3,
raw_pdu('D', '\0'),
raw_pdu('\r', 'A', 'T', 'D', '\"', '0', '1', '2', '3',
'\"', '\r'),
type_pdu(HFP_GW_CMD_TYPE_SET, 0),
data_end());
define_test("/hfp/test_empty", test_send_and_close, NULL,
raw_pdu('\r'),
data_end());
define_hf_test("/hfp_hf/test_init", test_hf_init, NULL, NULL,
data_end());
define_hf_test("/hfp_hf/test_send_command_1", test_hf_send_command,
NULL, hf_response_cb,
raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F', '\0'),
raw_pdu('\r', '\n', 'O', 'k', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_send_command_2", test_hf_send_command,
hf_unsolicited_resp_cb,
hf_response_with_data,
raw_pdu('+', 'B', 'R', 'S', 'F', '\0'),
raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F', '\0'),
frg_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', '\r',
'\n'),
frg_pdu('\r', '\n', 'O', 'k', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_send_command_3", test_hf_send_command,
NULL, hf_cme_error_response_cb,
raw_pdu('A', 'T', '+', 'C', 'H', 'L', 'D', '=',
'1', '\0'),
frg_pdu('\r', '\n', '+', 'C', 'M', 'E', ' ', 'E'),
frg_pdu('R', 'R', 'O', 'R', ':', '3', '0', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_unsolicited_1", test_hf_unsolicited,
hf_result_handler, NULL,
raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C'),
frg_pdu('C', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_unsolicited_2", test_hf_unsolicited,
hf_result_handler, NULL,
raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1'),
frg_pdu(',', '3', ',', '0', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_unsolicited_3", test_hf_unsolicited,
hf_result_handler, NULL,
raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
frg_pdu('\r'), frg_pdu('\n'), frg_pdu('+'),
frg_pdu('C'), frg_pdu('L'), frg_pdu('C'), frg_pdu('C'),
frg_pdu(':'), frg_pdu('1'), frg_pdu(','), frg_pdu('3'),
frg_pdu(','), frg_pdu('0'), frg_pdu('\r'),
frg_pdu('\n'),
data_end());
define_hf_test("/hfp_hf/test_corrupted_1", test_hf_unsolicited,
hf_result_handler, NULL,
raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
frg_pdu('\r', 'X', '\r', '\n'),
frg_pdu('+', 'C', 'L', 'C', 'C', ':', '1', ',', '3'),
frg_pdu(',', '0', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_corrupted_2", test_hf_unsolicited,
hf_result_handler, NULL,
raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
raw_pdu('+', 'C', 'L', 'C', 'C', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_empty", test_hf_robustness, NULL, NULL,
raw_pdu('\r'), data_end());
define_hf_test("/hfp_hf/test_unknown", test_hf_robustness, NULL, NULL,
raw_pdu('\r', '\n', 'B', 'R', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_context_parser_1", test_hf_unsolicited,
hf_clcc_result_handler, NULL,
raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
frg_pdu('+', 'C', 'L', 'C', 'C', ':'),
frg_pdu('(', '\"', 'c', 'a', 'l', 'l', '\"'),
frg_pdu('(', '0', ',', '1', ')', ')', ','),
frg_pdu('(', '\"', 'c', 'a', 'l', 'l', 's', 'e', 't'),
frg_pdu('u', 'p', '\"', ',', '(', '0', '-', '3', ')'),
frg_pdu(')', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_context_parser_2", test_hf_unsolicited,
hf_chld_result_handler, NULL,
raw_pdu('+', 'C', 'H', 'L', 'D', '\0'),
frg_pdu('+', 'C', 'H', 'L', 'D', ':'),
frg_pdu('1', ',', '2', 'x', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_context_skip_field", test_hf_unsolicited,
hf_chld_skip_field, NULL,
raw_pdu('+', 'C', 'H', 'L', 'D', '\0'),
frg_pdu('+', 'C', 'H', 'L', 'D', ':'),
frg_pdu('1', ',', '2', 'x', '\r', '\n'),
data_end());
define_hf_test("/hfp_hf/test_session_minimal", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('0', '0', '0', '0'),
data_end());
/* Incoming call interrupted - HF */
define_hf_test("/HFP/HF/CIT/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
data_end());
/* Calling Line Identification - HF */
define_hf_test("/HFP/HF/CLI/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
data_end());
/* Query list of current calls - HF */
define_hf_test("/HFP/HF/ECS/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', ',', '\"', 'A', 'n', 'A',
'c', 't', 'i', 'v', 'e', 'c', 'a', 'l', 'l',
'\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Receiving call status on SLC initialization - HF */
define_hf_test("/HFP/HF/ECS/BV-02-C", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '1', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', ',', '\"', 'A', 'n', 'A',
'c', 't', 'i', 'v', 'e', 'c', 'a', 'l', 'l',
'\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Disable EC/NR on the AG - HF */
define_hf_test("/HFP/HF/ENO/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Incoming call, in-band ring - HF */
define_hf_test("/HFP/HF/ICA/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'B', 'S', 'I', 'R', ':', ' ',
'1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '4', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Answer incoming call and accept in-band setting change - HF */
define_hf_test("/HFP/HF/ICA/BV-02-C", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'B', 'S', 'I', 'R', ':', ' ',
'0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '4', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'B', 'S', 'I', 'R', ':', ' ',
'1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '4', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Answer incoming call on HF with ring muting - HF */
define_hf_test("/HFP/HF/ICA/BV-03-C", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'B', 'S', 'I', 'R', ':', ' ',
'0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'B', 'S', 'I', 'R', ':', ' ',
'1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '4', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Answer Incoming call on HF, no in-band ring - HF */
define_hf_test("/HFP/HF/ICA/BV-04-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
data_end());
/* Answer Incoming call on HF, no in-band ring, full SLC setup - HF
* idem for /HFP/HF/ICA/BV-05-C Audio Connection + answer incoming
* call from HF with locally generated alert
*/
define_hf_test("/HFP/HF/ICA/BV-04-C-full", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'B', 'S', 'I', 'R', ':', ' ',
'0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '4', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Answer Incoming call on AG, no in-band ring - HF */
define_hf_test("/HFP/HF/ICA/BV-06-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
data_end());
/* Answer Incoming call on AG prior to connection, no in-band
* ring - HF
*/
define_hf_test("/HFP/HF/ICA/BV-07-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '1', '0'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', ',', '\"', 'A',
'i', 'n', 'c', 'o', 'm', 'i', 'n', 'g', 'c',
'a', 'l', 'l', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
data_end());
define_hf_test("/HFP/HF/ICA/BV-07-C-full", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '1', '0'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '4', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'A', 'i', 'n',
'c', 'o', 'm', 'i', 'n', 'g', 'c', 'a', 'l',
'l', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', ',', '\"', 'A',
'i', 'n', 'c', 'o', 'm', 'i', 'n', 'g', 'c',
'a', 'l', 'l', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'A', 'i', 'n',
'c', 'o', 'm', 'i', 'n', 'g', 'c', 'a', 'l',
'l', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Initiate rejection of incoming call - HF */
define_hf_test("/HFP/HF/ICR/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
data_end());
/* Accept AG rejection of incoming call - HF */
define_hf_test("/HFP/HF/ICR/BV-02-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
data_end());
/* Initiate a call placed to the last number - HF */
define_hf_test("/HFP/HF/OCL/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '2', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '3', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
data_end());
/* Handling ERROR response to a call placed to last number - HF */
define_hf_test("/HFP/HF/OCL/BV-02-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'E', 'R', 'R', 'O', 'R'),
frg_pdu('\r', '\n'),
data_end());
/* Initiate a request to place a call with a memory location - HF */
define_hf_test("/HFP/HF/OCM/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '2', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '3', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
data_end());
/* Handling ERROR response to a call placed to an empty memory
* location - HF
*/
define_hf_test("/HFP/HF/OCM/BV-02-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'E', 'R', 'R', 'O', 'R'),
frg_pdu('\r', '\n'),
data_end());
/* HF places a call with a phone number - HF */
define_hf_test("/HFP/HF/OCN/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '2', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '3', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
data_end());
/* Transfer Signal Strength Indication - HF */
define_hf_test("/HFP/HF/PSI/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
frg_pdu(' ', '5', ',', '3', '\r', '\n'),
data_end());
/* Transfer Roaming Status Indication - HF */
define_hf_test("/HFP/HF/PSI/BV-02-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
frg_pdu(' ', '6', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
frg_pdu(' ', '6', ',', '0', '\r', '\n'),
data_end());
/* Transfer Battery Level Indication - HF */
define_hf_test("/HFP/HF/PSI/BV-03-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('0', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
frg_pdu(' ', '7', ',', '3', '\r', '\n'),
data_end());
/* Transfer Operator name - HF */
define_hf_test("/HFP/HF/PSI/BV-04-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
data_end());
/* Terminate ongoing call - HF */
define_hf_test("/HFP/HF/TCA/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
data_end());
/* Terminate ongoing call on AG - HF
* idem for /HFP/HF/TCA/BV-03-C Remote party terminates the call
*/
define_hf_test("/HFP/HF/TCA/BV-02-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
data_end());
/* Abandon outgoing call - HF */
define_hf_test("/HFP/HF/TCA/BV-04-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('1', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '2', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
data_end());
/* Transfer Registration Status - HF */
define_hf_test("/HFP/HF/TRS/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
MINIMAL_SLC_SESSION('0', '0', '0', '0'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
frg_pdu(' ', '1', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
frg_pdu(' ', '1', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':'),
frg_pdu(' ', '1', ',', '1', '\r', '\n'),
data_end());
/* Call waiting – handling user busy by HF (AT+CHLD=0) - HF */
define_hf_test("/HFP/HF/TWC/BV-01-C", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '4', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', ',', '\"', 'b',
'l', 'u', 'e', 'm', 'a', 'n', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'C', 'W', 'A', ':', ' ',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '2',
',', '1', ',', '1', ',', '0', ',', '0', ',',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', ',', '\"', 'a', 's', 'e',
'c', 'o', 'n', 'd', 'c', 'a', 'l', 'l', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'4', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Initiate request to drop the active and retrieve the waiting call
* (AT+CHLD=1) - HF
*/
define_hf_test("/HFP/HF/TWC/BV-02-C", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '4', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', ',', '\"', 'b',
'l', 'u', 'e', 'm', 'a', 'n', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'C', 'W', 'A', ':', ' ',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '2',
',', '1', ',', '1', ',', '0', ',', '0', ',',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', ',', '\"', 'a', 's', 'e',
'c', 'o', 'n', 'd', 'c', 'a', 'l', 'l', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'4', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '2',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', ',', '\"', 'a', 's', 'e',
'c', 'o', 'n', 'd', 'c', 'a', 'l', 'l', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '0', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
/* Request the AG to hold the active and retrieve the waiting call
* (AT+CHLD=2) - HF
*/
define_hf_test("/HFP/HF/TWC/BV-03-C", test_hf_session,
NULL, test_hf_session_done,
FULL_SLC_SESSION('1', '0', '0', '0'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '4', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', ',', ',', '\"', 'b',
'l', 'u', 'e', 'm', 'a', 'n', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'2', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'C', 'W', 'A', ':', ' ',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '2',
',', '1', ',', '1', ',', '0', ',', '0', ',',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', ',', '\"', 'a', 's', 'e',
'c', 'o', 'n', 'd', 'c', 'a', 'l', 'l', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'4', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '1', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '2',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', ',', '\"', 'a', 's', 'e',
'c', 'o', 'n', 'd', 'c', 'a', 'l', 'l', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'4', ',', '1', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
',', '1', '2', '9', ',', '\"', 'b', 'l', 'u',
'e', 'm', 'a', 'n', '\"', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '2',
',', '1', ',', '1', ',', '0', ',', '0', ',',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', ',', '\"', 'a', 's', 'e',
'c', 'o', 'n', 'd', 'c', 'a', 'l', 'l', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'3', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
'4', ',', '0', '\r', '\n'),
frg_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '2',
',', '1', ',', '0', ',', '0', ',', '0', ',',
'\"', '7', '6', '5', '4', '3', '2', '1', '\"',
',', '1', '2', '9', ',', '\"', 'a', 's', 'e',
'c', 'o', 'n', 'd', 'c', 'a', 'l', 'l', '\"',
'\r', '\n'),
raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
data_end());
return tester_run();
}