AppCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions | Variables
cardeventcreator.h File Reference
#include "appcore/cardevent/cardeventdatfilemanager.h"
#include "appcore/cardevent/eventpurse.h"
#include "appcore/cardevent/EventPrepaidTicket.h"
#include "appcore/cardevent/eventblacklist.h"
#include "appcore/cardevent/EventPrepaidTicketZone.h"
#include "appcore/cardevent/EventPrepaidTicketRange.h"
#include "appcore/cardevent/deletedevent.h"
Include dependency graph for cardeventcreator.h:

Go to the source code of this file.

Classes

struct  DeletedEvents
 

Functions

struct DeletedEvents __attribute__ ((packed))
 
 CardEventCreator ()
 
 ~CardEventCreator ()
 
void Init (__ESTRING path)
 
void AddCardEvent (CardEvent __EDATAPTR cardEvent)
 
void Write ()
 
void GetBytes (__EBYTEARR __EDATAPTR __EVALREF idxFileBuffer, __EBYTEARR __EDATAPTR __EVALREF datFileBuffer, unsigned long __EVALREF idxFileSize, unsigned long __EVALREF datFileSize)
 
unsigned long GetBytes (__EBYTEARR __EDATAPTR __EVALREF idx_dat_FileBuffer)
 
static int MergeCumulative (__ESTRING pathOld, __ESTRING pathUpd, unsigned long &maxEventNumberInUpdate)
 
static bool CleanEventFile (__ESTRING path)
 
unsigned long GetValidFrom ()
 
unsigned long GetValidTo ()
 
void SetValidFrom (unsigned long from)
 
void SetValidTo (unsigned long to)
 
void SetFileType (char type)
 

Variables

long long SNR
 
unsigned long CardEventID
 
__ECLASS CardEventCreatorPr
 
__EPUBLIC __ECLASS LIBCARDEVENT_API CardEventCreator
 Class for composing event files. You can add events and then export as binary file. More...
 

Function Documentation

struct DeletedEvents __attribute__ ( (packed)  )
void CardEventCreator::AddCardEvent ( CardEvent __EDATAPTR  cardEvent)

Adds card event to collection

Parameters
cardEvent: pointer to CardEvent instance - card event to add
CardEventCreator ( )
static bool CleanEventFile ( __ESTRING  path)
static

CleanEventFile Cleans event file = removes records in .dat file which dont have twin in .idx file. In fact it removes all processed events since last cleaning.

Parameters
path: string - path to event file including file name without extension (e.g. "/opt/emtest/var/events")
Returns
bool - false = file not found true = success
void CardEventCreator::GetBytes ( __EBYTEARR __EDATAPTR __EVALREF  idxFileBuffer,
__EBYTEARR __EDATAPTR __EVALREF  datFileBuffer,
unsigned long __EVALREF  idxFileSize,
unsigned long __EVALREF  datFileSize 
)

OBSOLETE - use GetBytes( __EBYTEARR __EDATAPTR __EVALREF idx_dat_FileBuffer ) instead

Here is the call graph for this function:

unsigned long CardEventCreator::GetBytes ( __EBYTEARR __EDATAPTR __EVALREF  idx_dat_FileBuffer)

GetBytes Creates event file buffer containing all parts

See also
CardEventReader::SplitEventFile
Parameters
idx_dat_FileBuffer: data stream [output parameter] - event file buffer
Returns
unsigned long - size of event file buffer returned as param

Here is the call graph for this function:

unsigned long GetValidFrom ( )

Returns event file validity start (usually creation date)

See also
SetValidFrom
Returns
unsigned long - event file validity start as unix timestamp (number of seconds since January 1st, 1970)
unsigned long GetValidTo ( )

Returns event file validity end (can be 0)

See also
SetValidTo
Returns
unsigned long : event file validity end as unix timestamp (number of seconds since January 1st, 1970)
void Init ( __ESTRING  path)

Here is the caller graph for this function:

static int MergeCumulative ( __ESTRING  pathOld,
__ESTRING  pathUpd,
unsigned long &  maxEventNumberInUpdate 
)
static

Method merges current event files with downloaded incremental files and saves it under current file name (pathOld).
Downloading whole event file causes a large traffic and takes a long time on slow connection so there is a possibility to download only 'increments' - client provides the highest event ID he has already downloaded and webservice send only newer events. These increments have to be merged with old files then. This merging method merges index files including deleting already processed events, but .dat file keeps untouched except appending new events to the end of file. It's because of very long merging times on some devices. Therefore .dat files should be cleaned sometimes - best way is to delete event files and download brand new files. Or CleanEventFile method can be called.

Parameters
pathOld: string - absulute path to current event file without any extension (e.g. /tmp/events)
pathUpd: string - absolute path to downloaded increments without any extension (e.g. /tmp/events_tmp)
maxEventNumberInUpdate: unsigned long [output parameter] - the largest event number in update files (can be 0 if 'pathOld' event files not found - in this case client has to find out max event number by himself)
Returns
int - error code (0 if OK)

Here is the caller graph for this function:

void SetFileType ( char  type)

Set file type (used by incremental downloading of event files from webservice)

See also
MergeCumulative
Parameters
type: char - file type
  • 0 - incremental event file (should be merged)
  • 1 - whole event file (should NOT be merged - original file should be replaced)
void SetValidFrom ( unsigned long  from)

Sets event file validity start (usually creation date)

See also
GetValidFrom
Parameters
from: unsigned long - event file validity start as unix timestamp (number of seconds since January 1st, 1970)
void SetValidTo ( unsigned long  to)

Sets event file validity end (can be 0)

See also
GetValidTo
Parameters
to: unsigned long - event file validity end as unix timestamp (number of seconds since January 1st, 1970)
void Write ( )
CardEventCreator::~CardEventCreator ( )

Variable Documentation

CardEventCreator::CardEventCreator
Initial value:
{
private:
EEventTripTicketPr __EDATAPTR d
Definition: EEventTripTicket.h:96
__ECLASS CardEventCreatorPr
Definition: cardeventcreator.h:27
#define __EDATAPTR
Definition: managed_defines.h:14

Class for composing event files. You can add events and then export as binary file.

CardEventCreatorPr::CardEventCreatorPr
unsigned long CardEventID
long long SNR