Intermec ck1 Guida Di Riferimento
Chapter 2 — Configuring the CK1 System
54
CK1 SDK Programmer’s Reference Manual
Example Codes
This section contains the following sample code:
• sdk/examples/drv_api/apm_test/apmapi_test.c
• sdk/examples/drv_api/apm_test/sigtest.c
sdk/examples/drv_api/apm_test/apmapi_test.c
/************************************************************************
* ----------
* Purpose
* ----------
* To demonstrate how to use the APM driver API.
* The APM default is enable, and auto control the system by default setting.
* You can use these functions to change the default setting value, then APM
* will work on the new setting value, Or even Control the APM by yourself.
*
* ----------------------------
* Behavior of this sample code
* ----------------------------
* 1. To register the SIGUSR1 signal handler function.
* 2. Use the devApmGet*() API to show the current APM setting.
* 3. To control the system to enter the
* ----------
* Purpose
* ----------
* To demonstrate how to use the APM driver API.
* The APM default is enable, and auto control the system by default setting.
* You can use these functions to change the default setting value, then APM
* will work on the new setting value, Or even Control the APM by yourself.
*
* ----------------------------
* Behavior of this sample code
* ----------------------------
* 1. To register the SIGUSR1 signal handler function.
* 2. Use the devApmGet*() API to show the current APM setting.
* 3. To control the system to enter the
Idle/Stop
mode and resume form them.
* 4. Set the APM control time and battery power life level.
* 5. Show the changed value and then reset to default value.
*
* -----------------------
* How to use this program
* -----------------------
* 1. Put this program to device with SDK.
* 2. Use the command "/home/apmapi_test"
* 5. Show the changed value and then reset to default value.
*
* -----------------------
* How to use this program
* -----------------------
* 1. Put this program to device with SDK.
* 2. Use the command "/home/apmapi_test"
to run this program in SDK's Terminal.
*
* -----------------------------
* How to terminate this program
* -----------------------------
* 1. Use type "Ctrl-C" in SDK's Terminal to terminate this program
* when this program running.
* 2. After finish all test, the program will terminate by itself.
*
************************************************************************/
#include <stdio.h>
#include <eslib_apm.h>
#include <signal.h>
static void sig_usr1_hdr( int signo )
{
* -----------------------------
* How to terminate this program
* -----------------------------
* 1. Use type "Ctrl-C" in SDK's Terminal to terminate this program
* when this program running.
* 2. After finish all test, the program will terminate by itself.
*
************************************************************************/
#include <stdio.h>
#include <eslib_apm.h>
#include <signal.h>
static void sig_usr1_hdr( int signo )
{
printf("apm_test: received SIGUSR1 signal !!\n");
}
int main( void )
{
int
i;
int
valueSetting;
char
Ans;
char
src[256];