C Language Development Kit/Functions/GetIndicator

From OptiWiki

Jump to: navigation, search
Description This function retrieves the state of various screen indicators.
Syntax
int getindicator(int indicator);
Arguments
int indicator
indicator is the screen indicator of which one wants to know the state. It can be specified as one of the following values, shown here in the order as they appear on top of the display (the shape of the indicator is shown left of the indicator value):
File:Battery sign col.jpg BATTERY_SIGN_COL This symbol is controlled by the operating system, and indicates that the battery is low, or almost empty.
File:Bu battery sign col.jpg BU_BATTERY_SIGN_COL This symbol is controlled by the operating system, and indicates that the back-up battery is low, or almost empty.
Returns
>= 1 The indicator was ON.
0 The indicator was OFF.
Remarks None
Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    int key;
 
    printf("\fQ1 = batt state\nQ2 = b/u batt\n");
    resetkey();
    while( 1 )
    {
        if( (key = getchar()) != EOF)
        {
            resetkey();
            sound( TSTANDARD, VHIGH, SHIGH, 0);
            switch( key )
            {
                case Q1_KEY:
                    if( getindicator( BATTERY_SIGN_COL ) == OFF)
                        printf("\fbattery = OK");
                    else
                        printf("\fbattery = LOW");
                    break;
                case Q2_KEY:
                    if( getindicator( BU_BATTERY_SIGN_COL ) == OFF)
                        printf("\fb/u batt = OK");
                    else
                        printf("\fb/u batt = LOW");
                    break;
                default:
                    printf("\fQ1 = batt state\nQ2 = b/u batt\n");
                    break;
            }
        }
        idle();
    }
}


Views
Personal tools