AppCore
Loading...
Searching...
No Matches
EAdvertisementReaderWriter.h
Go to the documentation of this file.
1#ifndef E_ADVERTISEMENT_READER_WRITER_H
2#define E_ADVERTISEMENT_READER_WRITER_H
3
4#include "EAdvertisement.h"
5#include <string>
6using namespace std;
7
8#define _BSD_COMPAT
9#include <sys/file.h>
10#include <unistd.h>
11#include <errno.h>
12
19
21{
22 SHARED_LOCK = 0, // zdielany zamok
23 EXCLUSIVE_LOCK = 1 // exkluzivny zamok
24};
25
27{
28public:
29 static long WriteDisplayCount( EAdvertisement* advertisement, unsigned long busstopID, unsigned long deviceSNR );
30
31 static ELockResult Lock( string fileName, LockType lockType, unsigned short lockTryCount, unsigned long lockTryWait, int& fileDescriptor );
32
33 static long UnLock( int fileDescriptor );
34
36
37private:
38 static string GetFileName( unsigned long advertisementID, unsigned long deviceSNR );
39};
40
41#endif //E_ADVERTISEMENT_READER_WRITER_H
LockType
Definition EAdvertisementReaderWriter.h:21
@ SHARED_LOCK
Definition EAdvertisementReaderWriter.h:22
@ EXCLUSIVE_LOCK
Definition EAdvertisementReaderWriter.h:23
ELockResult
Definition EAdvertisementReaderWriter.h:14
@ FILE_NOT_FOUND
Definition EAdvertisementReaderWriter.h:15
@ FILE_NOT_LOCKED
Definition EAdvertisementReaderWriter.h:17
@ FILE_SUCCESSFULLY_LOCKED
Definition EAdvertisementReaderWriter.h:16
Definition EAdvertisementReaderWriter.h:27
static ELockResult Lock(string fileName, LockType lockType, unsigned short lockTryCount, unsigned long lockTryWait, int &fileDescriptor)
Definition EAdvertisementReaderWriter.cpp:127
static long UnLock(int fileDescriptor)
Definition EAdvertisementReaderWriter.cpp:186
static long WriteDisplayCount(EAdvertisement *advertisement, unsigned long busstopID, unsigned long deviceSNR)
Definition EAdvertisementReaderWriter.cpp:33
Definition EAdvertisement.h:19