From 92d18cc458f9f40075650f5f67dbc704eaa27691 Mon Sep 17 00:00:00 2001 From: mirv Date: Fri, 4 Jan 2008 19:22:19 +0100 Subject: [PATCH] switch cardclient.conf to new loader code --- systems/cardclient/cc.c | 30 ++++++++++-------------------- systems/cardclient/cc.h | 2 +- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/systems/cardclient/cc.c b/systems/cardclient/cc.c index 0eb6b30..797d0fc 100644 --- a/systems/cardclient/cc.c +++ b/systems/cardclient/cc.c @@ -17,7 +17,6 @@ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html */ -#include #include #include @@ -160,14 +159,13 @@ cCardClientLink::cCardClientLink(const char *Name) // -- cSystemLinkCardClient ----------------------------------------------------------- -class cSystemLinkCardClient : public cSystemLink, private cConfRead, cSimpleList { +class cSystemLinkCardClient : public cSystemLink, public cStructListPlain { protected: - virtual bool ParseLine(const char *line, bool fromCache); + virtual bool ParseLinePlain(char *line); public: cSystemLinkCardClient(void); virtual bool CanHandle(unsigned short SysId); virtual cSystem *Create(void); - virtual bool Init(const char *cfgdir); virtual void Clean(void); cCardClient *FindBySysId(unsigned short id, cCardClient *cc); }; @@ -236,6 +234,7 @@ void cSystemCardClient::ProcessEMM(int pid, int caid, unsigned char *buffer) cSystemLinkCardClient::cSystemLinkCardClient(void) :cSystemLink(SYSTEM_NAME,SYSTEM_PRI) +,cStructListPlain("cardclient config",CONF_FILE,SL_MISSINGOK|SL_VERBOSE|SL_NOPURGE) { opts=new cOpts(SYSTEM_NAME,1); opts->Add(new cOptBool("Immediate",trNOOP("Cardclient: connect immediately"),&immediate)); @@ -243,12 +242,11 @@ cSystemLinkCardClient::cSystemLinkCardClient(void) cCardClient *cSystemLinkCardClient::FindBySysId(unsigned short id, cCardClient *cc) { - if(cc) cc=Next(cc); else cc=First(); - while(cc) { - if(cc->CanHandle(id)) return cc; - cc=Next(cc); - } - return 0; + ListLock(false); + for(cc=cc ? Next(cc):First(); cc; cc=Next(cc)) + if(cc->CanHandle(id)) break; + ListUnlock(); + return cc; } bool cSystemLinkCardClient::CanHandle(unsigned short SysId) @@ -261,15 +259,7 @@ cSystem *cSystemLinkCardClient::Create(void) return new cSystemCardClient(); } -bool cSystemLinkCardClient::Init(const char *cfgdir) -{ - Clear(); - ConfRead("cardclient config",AddDirectory(cfgdir,CONF_FILE)); - PRINTF(L_CC_CORE,"created %d client(s)",Count()); - return true; -} - -bool cSystemLinkCardClient::ParseLine(const char *line, bool fromCache) +bool cSystemLinkCardClient::ParseLinePlain(char *line) { char name[32]; int num; @@ -297,5 +287,5 @@ bool cSystemLinkCardClient::ParseLine(const char *line, bool fromCache) void cSystemLinkCardClient::Clean(void) { - Clear(); + ListLock(true); Clear(); ListUnlock(); } diff --git a/systems/cardclient/cc.h b/systems/cardclient/cc.h index ee81783..2cc117a 100644 --- a/systems/cardclient/cc.h +++ b/systems/cardclient/cc.h @@ -50,7 +50,7 @@ class cSystemCardClient; #define MAX_CC_CAID 16 -class cCardClient : public cSimpleItem, protected cMutex { +class cCardClient : public cStructItem, protected cMutex { friend class cSystemCardClient; protected: const char *name; -- 2.39.5