#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <glib.h>
#include "setupLog.h"
#include "system.h"
#include "iLiadPincodeData.h"
Go to the source code of this file.
Functions | |
| static sysPincodeSetting_t * | pincode_setting_dup (const sysPincodeSetting_t *settings) |
| static void | iLiad_pincode_data_read_pincode (sysPincodeSetting_t *settings) |
| static void | iLiad_pincode_data_write_pincode (const sysPincodeSetting_t *settings) |
| void | iLiad_pincode_data_init (void) |
| void | iLiad_pincode_data_destroy (void) |
| gboolean | iLiad_pincode_data_is_pincode_on (void) |
| void | iLiad_pincode_data_set_pincode_on (gboolean enable) |
| unsigned char * | iLiad_pincode_data_get_pincode (void) |
| void | iLiad_pincode_data_set_pincode (const gchar *text) |
| gboolean | iLiad_pincode_data_check_pincode (gchar *text) |
| void | iLiad_pincode_data_store () |
Variables | |
| static sysPincodeSetting_t * | g_current_pincode = NULL |
| static sysPincodeSetting_t * | g_stored_pincode = NULL |
Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.
in Pincode data of settings, read or write pincode data from sysset table
Definition in file iLiadPincodeData.c.
| gboolean iLiad_pincode_data_check_pincode | ( | gchar * | text | ) |
Definition at line 123 of file iLiadPincodeData.c.
00124 { 00125 int i, len; 00126 gboolean is_digital = FALSE; 00127 gboolean returnVal = FALSE; 00128 gchar c; 00129 00130 if (NULL == text) 00131 return FALSE; 00132 len = strlen(text); 00133 if (len < PINCODE_MIN_LENGTH || len > PINCODE_MAX_LENGTH) 00134 return FALSE; 00135 for (i = 0; i < len; i++) 00136 { 00137 c = text[i]; 00138 is_digital = (isdigit(c)) ? TRUE : FALSE; 00139 if (FALSE == is_digital) 00140 break; 00141 } 00142 if (TRUE == is_digital) 00143 returnVal = TRUE; 00144 else 00145 returnVal = FALSE; 00146 return returnVal; 00147 }
| void iLiad_pincode_data_destroy | ( | void | ) |
Definition at line 71 of file iLiadPincodeData.c.
00072 { 00073 if (g_current_pincode) 00074 { 00075 g_free(g_current_pincode); 00076 g_current_pincode = NULL; 00077 } 00078 00079 if (g_stored_pincode) 00080 { 00081 g_free(g_stored_pincode); 00082 g_stored_pincode = NULL; 00083 } 00084 }
| unsigned char* iLiad_pincode_data_get_pincode | ( | void | ) |
Definition at line 100 of file iLiadPincodeData.c.
00101 { 00102 if (NULL == g_current_pincode) 00103 return NULL; 00104 return g_current_pincode->pincode; 00105 }
| void iLiad_pincode_data_init | ( | void | ) |
Definition at line 51 of file iLiadPincodeData.c.
00052 { 00053 iLiad_pincode_data_destroy(); 00054 00055 g_current_pincode = g_new0(sysPincodeSetting_t, 1); 00056 iLiad_pincode_data_read_pincode(g_current_pincode); 00057 00058 if (NULL == g_current_pincode) 00059 { 00060 ST_WARNPRINTF("use default values"); 00061 g_current_pincode = g_new0(sysPincodeSetting_t, 1); 00062 g_current_pincode->enable = FALSE; 00063 g_current_pincode->pincode[0] = '\0'; 00064 } 00065 else 00066 { 00067 g_stored_pincode = pincode_setting_dup(g_current_pincode); 00068 } 00069 }

| gboolean iLiad_pincode_data_is_pincode_on | ( | void | ) |
Definition at line 86 of file iLiadPincodeData.c.
00087 { 00088 if (NULL == g_current_pincode) 00089 return FALSE; 00090 return g_current_pincode->enable; 00091 }
| static void iLiad_pincode_data_read_pincode | ( | sysPincodeSetting_t * | settings | ) | [static] |
Definition at line 188 of file iLiadPincodeData.c.
00189 { 00190 if (NULL == settings) 00191 return; 00192 sysset_read_pincode_onoff(&(settings->enable)); 00193 sysset_read_pincode_string(settings->pincode); 00194 }

| void iLiad_pincode_data_set_pincode | ( | const gchar * | text | ) |
Definition at line 107 of file iLiadPincodeData.c.
00108 { 00109 int len; 00110 if (NULL == text) 00111 return; 00112 if (NULL == g_current_pincode) 00113 return; 00114 len = strlen(text); 00115 if (len > PINCODE_MAX_LENGTH) 00116 len = PINCODE_MAX_LENGTH; 00117 strncpy(g_current_pincode->pincode, text, len); 00118 }
| void iLiad_pincode_data_set_pincode_on | ( | gboolean | enable | ) |
Definition at line 93 of file iLiadPincodeData.c.
00094 { 00095 if (NULL == g_current_pincode) 00096 return; 00097 g_current_pincode->enable = enable; 00098 }
| void iLiad_pincode_data_store | ( | ) |
Definition at line 150 of file iLiadPincodeData.c.
00151 { 00152 if ((NULL == g_current_pincode) || (NULL == g_stored_pincode)) 00153 return; 00154 00155 if ((g_current_pincode->enable != g_stored_pincode->enable) 00156 || (0 != strcmp(g_current_pincode->pincode, g_stored_pincode->pincode))) 00157 { 00158 iLiad_pincode_data_write_pincode(g_current_pincode); 00159 00160 if (g_stored_pincode->enable != g_current_pincode->enable) 00161 g_stored_pincode->enable = g_current_pincode->enable; 00162 00163 if (strcmp(g_current_pincode->pincode, g_stored_pincode->pincode)) 00164 strcpy(g_stored_pincode->pincode, g_current_pincode->pincode); 00165 } 00166 }

| static void iLiad_pincode_data_write_pincode | ( | const sysPincodeSetting_t * | settings | ) | [static] |
Definition at line 196 of file iLiadPincodeData.c.
00197 { 00198 if (NULL == settings) 00199 return; 00200 00201 sysset_write_pincode_onoff(settings->enable); 00202 sysset_write_pincode_string(settings->pincode); 00203 }

| static sysPincodeSetting_t * pincode_setting_dup | ( | const sysPincodeSetting_t * | settings | ) | [static] |
Definition at line 168 of file iLiadPincodeData.c.
00169 { 00170 sysPincodeSetting_t *dup = NULL; 00171 00172 if (NULL == settings) 00173 return NULL; 00174 00175 dup = g_new0(sysPincodeSetting_t, 1); 00176 00177 dup->enable = settings->enable; 00178 00179 if (0 == strlen(settings->pincode)) 00180 dup->pincode[0] = '\0'; 00181 else 00182 strcpy(dup->pincode, settings->pincode); 00183 00184 return dup; 00185 }
sysPincodeSetting_t* g_current_pincode = NULL [static] |
Definition at line 42 of file iLiadPincodeData.c.
sysPincodeSetting_t* g_stored_pincode = NULL [static] |
Definition at line 44 of file iLiadPincodeData.c.
1.5.6