view src/g23m-aci/aci/ati_fcmisc.c @ 196:5f3544fc0308

AT@SPENH brought over from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 May 2020 19:46:18 +0000
parents
children 07ece4691685
line wrap: on
line source

/*
 * This module implements miscellaneous FreeCalypso-added AT commands.
 */

#ifndef ATI_FCMISC_C
#define ATI_FCMISC_C

#include "aci_all.h"

#include <ctype.h>
#include <string.h>

#include "aci_cmh.h"
#include "ati_cmd.h"
#include "aci_cmd.h"
#include "aci_io.h"
#include "aci_cmd.h"
#include "l4_tim.h"
#include "line_edit.h"
#include "aci_lst.h"

#include "pcm.h"
#include "audio.h"
#include "aci.h"
#include "rx.h"
#include "pwr.h"
#include "l4_tim.h"

#ifdef GPRS
#ifdef DTI
#include "dti.h"
#include "dti_conn_mng.h"
#include "dti_cntrl_mng.h"
#endif /* DTI */
#include "gaci.h"
#include "gaci_cmh.h"
#include "gaci_cmd.h"
#endif  /* GPRS */

#include "aci_mem.h"
#include "aci_prs.h"

#include "ati_int.h"

#ifndef _SIMULATION_
#include "ffs/ffs.h"
#endif

#ifdef FF_ATI_BAT

#include "typedefs.h"
#include "gdd.h"
#include "bat.h"

#include "ati_bat.h"

#endif /*FF_ATI_BAT*/

#include "main/sys_types.h"

extern SYS_UWORD8 SIM_allow_speed_enhancement;

/* AT@SPENH - enable or disable SIM speed enhancement */
GLOBAL T_ATI_RSLT atAtSPENH ( char *cl, UBYTE srcId )
{
	int state, nonvol = 0;

	TRACE_FUNCTION("atAtSPENH()");

	cl = parse(cl, "Dd", &state, &nonvol);
	if (!cl)
		return (ATI_FAIL);
	if (state != 0 && state != 1)
		return (ATI_FAIL);
	SIM_allow_speed_enhancement = state;
	if (!nonvol)
		return (ATI_CMPL);
	ffs_mkdir("/etc");
	if (ffs_file_write("/etc/SIM_spenh", &SIM_allow_speed_enhancement, 1,
			   FFS_O_CREATE | FFS_O_TRUNC) == EFFS_OK)
		return (ATI_CMPL);
	else
		return (ATI_FAIL);
}

GLOBAL T_ATI_RSLT queatAtSPENH (char *cl, UBYTE srcId)
{
	char *me="@SPENH: ";

	TRACE_FUNCTION("queatAtSPENH()");

	sprintf(g_sa, "%s%u", me, SIM_allow_speed_enhancement);
	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
	return (ATI_CMPL);
}

#endif /* ATI_FCMISC_C */