view rvinterf/asyncshell/tchcmd.c @ 1020:fab048ff04b8

doc/Freerunner-Howto: update for voice calls working with the FR codec
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sat, 23 Apr 2016 05:17:15 +0000
parents 9ced8e13cf91
children f511bbac0efa
line wrap: on
line source

/*
 * Commands for manipulating the experimental TCH rerouting feature
 * of FreeCalypso GSM firmware
 */

#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include "pktmux.h"
#include "tch_feature.h"

send_tch_config_req(config)
{
	u_char sendpkt[3];

	sendpkt[0] = RVT_TCH_HEADER;
	sendpkt[1] = TCH_CONFIG_REQ;
	sendpkt[2] = config;
	/* send it! */
	send_pkt_to_target(sendpkt, 3);
	return(0);
}

cmd_tchdl_common(argc, argv)
	char **argv;
{
	int config;

	if (!strcmp(argv[0], "enable") || !strcmp(argv[0], "on") ||
	    !strcmp(argv[0], "1"))
		config = 1;
	else if (!strcmp(argv[0], "disable") || !strcmp(argv[0], "off") ||
		 !strcmp(argv[0], "0"))
		config = 0;
	else {
		printf("error: boolean argument required\n");
		return(1);
	}
	return send_tch_config_req(config);
}

void
cmd_tchdl_interactive(argstr)
	char *argstr;
{
	char *argv[2];
	int argc, rc;

	rc = parse_interactive_command_into_argv(argstr, argv, 1, 1, &argc);
	if (rc < 0)
		return;
	tch_rx_control(1);
	cmd_tchdl_common(argc, argv);
}

cmd_tchdl_oneshot(argc, argv)
	char **argv;
{
	return cmd_tchdl_common(argc - 1, argv + 1);
}