Radio Interface Layer (RIL) oriented code.


Files

file  cellinfo.h
 Radio Interface Layer (RIL) based mobile cell information functions.
file  cellinfoapp.c
 Main GUI module for the cellinfo routines.
file  cellinforc.h
 Resource constants used in the cell info application.
file  cidb.c
 Creates a tower cell id database from a textual description.
file  cidb.h
 Tower cell ID database.
file  cidlg.h
 Tower cell info database configuration dialog.

Data Structures

struct  RILCELLTOWERINFO
 Struct RILCELLTOWERINFO. More...
struct  _coord
 List of coordinates for one tower cell. More...
struct  _cell
 List of tower cells. More...
struct  _area
 List of areas belonging to a mobile network in the tower cell ID database. More...
struct  _net
 List of mobile networks belonging to a country in the tower cell ID database. More...
struct  _ctry
 List of countries in the tower cell ID database. More...
struct  _db
 Whole tower cell ID database. More...
struct  _parsectx
 Context for the CSV parsing routine. More...
struct  t_cidbrd_ctx
 Constext structure used for reading tower cell IDs from the database file. More...
struct  t_cidb_coord
struct  _crtctx
 Context structure for callbacks during importing of the tower cell information file. More...
struct  _crtthrctx
 Structure passed to the tower cell info DB creation thread procedire. More...
struct  t_cidlg_cfg
 Structure for configuration parameters of the tower cell info database configuration dialog. More...

Defines

#define MAXLENGTH_BCCH   48
 Maximum length of the broadcast control channel.
#define MAXLENGTH_NMR   16
 Maximum length of the non membership report.
#define MAINICON   100
 ID of the main icon.
#define T_CTRY   101
 ID of the readonly text control for the country.
#define T_NET   102
 ID of the readonly text control for the mobile network.
#define T_AREA   103
 ID of the readonly text control for the area.
#define T_CELL   104
 ID of the readonly text control for the cell.
#define T_COORD   105
 ID of the readonly text control for the coordinates of the tower cell.
#define T_LATFROM   106
 ID of the configuration text control for the min latitude to import from the CSV file.
#define T_LATTO   107
 ID of the configuration text control for the max. latitude to import from the CSV file.
#define T_LONFROM   108
 ID of the configuration text control for the min longitude to import from the CSV file.
#define T_LONTO   109
 ID of the configuration text control for the max longitude to import from the CSV file.
#define T_TIMER   110
 ID of the configuration text control for the querying timer.
#define T_UDP   111
 ID of the configuration text control for the UDP port to send a packet with the current location of tower cell.
#define DLG_CELLINFO   200
 ID of the dialog window of the cell tower info application.
#define S_ERRTIT   300
 ID of the string for the title of the error message box.
#define S_CIAPPERR_OK   301
 ID of the resource string for error code CIAPPERR_OK.
#define S_CIAPPERR_REGISTER_CLASS   302
 ID of the resource string for error code CIAPPERR_REGISTER_CLASS.
#define S_CIAPPERR_INIT   303
 ID of the resource string for error code CIAPPERR_INIT.
#define S_CIAPPERR_QUERY   304
 ID of the resource string for error code CIAPPERR_QUERY.
#define S_CIAPPERR_UNINIT   305
 ID of the resource string for error code CIAPPERR_UNINIT.
#define S_CIAPPERR_TIMER   306
 ID of the resource string for error code CIAPPERR_TIMER.
#define S_CIAPPERR_KILLTIMER   307
 ID of the resource string for error code CIAPPERR_KILLTIMER.
#define S_CIAPPERR_UNKNOWN   308
 ID of the resource string for error code CIAPPERR_UNKNOWN.
#define BTN_CFG   401
 ID of the config button.
#define DLG_CIDB   901
 ID of the tower cell info db configuration dialog.
#define BTN_SELCSVFILE   1001
 ID of the search button.
#define BTN_SELDBFILE   1002
 ID of the DB file selection button.
#define BTN_DEFDBFILE   1003
 ID of the DB file definition button.
#define BTN_LOADCSVFILE   1004
 ID of the load button.
#define T_CSVFILE   1101
 ID of the edit box for the name of the CSV file.
#define T_DBFILE   1102
 ID of the edit box for the name of the DB file.
#define I_PROGR_RD   1103
 ID of the progress bar for reading.
#define I_PROGR_WR   1104
 ID of the progress bar for writing.
#define S_CSVFILTER   1201
 ID of the string for filtering files in the Open File Dialog for CSV files.
#define S_DBFILTER   1203
 ID of the string for filtering files in the Open File Dialog for DB files.
#define S_CIDB_ERR_TITLE   1300
 ID of the title string for the tower cell info error message window.
#define S_CIDB_UNKN_ERR   1301
 ID of the string for an unknown cidb error message.
#define S_CIDB_ERR_OK   1302
 ID of the string for asuccess information.
#define S_CIDB_ERR_PARAM   1303
 ID of the string for cidb error message.
#define S_CIDB_ERR_MEMORY   1304
 ID of the string for cidb error message.
#define S_CIDB_ERR_READ   1305
 ID of the string for cidb error message.
#define S_CIDB_ERR_WRITE   1306
 ID of the string for cidb error message.
#define S_CIDB_ERR_PARSE   1307
 ID of the string for cidb error message.
#define S_CIDB_ERR_FILE   1308
 ID of the string for cidb error message.
#define S_CIDB_ERR_SEEK   1309
 ID of the string for cidb error message.
#define S_CIDB_ERR_INTERRUPT   1310
 ID of the string for cidb error message.
#define S_CIDB_ERR_INTERNAL   1311
 ID of the string for cidb error message.
#define S_CIDB_NFND_CTRY   1312
 ID of the string for cidb error message.
#define S_CIDB_NFND_NET   1313
 ID of the string for cidb error message.
#define S_CIDB_NFND_AREA   1314
 ID of the string for cidb error message.
#define S_CIDB_NFND_CELL   1315
 ID of the string for cidb error message.
#define S_CIDB_TITLE   1350
 ID of the title string for the tower cell info message window.
#define _INT2CHAR(theBuf, aNum)
 Converts the given integer to an array of 4 bytes in a specified platform independend format.
#define _CHAR2INT(theNum, aBuf)
 Converts the given byte array in a platform independent format to an integer.
#define _WRINT(theRet, anFD, aNum, aBuf, aJmp)
 Writes the given integer number to the file.
#define _RDINT(theRet, theNum, anFD, aBuf, aJmp)
 Reads an integer from the file.
#define WM_DBLOAD_FINISHED   WM_USER + 1
 Message posted after the thread procedure for loading tower cell info database is ready.

Typedefs

typedef HANDLE _HRIL
 Type for the RIL handle.
typedef void(CALLBACK * _RILRESULTCALLBACK )(DWORD dwCode, HRESULT hrCmdID, const void *lpData, DWORD cbData, DWORD dwParam)
 Type for the fuction for the RIL result callback.
typedef void(CALLBACK * _RILNOTIFYCALLBACK )(DWORD dwCode, const void *lpData, DWORD cbData, DWORD dwParam)
 Type for the function for the RIL notify callback.
typedef HRESULT(* _t_ril_initialize )(DWORD dwIndex, _RILRESULTCALLBACK pfnResult, _RILNOTIFYCALLBACK pfnNotify, DWORD dwNotificationClasses, DWORD dwParam, _HRIL *lphRil)
 Type of the function pointer to RIL_Initialize.
typedef HRESULT(* _t_ril_deinitialize )(_HRIL hRil)
 Type of the function pointer to RIL_Deinitialize.
typedef HRESULT(* _t_ril_getcelltowerinfo )(_HRIL hRil)
 Type of the function pointer to RIL_GetCellTowerInfo.
typedef void(* t_cellinfocb )(const RILCELLTOWERINFO *aCellInfo)
 Type for a callback function returning cell information.
typedef short(* t_cidb_progress )(short perc, short rdwr, void *ctx)
 Callback function for showing progress of the import of tower cell information database.

Enumerations

enum  _t_ciapperr {
  CIAPPERR_OK = 0, CIAPPERR_REGISTER_CLASS, CIAPPERR_INIT, CIAPPERR_QUERY,
  CIAPPERR_UNINIT, CIAPPERR_UNKNOWN, CIAPPERR_TIMER, CIAPPERR_KILLTIMER
}
 Error codes for the cellinfo GUI application. More...
enum  t_cidb_err {
  CIDB_ERR_OK = 0, CIDB_ERR_PARAM, CIDB_ERR_MEMORY, CIDB_ERR_READ,
  CIDB_ERR_WRITE, CIDB_ERR_PARSE, CIDB_ERR_FILE, CIDB_ERR_SEEK,
  CIDB_ERR_INTERRUPT, CIDB_ERR_INTERNAL, CIDB_NFND_CTRY, CIDB_NFND_NET,
  CIDB_NFND_AREA, CIDB_NFND_CELL
}
 Tower cell ID database error codes. More...

Functions

HRESULT cellinfo_init (t_cellinfocb aCb)
 Initializes the cellinfo module.
HRESULT cellinfo_uninit ()
 Uninitializes the cellinfo module.
HRESULT cellinfo_query ()
 Makes a cell tower info query.
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
 The main entry point of the cellinfo program.
t_cidb_err cidbcrt (const t_filename *anInputFile, const t_filename *anOutputFile, t_cidb_progress aProgrCb, double aMinLat, double aMaxLat, double aMinLon, double aMaxLon, void *aProgrCbCtx)
 Creates a binary tower cell ID database file from the CSV file from http://www.opencellid.org.
t_cidb_err cidbrd (t_cidbrd_ctx *aCtx, t_cidb_coord *theCoords, int *theNum, t_hfileio anFD, int aCtryId, int aNetId, int anAreaId, int aCellId)
 Reads coordinates of the given tower cell from the database.
t_cidb_err cidbrdfile (t_cidb_coord *theCoords, int *theNum, const t_filename *aFileName, int aCtryId, int aNetId, int anAreaId, int aCellId)
 Reads coordinates of the given tower cell from the database.
DWORD WINAPI _cidbcrtthr (LPVOID params)
 Thread procedure for creating tower cell info database.
void cidlg_rdcfg (t_cidlg_cfg *theCfg)
 Reads configuration from a configuration file.
BOOL cidlg (HWND aParentWin, t_cidlg_cfg *aCfg)
 Starts the tower cell info db configuration dialog.
const TCHAR * cistrerr (TCHAR *theBuf, int aLen, HINSTANCE hInst, t_cidb_err anErr)
 Returns error description for the given error code.
void cishowerr (HWND hwnd, t_cidb_err errcode)
 Shows textual description of a tower cell infor database error in a message box.

Define Documentation

#define _CHAR2INT ( theNum,
aBuf   ) 

Value:

{ \
  theNum = aBuf[0] | (int) aBuf[1] << 8 | \
          (int) aBuf[2] << 16 | (int) aBuf[3] << 24; \
}
Converts the given byte array in a platform independent format to an integer.

Parameters:
theNum out, the resulting integer
aBuf in, pointer to a at least 4 byte array in format produced by _INT2CHAR().

#define _INT2CHAR ( theBuf,
aNum   ) 

Value:

{ \
  theBuf[0] = (char) (aNum & 0x000000ff); \
  theBuf[1] = (char) ((aNum >>  8) & 0x000000ff); \
  theBuf[2] = (char) ((aNum >> 16) & 0x000000ff); \
  theBuf[3] = (char) ((aNum >> 24) & 0x000000ff); \
}
Converts the given integer to an array of 4 bytes in a specified platform independend format.

First comes the littlest byte, last is the highest byte.

Parameters:
theBuf out, pointer to the buffer where the result of this function will be stored. Mut be able to hold at least 4 bytes, unsigned char*, must not be NULL.
aNum in, the number to convert, int.

#define _RDINT ( theRet,
theNum,
anFD,
aBuf,
aJmp   ) 

Value:

{ \
  int res, num; \
  FILEIO_RD(res, num, aBuf, 4, anFD); \
  if (res != 0) { _CHAR2INT(theNum, aBuf); theRet = CIDB_ERR_OK; } \
  else { theRet = CIDB_ERR_READ; goto aJmp; } \
}
Reads an integer from the file.

Integer expected in format as produced in _WRINT().

Parameters:
theRet out, integer, CIDB_ERR_OK or error.
theNum out, integer, the resulting integer number.
anFD in, the file descriptor.
aBuf in/out, char[4], help buffer.
aJmp in, name of the goto mark where to jump after error.

#define _WRINT ( theRet,
anFD,
aNum,
aBuf,
aJmp   ) 

Value:

{ \
  int written = 0; \
  _INT2CHAR(aBuf, aNum); \
  FILEIO_WR(written, aBuf, 4, anFD); \
  if (written == 4) theRet = CIDB_ERR_OK; \
  else { theRet = CIDB_ERR_WRITE; goto aJmp; } \
}
Writes the given integer number to the file.

Parameters:
theRet out, integer, CIDB_ERR_OK or error
anFD in, the file descriptor.
aNum in, integer, the number to write.
aBuf in/out, char[4], help buffer.
aJmp in, name of the goto mark, where to jump after error.

#define BTN_CFG   401

ID of the config button.

#define BTN_DEFDBFILE   1003

ID of the DB file definition button.

DB file definition button opens a file save dialog for creating a new binary tower cell info database file.

#define BTN_LOADCSVFILE   1004

ID of the load button.

#define BTN_SELCSVFILE   1001

ID of the search button.

#define BTN_SELDBFILE   1002

ID of the DB file selection button.

DB file selection button opens a file open dialog for selecting an existent binary tower cell info database file.

#define DLG_CELLINFO   200

ID of the dialog window of the cell tower info application.

#define DLG_CIDB   901

ID of the tower cell info db configuration dialog.

#define I_PROGR_RD   1103

ID of the progress bar for reading.

#define I_PROGR_WR   1104

ID of the progress bar for writing.

#define MAINICON   100

ID of the main icon.

#define MAXLENGTH_BCCH   48

Maximum length of the broadcast control channel.

As defined in Microsofts ril.h. See also http://msdn.microsoft.com/en-us/library/aa922482.aspx

#define MAXLENGTH_NMR   16

Maximum length of the non membership report.

As defined in Microsofts ril.h. See also http://msdn.microsoft.com/en-us/library/aa922482.aspx

#define S_CIAPPERR_INIT   303

ID of the resource string for error code CIAPPERR_INIT.

#define S_CIAPPERR_KILLTIMER   307

ID of the resource string for error code CIAPPERR_KILLTIMER.

#define S_CIAPPERR_OK   301

ID of the resource string for error code CIAPPERR_OK.

#define S_CIAPPERR_QUERY   304

ID of the resource string for error code CIAPPERR_QUERY.

#define S_CIAPPERR_REGISTER_CLASS   302

ID of the resource string for error code CIAPPERR_REGISTER_CLASS.

#define S_CIAPPERR_TIMER   306

ID of the resource string for error code CIAPPERR_TIMER.

#define S_CIAPPERR_UNINIT   305

ID of the resource string for error code CIAPPERR_UNINIT.

#define S_CIAPPERR_UNKNOWN   308

ID of the resource string for error code CIAPPERR_UNKNOWN.

#define S_CIDB_ERR_FILE   1308

ID of the string for cidb error message.

#define S_CIDB_ERR_INTERNAL   1311

ID of the string for cidb error message.

#define S_CIDB_ERR_INTERRUPT   1310

ID of the string for cidb error message.

#define S_CIDB_ERR_MEMORY   1304

ID of the string for cidb error message.

#define S_CIDB_ERR_OK   1302

ID of the string for asuccess information.

#define S_CIDB_ERR_PARAM   1303

ID of the string for cidb error message.

#define S_CIDB_ERR_PARSE   1307

ID of the string for cidb error message.

#define S_CIDB_ERR_READ   1305

ID of the string for cidb error message.

#define S_CIDB_ERR_SEEK   1309

ID of the string for cidb error message.

#define S_CIDB_ERR_TITLE   1300

ID of the title string for the tower cell info error message window.

#define S_CIDB_ERR_WRITE   1306

ID of the string for cidb error message.

#define S_CIDB_NFND_AREA   1314

ID of the string for cidb error message.

#define S_CIDB_NFND_CELL   1315

ID of the string for cidb error message.

#define S_CIDB_NFND_CTRY   1312

ID of the string for cidb error message.

#define S_CIDB_NFND_NET   1313

ID of the string for cidb error message.

#define S_CIDB_TITLE   1350

ID of the title string for the tower cell info message window.

#define S_CIDB_UNKN_ERR   1301

ID of the string for an unknown cidb error message.

#define S_CSVFILTER   1201

ID of the string for filtering files in the Open File Dialog for CSV files.

#define S_DBFILTER   1203

ID of the string for filtering files in the Open File Dialog for DB files.

#define S_ERRTIT   300

ID of the string for the title of the error message box.

#define T_AREA   103

ID of the readonly text control for the area.

#define T_CELL   104

ID of the readonly text control for the cell.

#define T_COORD   105

ID of the readonly text control for the coordinates of the tower cell.

#define T_CSVFILE   1101

ID of the edit box for the name of the CSV file.

#define T_CTRY   101

ID of the readonly text control for the country.

#define T_DBFILE   1102

ID of the edit box for the name of the DB file.

#define T_LATFROM   106

ID of the configuration text control for the min latitude to import from the CSV file.

#define T_LATTO   107

ID of the configuration text control for the max. latitude to import from the CSV file.

#define T_LONFROM   108

ID of the configuration text control for the min longitude to import from the CSV file.

#define T_LONTO   109

ID of the configuration text control for the max longitude to import from the CSV file.

#define T_NET   102

ID of the readonly text control for the mobile network.

#define T_TIMER   110

ID of the configuration text control for the querying timer.

#define T_UDP   111

ID of the configuration text control for the UDP port to send a packet with the current location of tower cell.

#define WM_DBLOAD_FINISHED   WM_USER + 1

Message posted after the thread procedure for loading tower cell info database is ready.


Typedef Documentation

typedef HANDLE _HRIL

Type for the RIL handle.

typedef void(CALLBACK * _RILNOTIFYCALLBACK)(DWORD dwCode, const void *lpData, DWORD cbData, DWORD dwParam)

Type for the function for the RIL notify callback.

Defined in Microsofts ril.h, see also http://msdn.microsoft.com/en-us/library/aa922465.aspx

Parameters:
dwCode result code.
lpData data associated with the notification.
cbData size of the structure pointed by lpData.
dwParam parameter passed to RIL_Initialize.

typedef void(CALLBACK * _RILRESULTCALLBACK)(DWORD dwCode, HRESULT hrCmdID, const void *lpData, DWORD cbData, DWORD dwParam)

Type for the fuction for the RIL result callback.

Defined in Microsofts ril.h, see also http://msdn.microsoft.com/en-us/library/aa920069.aspx

Parameters:
dwCode result code.
hrCmdID ID returned by the command that originated the response.
lpData data associated with the notification.
cbData size of the structure pointed by lpData.
dwParam parameter passed to RIL_Initialize.

typedef HRESULT(* _t_ril_deinitialize)(_HRIL hRil)

Type of the function pointer to RIL_Deinitialize.

See also http://msdn.microsoft.com/en-us/library/aa919624.aspx

Parameters:
hRil RIL handle returned in RIL_Initialize.
Returns:
S_OK or error code.

typedef HRESULT(* _t_ril_getcelltowerinfo)(_HRIL hRil)

Type of the function pointer to RIL_GetCellTowerInfo.

See also http://msdn.microsoft.com/en-us/library/aa923065.aspx

Parameters:
hRil RIL handle returned in RIL_Initialize.
Returns:
S_OK or error code.

typedef HRESULT(* _t_ril_initialize)(DWORD dwIndex, _RILRESULTCALLBACK pfnResult, _RILNOTIFYCALLBACK pfnNotify, DWORD dwNotificationClasses, DWORD dwParam, _HRIL *lphRil)

Type of the function pointer to RIL_Initialize.

See also http://msdn.microsoft.com/en-us/library/aa919106.aspx

Parameters:
dwIndex RIL port to use, usually 1.
pfnResult function result callback.
pfnNotify notification callback.
dwNotificationClasses notifications enabled to the client.
dwParam parameter to pass to callback functions.
lphRil returned RIL handle.
Returns:
S_OK for OK, S_FALSE if radio is not present yet, E_XXX on errors. Function RIL_Initialize defined in Microsofts ril.h and ril.dll, see also http://msdn.microsoft.com/en-us/library/aa919106.aspx

typedef void(* t_cellinfocb)(const RILCELLTOWERINFO *aCellInfo)

Type for a callback function returning cell information.

Parameters:
aCellInfo the cell information

typedef short(* t_cidb_progress)(short perc, short rdwr, void *ctx)

Callback function for showing progress of the import of tower cell information database.

Parameters:
perc progress of the operation in percents.
rdwr kind of the operation, != 0 means reading of the csv data into memory, 0 means writing the memory structures to the binary output file.
ctx context for the callback function.
Returns:
!= 0 if the import has to continue, 0 if it has to break.


Enumeration Type Documentation

Error codes for the cellinfo GUI application.

Enumerator:
CIAPPERR_OK  OK.
CIAPPERR_REGISTER_CLASS  RegisterClass error.
CIAPPERR_INIT  Cell info initialization error.
CIAPPERR_QUERY  Cell info query error.
CIAPPERR_UNINIT  Cell info uninitialization error.
CIAPPERR_UNKNOWN  Unknown error.
CIAPPERR_TIMER  Timer error.
CIAPPERR_KILLTIMER  Kill timer error.

enum t_cidb_err

Tower cell ID database error codes.

Enumerator:
CIDB_ERR_OK  Everything went OK.
CIDB_ERR_PARAM  Wrong parameters passed to the function.
CIDB_ERR_MEMORY  No memory.
CIDB_ERR_READ  Read error.
CIDB_ERR_WRITE  Write error.
CIDB_ERR_PARSE  Input file parse error.
CIDB_ERR_FILE  Can't open file.
CIDB_ERR_SEEK  Can't seek within the file.
CIDB_ERR_INTERRUPT  Interrupted by the user.
CIDB_ERR_INTERNAL  Internal error, thread etc.
CIDB_NFND_CTRY  Country ID could not be found.
CIDB_NFND_NET  Mobile network ID could not be found within the country.
CIDB_NFND_AREA  Area ID could not be found within the mobile network.
CIDB_NFND_CELL  Tower cell ID could not be found within the area.


Function Documentation

DWORD WINAPI _cidbcrtthr ( LPVOID  params  ) 

Thread procedure for creating tower cell info database.

Calls cidbcrt() with parameters given in params.

Parameters:
params casted to a pointer to struct _crtthctx.
Returns:
one of t_cidb_err codes casted to DWORD. Use WINAPI function GetExitCodeThread() in order to get this result code.

HRESULT cellinfo_init ( t_cellinfocb  aCb  ) 

Initializes the cellinfo module.

This is a "singleton" model. New initialization deinitializes the previous one.

Parameters:
aCb callback function for returned cell information.
Returns:
S_OK or error, the function already may have queried GetLastError.

HRESULT cellinfo_query (  ) 

Makes a cell tower info query.

The same like RIL_GetCellTowerInfo(). The answer comes through the t_cellinfocb callback function passed to cellinfo_init.

Returns:
S_OK if OK, E_INVALIDARG, if DLL or functions not found, other errors directly from RIL_GetCellTowerInfo.

HRESULT cellinfo_uninit (  ) 

Uninitializes the cellinfo module.

Returns:
S_OK or error, the function already may have queried GetLastError.

t_cidb_err cidbcrt ( const t_filename anInputFile,
const t_filename anOutputFile,
t_cidb_progress  aProgrCb,
double  aMinLat,
double  aMaxLat,
double  aMinLon,
double  aMaxLon,
void *  aProgrCbCtx 
)

Creates a binary tower cell ID database file from the CSV file from http://www.opencellid.org.

The input file is expected in the following format:

  • CSV file, fields separated with comma, lines separated with LF (10 ascii), CR characters (13 ascii) are ignored, floating point numbers with a dot as decimal separator.
  • the following fields are read from each line of the CSV file, 0-based:
    • field 1 - the latitude of the tower cell, floating point number.
    • field 2 - the longitude of the tower cell, floating point number.
    • field 3 - country ID, integer.
    • field 4 - mobile network ID, integer.
    • field 5 - area code, integer.
    • field 6 - tower cell ID, integer.

The resulting binary tower cell database file consists of integers in format produced in the macros _WRINT(), _INT2CHAR() (integer, 4 bytes, from lowest to highest byte). The integer entries in the file have the following meaning:

  • number of countries
  • countries in format:
    • size of the country entry in bytes, incl. sizes of all underlying structures: mobile networks, areas, cells, coordinates.
    • country ID.
    • number of mobile networks belonging to the country
    • mobile networks in format:
      • size of the mobile network entry, incl. sizes of underlying areas, cells and coordinates.
      • mobile network ID.
      • number of areas belonging to the mobile network.
      • areas in format:
        • size of the area entry, incl. sizes of underlying cells and coordinates.
        • area ID.
        • number of tower cells belonging to the area.
        • tower cells in format:
          • tower cell ID.
          • number of coordinates for one tower cell. For some mysterious reason one tower cell may have multiple coordinate definitions.
          • tower cell coordinates in format:
            • the latitude of the tower cell, integer number representing decimal degrees multiplicated by _DBLMULT (10000000), positive for North, negative for South.
            • the longitude of the tower cell, integer number representing decimal degress multiplicated by _DBLMULT (10000000), positive for East, negative for West.

Parameters:
anInputFile Name of the CSV file with tower cell definititions from http://www.opencellid.org
anOutputFile The resulting binary database file.
aProgrCb Import progress callback. If null, then no callback is used.
aMinLat minimum latitude of the area to read in.
aMaxLat maximum latitude of the area to read in.
aMinLon minimum longitude of the area to read in.
aMaxLon maximum longitude of the area to read in.
aProgrCbCtx Context for the callback function.
Returns:
CIDB_ERR_OK or error code.

t_cidb_err cidbrd ( t_cidbrd_ctx aCtx,
t_cidb_coord theCoords,
int *  theNum,
t_hfileio  anFD,
int  aCtryId,
int  aNetId,
int  anAreaId,
int  aCellId 
)

Reads coordinates of the given tower cell from the database.

Parameters:
aCtx context. The function reads all tower cell definitions at once from the file and stores them in the given context structure. Requesting another tower cell ID for the same country, network and area ID causes reading data from the memory rather than using expensive file operations.
theCoords out, pointer to the array of returned tower cell coordinates. Funny, but the http://www.opencellid.org provides multiple coordinates for the same tower cell, we return as much of them as possible, letting the user decide, which of them are garbage.
theNum in/out. Input is the number of coordinates, which the function may maximally return, ie. the size of array pointed by theCoords. After the call the function places here the number of coordinates really returned.
anFD descriptor of the binary database file as created in cidbcrt().
aCtryId country ID of the tower cell.
aNetId mobile network ID of the tower cell.
anAreaId area ID of the tower cell.
aCellId the tower cell ID.

t_cidb_err cidbrdfile ( t_cidb_coord theCoords,
int *  theNum,
const t_filename aFileName,
int  aCtryId,
int  aNetId,
int  anAreaId,
int  aCellId 
)

Reads coordinates of the given tower cell from the database.

Please consider using cidbrd() rather than this function. This function opens, scans and closes the database file on each call what may be expensive if multiply queried, especially for sequential queries for the same country, network and srea ID.

Parameters:
theCoords out, pointer to the array of returned tower cell coordinates. Funny, but the http://www.opencellid.org provides multiple coordinates for the same tower cell, we return as much of them as possible, letting the user decide, which of them are garbage.
theNum in/out. Input is the number of coordinates, which the function may maximally return, ie. the size of array pointed by theCoords. After the call the function places here the number of coordinates really returned.
aFileName name of the binary database file as created in cidbcrt().
aCtryId country ID of the tower cell.
aNetId mobile network ID of the tower cell.
anAreaId area ID of the tower cell.
aCellId the tower cell ID.

BOOL cidlg ( HWND  aParentWin,
t_cidlg_cfg aCfg 
)

Starts the tower cell info db configuration dialog.

Parameters:
aParentWin handle of the parent window for the dialog.
aCfg pointer to the configuration structure.
Returns:
TRUE if commited with OK.

void cidlg_rdcfg ( t_cidlg_cfg theCfg  ) 

Reads configuration from a configuration file.

Parameters:
theCfg pointer for the resulting configuration.

void cishowerr ( HWND  hwnd,
t_cidb_err  errcode 
)

Shows textual description of a tower cell infor database error in a message box.

Parameters:
hwnd handle of the window, under which to show the error. This will be the parent for the message box containing the error text.
errcode the error code to show.

const TCHAR* cistrerr ( TCHAR *  theBuf,
int  aLen,
HINSTANCE  hInst,
t_cidb_err  anErr 
)

Returns error description for the given error code.

Returns a string describing the given error code. The string is retrieved from the resource of the given instance.

Parameters:
theBuf pointer to the buffer where to store the error description.
aLen length of the buffer pointed by aLen. In fact the buffer must be able to store at least aLen+1 characters.
hInst handle of the instance holding the string resources with the error descriptions.
anErr the error code.

int WINAPI WinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
PSTR  szCmdLine,
int  iCmdShow 
)

The main entry point of the cellinfo program.

Parameters:
hInstance ignored
hPrevInstance ignored
szCmdLine ignored
iCmdShow ignored.
Returns:
0


Generated on Mon Jul 12 14:51:51 2010 for cetoys by  doxygen 1.5.6