35 int isblob = !strcmp(
tagXMLEle(root),
"setBLOBVector");
41 log(
fmt(
"read <%s device='%s' name='%s'>\n",
47 if (!strcmp(roottag,
"getProperties"))
50 Msg *mp =
new Msg(
this, root);
64 if (!strcmp(roottag,
"enableBLOB"))
76#ifdef OSX_EMBEDED_MODE
77 if (this->dev.empty())
78 fprintf(stderr,
"STARTED \"%s\"\n", dp->name.c_str());
81 this->dev.insert(
dev);
88 if (!strcmp(roottag,
"pingRequest"))
92 Msg * mp =
new Msg(
this, root);
134 Msg *mp =
new Msg(
this, root);
160#ifdef OSX_EMBEDED_MODE
161 fprintf(stderr,
"STOPPED \"%s\"\n",
name.c_str());
189 std::set<std::string> remoteAdvertised;
193 if (dp ==
nullptr)
continue;
195 std::string remoteUid = dp->remoteServerUid();
196 bool isRemote = !remoteUid.empty();
199 if ((!
dev.empty()) &&
dev[0] !=
'*' && !dp->isHandlingDevice(
dev))
204 if (
dev.empty() && isRemote)
206 if (remoteAdvertised.find(remoteUid) != remoteAdvertised.end())
211 remoteAdvertised.
insert(remoteUid);
215 if (isRemote == 0 && !strcmp(roottag,
"enableBLOB"))
221 dp->log(
fmt(
"queuing responsible for <%s device='%s' name='%s'>\n",
232 std::string meRemoteServerUid =
me ?
me->remoteServerUid() :
"";
236 if (dp ==
nullptr)
continue;
248 if ((!meRemoteServerUid.empty()) && dp->remoteServerUid() == meRemoteServerUid)
254 dp->log(
fmt(
"queuing snooped <%s device='%s' name='%s'>\n",
263void DvrInfo::addSDevice(
const std::string &dev,
const std::string &name)
301 restarts(model.restarts)
317 return this->dev.find(
dev) != this->dev.end();
322 std::string logLine =
"Driver ";
CommandLineArgs * userConfigurableArguments
void logDMsg(XMLEle *root, const char *dev)
std::string fmt(const char *fmt,...)
static void q2Clients(ClInfo *notme, int isblob, const std::string &dev, const std::string &name, Msg *mp, XMLEle *root)
static void q2Servers(DvrInfo *me, Msg *mp, XMLEle *root)
std::vector< unsigned long > ids() const
std::set< std::string > dev
static void q2RDrivers(const std::string &dev, Msg *mp, XMLEle *root)
void closeWritePart() override
bool isHandlingDevice(const std::string &dev) const
static void q2SDrivers(DvrInfo *me, int isblob, const std::string &dev, const std::string &name, Msg *mp, XMLEle *root)
virtual DvrInfo * clone() const =0
static ConcurrentSet< DvrInfo > drivers
void onMessage(XMLEle *root, std::list< int > &sharedBuffers) override
void log(const std::string &log) const override
Property * findSDevice(const std::string &dev, const std::string &name) const
std::list< Property * > sprops
DvrInfo(const DvrInfo &model)
static void crackBLOB(const char *enableBLOB, BLOBHandling *bp)
void traceMsg(const std::string &log, XMLEle *root)
static Msg * fromXml(MsgQueue *from, XMLEle *root, std::list< int > &incomingSharedBuffers)
const char * findXMLAttValu(XMLEle *ep, const char *name)
Find an XML element's attribute value.
char * tagXMLEle(XMLEle *ep)
Return the tag of an XML element.
XMLEle * addXMLEle(XMLEle *parent, const char *tag)
add an element with the given tag to the given element. parent can be NULL to make a new root.
XMLEle * setXMLEleTag(XMLEle *ep, const char *tag)
Update the tag of an element.
void prXMLEle(FILE *fp, XMLEle *ep, int level)
Print an XML element.
void delXMLEle(XMLEle *ep)
delXMLEle Delete XML element.
char * pcdataXMLEle(XMLEle *ep)
Return the pcdata of an XML element.
XMLAtt * addXMLAtt(XMLEle *ep, const char *name, const char *valu)
Add an XML attribute to an existing XML element.