connectionMgr/src/editScreenData.c File Reference

connectionMgr - edit screen data handling More...

#include "connectionMgrLog.h"
#include "commonData.h"
#include "connectScreenData.h"
#include "editScreenData.h"

Go to the source code of this file.

Functions

void edit_data_init (void)
void edit_data_destroy (void)
connection_t edit_data_get_network_type (void)
gboolean edit_data_set_network_type (connection_t type)
void edit_data_init_network_profiles (void)
void edit_data_destory_network_profiles (void)
void edit_data_store_network_profiles (void)
int edit_data_get_n_network_profiles (void)
const networkProfile_tedit_data_get_network_profile (guint profileIndex)
gboolean edit_data_set_network_profile (int profileIndex, const networkProfile_t *pNetwork)
int edit_data_get_profile_index (guint regIndex)
int edit_data_get_reg_index (guint profileIndex)
gboolean edit_data_reach_max_profiles (void)
void edit_data_remove_network_profile (int profileIndex)

Variables

static connection_t g_edit_network_type = connection_undefined_t
static networkProfile_tg_network_profiles = NULL
static int g_n_network_profiles = 0


Detailed Description

connectionMgr - edit screen data handling

Copyright (C) 2007 iRex Technologies BV.

Definition in file editScreenData.c.


Function Documentation

void edit_data_destory_network_profiles ( void   ) 

Definition at line 87 of file editScreenData.c.

00088 {
00089     CN_LOGPRINTF("entry");
00090 
00091     common_data_destroy_network_profiles(g_network_profiles,
00092                                          g_n_network_profiles);
00093     g_network_profiles = NULL;
00094     g_n_network_profiles = 0;
00095 }

Here is the call graph for this function:

void edit_data_destroy ( void   ) 

Definition at line 45 of file editScreenData.c.

00046 {
00047     CN_LOGPRINTF("entry");
00048 }

int edit_data_get_n_network_profiles ( void   ) 

Definition at line 104 of file editScreenData.c.

00105 {
00106     CN_LOGPRINTF("entry [%d]", g_n_network_profiles);
00107 
00108     return g_n_network_profiles;
00109 }

const networkProfile_t* edit_data_get_network_profile ( guint  profileIndex  ) 

Definition at line 111 of file editScreenData.c.

00112 {
00113     CN_LOGPRINTF("entry profileIndex[%d]", profileIndex);
00114 
00115     networkProfile_t* ret = NULL;
00116 
00117     g_return_val_if_fail(g_network_profiles != NULL, NULL);
00118     g_return_val_if_fail(profileIndex < g_n_network_profiles, NULL);
00119     
00120     ret = &g_network_profiles[profileIndex];
00121 
00122     CN_LOGPRINTF("ret=%p", ret);
00123 
00124     return ret;
00125 }

connection_t edit_data_get_network_type ( void   ) 

Definition at line 50 of file editScreenData.c.

00051 {
00052     CN_LOGPRINTF("ret=%d", g_edit_network_type);
00053  
00054     return g_edit_network_type;
00055 }

int edit_data_get_profile_index ( guint  regIndex  ) 

Definition at line 166 of file editScreenData.c.

00167 {
00168     CN_LOGPRINTF("entry regIndex[%d]", regIndex);
00169     int profileIndex = -1;
00170 
00171     profileIndex = common_data_get_profile_index(g_network_profiles, 
00172                                                  g_n_network_profiles, 
00173                                                  regIndex);
00174 
00175     return profileIndex;
00176 }

Here is the call graph for this function:

int edit_data_get_reg_index ( guint  profileIndex  ) 

Definition at line 178 of file editScreenData.c.

00179 {
00180     CN_LOGPRINTF("entry profileIndex[%d]", profileIndex);
00181 
00182     int regIndex = -1;
00183     
00184     regIndex = common_data_get_reg_index(g_network_profiles, 
00185                                          g_n_network_profiles, 
00186                                          profileIndex);
00187     return regIndex;
00188 }

Here is the call graph for this function:

void edit_data_init ( void   ) 

Definition at line 36 of file editScreenData.c.

00037 {
00038     CN_LOGPRINTF("entry");
00039 
00040    // initial
00041    connection_t networkType = connect_data_get_network_type();
00042    edit_data_set_network_type(networkType);
00043 }

Here is the call graph for this function:

void edit_data_init_network_profiles ( void   ) 

Definition at line 69 of file editScreenData.c.

00070 {
00071     CN_LOGPRINTF("entry");
00072 
00073     connection_t      networkType;
00074     int               nProfiles;
00075     networkProfile_t* pNetworks;
00076 
00077     // empty the old results
00078     edit_data_destory_network_profiles();
00079 
00080     // init the network profiles
00081     networkType = edit_data_get_network_type();
00082     nProfiles = common_data_init_network_profiles(networkType, &pNetworks);
00083     g_network_profiles = pNetworks;
00084     g_n_network_profiles = nProfiles;
00085 }

Here is the call graph for this function:

gboolean edit_data_reach_max_profiles ( void   ) 

Definition at line 190 of file editScreenData.c.

00191 {
00192     CN_LOGPRINTF("entry");
00193 
00194     connection_t networkType;
00195     gboolean     reachMax = FALSE;
00196    
00197     networkType = edit_data_get_network_type();
00198     if (   ((networkType == wired_t) 
00199              && common_data_reach_max_profiles(wired_t))
00200         || ((networkType == wireless_t) 
00201             && common_data_reach_max_profiles(wireless_t))
00202         || ((networkType == dialup_t) 
00203             && common_data_reach_max_profiles(dialup_t))    )
00204     {
00205         reachMax = TRUE;
00206     } 
00207 
00208     CN_LOGPRINTF("return reachMax=%d", reachMax);
00209     return reachMax;
00210 }

Here is the call graph for this function:

void edit_data_remove_network_profile ( int  profileIndex  ) 

Definition at line 212 of file editScreenData.c.

00213 {
00214     CN_LOGPRINTF("entry");
00215 
00216     int regIndex = edit_data_get_reg_index(profileIndex);
00217     
00218     if (regIndex != -1)
00219     {
00220         common_data_remove_profile(regIndex);
00221         connect_data_update_last_connected_profile_after_delete(regIndex);
00222     }
00223 
00224     // update the the list network profiles in the meanwhile
00225     //  edit_data_init_network_profiles();
00226 }

Here is the call graph for this function:

gboolean edit_data_set_network_profile ( int  profileIndex,
const networkProfile_t pNetwork 
)

Definition at line 127 of file editScreenData.c.

00129 {
00130     int                        regIndex, nActiveIndex;
00131     regNetworkProfile_t*       settings = NULL;
00132 
00133     CN_LOGPRINTF("entry");
00134 
00135     g_return_val_if_fail(pNetwork != NULL, FALSE);
00136     if ((pNetwork->nRegProfiles > 0)
00137          && pNetwork->regSettingsList
00138          && ((pNetwork->nActiveIndex >= 0) 
00139              && (pNetwork->nActiveIndex < pNetwork->nRegProfiles)))
00140     {
00141         nActiveIndex = pNetwork->nActiveIndex;
00142         settings = pNetwork->regSettingsList[nActiveIndex];
00143     }
00144     g_return_val_if_fail(settings != NULL, FALSE);
00145 
00146     if (profileIndex == -1)
00147     {
00148         CN_LOGPRINTF("Adding a new profile.");
00149         regIndex = common_data_get_n_profiles();
00150     }
00151     else
00152     {
00153         regIndex = edit_data_get_reg_index(profileIndex);
00154         CN_LOGPRINTF("Setting %dth profile.", regIndex);
00155     }
00156 
00157     g_return_val_if_fail(regIndex >= 0, FALSE);
00158     common_data_set_profiledata(regIndex, settings, FALSE);
00159 
00160     // update the the list network profiles in the meanwhile
00161     edit_data_init_network_profiles();
00162 
00163     return TRUE;
00164 }

Here is the call graph for this function:

gboolean edit_data_set_network_type ( connection_t  type  ) 

Definition at line 57 of file editScreenData.c.

00058 {
00059     CN_LOGPRINTF("entry type[%d]", type);
00060 
00061     g_return_val_if_fail((type >= 0 && type <= connection_undefined_t), 
00062                          FALSE);
00063 
00064     g_edit_network_type = type;
00065  
00066     return TRUE;
00067 }

void edit_data_store_network_profiles ( void   ) 

Definition at line 97 of file editScreenData.c.

00098 {
00099     CN_LOGPRINTF("entry");
00100 
00101     common_data_store();
00102 }

Here is the call graph for this function:


Variable Documentation

connection_t g_edit_network_type = connection_undefined_t [static]

Definition at line 30 of file editScreenData.c.

int g_n_network_profiles = 0 [static]

Definition at line 34 of file editScreenData.c.

Definition at line 33 of file editScreenData.c.


Generated on Sun Dec 14 17:16:14 2008 by  doxygen 1.5.6