PS5 Barcode scanner
Loading...
Searching...
No Matches
utils.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <limits.h>
#include <setjmp.h>
#include "lib.h"
#include "gps.h"
#include "menu.h"
#include "main.h"
#include "utils.h"
#include "fnt\\battery.fnt"
#include "fnt\\numrev.fnt"
Include dependency graph for utils.c:

Data Structures

struct  TIMER_STRUCT
 

Macros

#define SCREEN_DUMP   "~src.tmp"
 
#define BAT_CHARGE   1
 
#define BAT_NO_CHARGE   0
 

Functions

int IsScannerGPS (void)
 Checks if the scanner has GPS and it is actively being polled.
 
int IsScannerBluetooth (void)
 Checks if the scanner implements bluetooth.
 
int UpdateBluetoothState (int *stateChange)
 Bluetooth stat machine.
 
void ServiceBreadCrumbTimer (void)
 
void GPSService (void)
 GPS radio polling service.
 
int check_timeout (void)
 Check if the general timer has expired.
 
void restore_font (int width, int height)
 Restores font based on fint size set.
 
void display_icon (int x, int y, int state)
 Displays icon store in flash at x, y, submitted.
 
void check_batt_empty (void)
 Checks battery status.
 
int KAwaitkey (int bat_type)
 Wait key depending on battery type.
 
void empty_batt_beep (void)
 Bettery low beep.
 
void display_battery_txt_msg (int empty)
 Displays battery charge message.
 
void show_empty_batt_msg (int empty)
 
void display_rev_voltage (int x, int y, unsigned int voltage)
 Displays voltage in battery icon with shadow.
 
void is_on_cradle (void)
 Tests for charging and displays battery icon when charging.
 
void draw_bar (int x_pos, int y_pos, int width, int height, int color)
 Draws a bar with submitted specification.
 
void info_sound (void)
 Sounds information beep.
 
void keybeeplow (void)
 Sounds low volume key beep.
 
void keybeep (void)
 Sounds normal volume key beep.
 
void errkeybeep (void)
 Sounds key error beep.
 
void okbeep (void)
 Sounds okay beep.
 
void errbeep (void)
 Sounds error beep.
 
int waitkey (void)
 
int waitkey_no_charge (void)
 
int KACheckKey (void)
 
void rectangle (int x1, int y1, int x2, int y2, int color)
 Draws a rectangle with submitted specifications.
 
void rectangle3d (int x1, int y1, int x2, int y2, int color)
 Draws a rectangle with shadowing to submitted specifications.
 
void rectangle3drev (int x1, int y1, int x2, int y2, int color)
 Draws a rectangle with upward shadowing to submitted specifications.
 
int ScanBarcode (char *string, int min_length, int max_length, int *code_id)
 
int composite_post_processing (struct barcode *code, struct barcode *prev_code, unsigned long *time_out_value, short reset_time)
 
int what_day_of_week (void)
 
int KeyboardBarcode (char *string, int min_length, int max_length, int typ, int x, int y, int num,...)
 Displays key entry with backspace processing until a special key is entered.
 
int ScanOrKeyboardInput (char *string, int min_length, int max_length, int typ, int x, int y, int offset)
 
int KeyboardQuantity (char *string, int max_length, int typ, int x, int y, int offset, long def_val, int max_x_d, int rect, int num,...)
 Quantity entry and display.
 
int CheckTimerExpired (int nTimerID)
 Checks if the specified timer has expired.
 
int CheckMyTimer (int nTimerID)
 
int StartMyTimer (int nTimerID, unsigned long nDuration, int fAutoRestart)
 Starts the specified timer with the duration and auto restart.
 
int StopMyTimer (int nTimerID)
 Stops the specified timer.
 
void InitializeMyTimer (void)
 Stops all timers.
 
void ResetMyTimer (int nTimerID)
 Resets the specified timer to its full duration.
 
void PokeActivity (void)
 Resets the autopower down timer.
 
void PauseMyTimer (int nTimerID)
 Pauses the specified timer.
 
void ResumeMyTimer (int nTimerID)
 Resumes the specified timer.
 
void set_font_menu (void)
 Sets font and cursor for menus.
 
void set_font_input (void)
 Sets font and cursor for input.
 
void clear_screen (void)
 Clears the screen.
 

Variables

int batt_power
 
int battery_msg_status
 
int battery_type
 
int menu_state
 
int IN_MENU_MODE
 
int NOT_IN_MENU_MODE
 
int EXITING_MENU_MODE
 
int prefix
 
int suffix
 
int BTStateChange
 
scannerType scanner
 
int g_util_timer
 
int g_util_timeout
 
int g_gps_mode
 
TIMER_STRUCT rgTimers [TIMER_ID_MAX+1]
 

Macro Definition Documentation

◆ BAT_CHARGE

#define BAT_CHARGE   1

◆ BAT_NO_CHARGE

#define BAT_NO_CHARGE   0

◆ SCREEN_DUMP

#define SCREEN_DUMP   "~src.tmp"

Function Documentation

◆ check_batt_empty()

void check_batt_empty ( void )

Checks battery status.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_timeout()

int check_timeout ( void )

Check if the general timer has expired.

◆ CheckMyTimer()

int CheckMyTimer ( int nTimerID)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckTimerExpired()

int CheckTimerExpired ( int nTimerID)

Checks if the specified timer has expired.

F

Here is the caller graph for this function:

◆ clear_screen()

void clear_screen ( void )

Clears the screen.

Here is the caller graph for this function:

◆ composite_post_processing()

int composite_post_processing ( struct barcode * code,
struct barcode * prev_code,
unsigned long * time_out_value,
short reset_time )
Here is the caller graph for this function:

◆ display_battery_txt_msg()

void display_battery_txt_msg ( int empty)

Displays battery charge message.

Here is the caller graph for this function:

◆ display_icon()

void display_icon ( int x,
int y,
int state )

Displays icon store in flash at x, y, submitted.

Here is the caller graph for this function:

◆ display_rev_voltage()

void display_rev_voltage ( int x,
int y,
unsigned int voltage )

Displays voltage in battery icon with shadow.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_bar()

void draw_bar ( int x_pos,
int y_pos,
int width,
int height,
int color )

Draws a bar with submitted specification.

◆ empty_batt_beep()

void empty_batt_beep ( void )

Bettery low beep.

Here is the caller graph for this function:

◆ errbeep()

void errbeep ( void )

Sounds error beep.

Here is the caller graph for this function:

◆ errkeybeep()

void errkeybeep ( void )

Sounds key error beep.

Here is the caller graph for this function:

◆ GPSService()

void GPSService ( void )
extern

GPS radio polling service.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ info_sound()

void info_sound ( void )

Sounds information beep.

Here is the caller graph for this function:

◆ InitializeMyTimer()

void InitializeMyTimer ( void )

Stops all timers.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_on_cradle()

void is_on_cradle ( void )

Tests for charging and displays battery icon when charging.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsScannerBluetooth()

int IsScannerBluetooth ( void )
extern

Checks if the scanner implements bluetooth.

Here is the caller graph for this function:

◆ IsScannerGPS()

int IsScannerGPS ( void )
extern

Checks if the scanner has GPS and it is actively being polled.

Here is the caller graph for this function:

◆ KACheckKey()

int KACheckKey ( void )
Here is the call graph for this function:

◆ KAwaitkey()

int KAwaitkey ( int bat_type)

Wait key depending on battery type.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ keybeep()

void keybeep ( void )

Sounds normal volume key beep.

Here is the caller graph for this function:

◆ keybeeplow()

void keybeeplow ( void )

Sounds low volume key beep.

◆ KeyboardBarcode()

int KeyboardBarcode ( char * string,
int min_length,
int max_length,
int typ,
int x,
int y,
int num,
... )

Displays key entry with backspace processing until a special key is entered.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ KeyboardQuantity()

int KeyboardQuantity ( char * string,
int max_length,
int typ,
int x,
int y,
int offset,
long def_val,
int max_x_d,
int rect,
int num,
... )

Quantity entry and display.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ okbeep()

void okbeep ( void )

Sounds okay beep.

Here is the caller graph for this function:

◆ PauseMyTimer()

void PauseMyTimer ( int nTimerID)

Pauses the specified timer.

Here is the caller graph for this function:

◆ PokeActivity()

void PokeActivity ( void )

Resets the autopower down timer.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rectangle()

void rectangle ( int x1,
int y1,
int x2,
int y2,
int color )

Draws a rectangle with submitted specifications.

Here is the caller graph for this function:

◆ rectangle3d()

void rectangle3d ( int x1,
int y1,
int x2,
int y2,
int color )

Draws a rectangle with shadowing to submitted specifications.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rectangle3drev()

void rectangle3drev ( int x1,
int y1,
int x2,
int y2,
int color )

Draws a rectangle with upward shadowing to submitted specifications.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetMyTimer()

void ResetMyTimer ( int nTimerID)

Resets the specified timer to its full duration.

Here is the caller graph for this function:

◆ restore_font()

void restore_font ( int width,
int height )

Restores font based on fint size set.

Here is the caller graph for this function:

◆ ResumeMyTimer()

void ResumeMyTimer ( int nTimerID)

Resumes the specified timer.

Here is the caller graph for this function:

◆ ScanBarcode()

int ScanBarcode ( char * string,
int min_length,
int max_length,
int * code_id )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ScanOrKeyboardInput()

int ScanOrKeyboardInput ( char * string,
int min_length,
int max_length,
int typ,
int x,
int y,
int offset )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ServiceBreadCrumbTimer()

void ServiceBreadCrumbTimer ( void )
extern
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_font_input()

void set_font_input ( void )

Sets font and cursor for input.

Here is the caller graph for this function:

◆ set_font_menu()

void set_font_menu ( void )

Sets font and cursor for menus.

Here is the caller graph for this function:

◆ show_empty_batt_msg()

void show_empty_batt_msg ( int empty)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StartMyTimer()

int StartMyTimer ( int nTimerID,
unsigned long nDuration,
int fAutoRestart )

Starts the specified timer with the duration and auto restart.

Here is the caller graph for this function:

◆ StopMyTimer()

int StopMyTimer ( int nTimerID)

Stops the specified timer.

Here is the caller graph for this function:

◆ UpdateBluetoothState()

int UpdateBluetoothState ( int * stateChange)
extern

Bluetooth stat machine.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ waitkey()

int waitkey ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ waitkey_no_charge()

int waitkey_no_charge ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ what_day_of_week()

int what_day_of_week ( void )
Here is the caller graph for this function:

Variable Documentation

◆ batt_power

int batt_power
extern

◆ battery_msg_status

int battery_msg_status
extern

◆ battery_type

int battery_type
extern

◆ BTStateChange

int BTStateChange
extern

◆ EXITING_MENU_MODE

int EXITING_MENU_MODE
extern

◆ g_gps_mode

int g_gps_mode

◆ g_util_timeout

int g_util_timeout

◆ g_util_timer

int g_util_timer

◆ IN_MENU_MODE

int IN_MENU_MODE
extern

◆ menu_state

int menu_state
extern

◆ NOT_IN_MENU_MODE

int NOT_IN_MENU_MODE
extern

◆ prefix

int prefix
extern

◆ rgTimers

TIMER_STRUCT rgTimers[TIMER_ID_MAX+1]

◆ scanner

scannerType scanner
extern

◆ suffix

int suffix
extern