Stefan Schuermans commited on 2011-11-14 21:51:42
Showing 1 changed files, with 37 additions and 5 deletions.
... | ... |
@@ -145,10 +145,14 @@ protected: |
145 | 145 |
protected: |
146 | 146 |
SettingFile m_fileInStream; ///< input stream name file |
147 | 147 |
SettingFile m_fileBind; ///< bind address file |
148 |
+ Directory m_dirDestsBlp; ///< static BLP destinations directory |
|
149 |
+ Directory m_dirDestsEblp; ///< static EBLP destinations directory |
|
148 | 150 |
Directory m_dirDestsMcuf; ///< static MCUF destinations directory |
149 | 151 |
std::string m_nameInStream; ///< name of input stream |
150 | 152 |
Stream *m_pInStream; ///< input stream |
151 | 153 |
SOCK *m_pSock; ///< socket to use for sending streams |
154 |
+ Dests m_destsBlp; ///< current static BLP destinations |
|
155 |
+ Dests m_destsEblp; ///< current static EBLP destinations |
|
152 | 156 |
Dests m_destsMcuf; ///< current static MCUF destinations |
153 | 157 |
}; // class Sender |
154 | 158 |
|
... | ... |
@@ -168,6 +172,8 @@ Sender<ADDR, SOCK>::Sender(CallMgr &callMgr, StreamMgr &streamMgr, |
168 | 172 |
Module(callMgr, streamMgr, dirBase), |
169 | 173 |
m_fileInStream(dirBase.getFile("instream")), |
170 | 174 |
m_fileBind(dirBase.getFile("bind")), |
175 |
+ m_dirDestsBlp(dirBase.getSubdir("blp")), |
|
176 |
+ m_dirDestsEblp(dirBase.getSubdir("eblp")), |
|
171 | 177 |
m_dirDestsMcuf(dirBase.getSubdir("mcuf")), |
172 | 178 |
m_pInStream(NULL), |
173 | 179 |
m_pSock(NULL) |
... | ... |
@@ -178,6 +184,8 @@ Sender<ADDR, SOCK>::Sender(CallMgr &callMgr, StreamMgr &streamMgr, |
178 | 184 |
createSock(); |
179 | 185 |
|
180 | 186 |
// load static destinations |
187 |
+ updateDestsFull(m_dirDestsBlp, m_destsBlp, BlinkenProtoBlp); |
|
188 |
+ updateDestsFull(m_dirDestsEblp, m_destsEblp, BlinkenProtoEblp); |
|
181 | 189 |
updateDestsFull(m_dirDestsMcuf, m_destsMcuf, BlinkenProtoMcuf); |
182 | 190 |
} |
183 | 191 |
|
... | ... |
@@ -214,6 +222,14 @@ void Sender<ADDR, SOCK>::updateConfig() |
214 | 222 |
|
215 | 223 |
// static destinations update |
216 | 224 |
// (directory modified -> full, otherwise -> light) |
225 |
+ if (m_dirDestsBlp.checkModified()) |
|
226 |
+ updateDestsFull(m_dirDestsBlp, m_destsBlp, BlinkenProtoBlp); |
|
227 |
+ else |
|
228 |
+ updateDestsLight(m_destsBlp, BlinkenProtoBlp); |
|
229 |
+ if (m_dirDestsEblp.checkModified()) |
|
230 |
+ updateDestsFull(m_dirDestsEblp, m_destsEblp, BlinkenProtoEblp); |
|
231 |
+ else |
|
232 |
+ updateDestsLight(m_destsEblp, BlinkenProtoEblp); |
|
217 | 233 |
if (m_dirDestsMcuf.checkModified()) |
218 | 234 |
updateDestsFull(m_dirDestsMcuf, m_destsMcuf, BlinkenProtoMcuf); |
219 | 235 |
else |
... | ... |
@@ -227,14 +243,22 @@ void Sender<ADDR, SOCK>::updateConfig() |
227 | 243 |
template<typename ADDR, typename SOCK> |
228 | 244 |
void Sender<ADDR, SOCK>::setFrame(stBlinkenFrame *pFrame) |
229 | 245 |
{ |
230 |
- std::string mcuf; |
|
246 |
+ std::string blp, eblp, mcuf; |
|
231 | 247 |
|
232 | 248 |
// convert frame to protocol data |
249 |
+ if (!m_destsBlp.empty()) |
|
250 |
+ frame2data(pFrame, BlinkenProtoBlp, blp); |
|
251 |
+ if (!m_destsEblp.empty()) |
|
252 |
+ frame2data(pFrame, BlinkenProtoEblp, eblp); |
|
233 | 253 |
if (!m_destsMcuf.empty()) |
234 | 254 |
frame2data(pFrame, BlinkenProtoMcuf, mcuf); |
235 | 255 |
|
236 |
- // send frame to all static MCUF destinations |
|
256 |
+ // send frame to all static destinations |
|
237 | 257 |
typename Dests::const_iterator itDest; |
258 |
+ for (itDest = m_destsBlp.begin(); itDest != m_destsBlp.end(); ++itDest) |
|
259 |
+ sendFrame(blp, itDest->m_addr); |
|
260 |
+ for (itDest = m_destsEblp.begin(); itDest != m_destsEblp.end(); ++itDest) |
|
261 |
+ sendFrame(eblp, itDest->m_addr); |
|
238 | 262 |
for (itDest = m_destsMcuf.begin(); itDest != m_destsMcuf.end(); ++itDest) |
239 | 263 |
sendFrame(mcuf, itDest->m_addr); |
240 | 264 |
|
... | ... |
@@ -246,14 +270,22 @@ void Sender<ADDR, SOCK>::setFrame(stBlinkenFrame *pFrame) |
246 | 270 |
template<typename ADDR, typename SOCK> |
247 | 271 |
void Sender<ADDR, SOCK>::setNoFrame() |
248 | 272 |
{ |
249 |
- std::string mcuf; |
|
273 |
+ std::string blp, eblp, mcuf; |
|
250 | 274 |
|
251 | 275 |
// get "no frame" protocol data |
276 |
+ if (!m_destsBlp.empty()) |
|
277 |
+ noFrame2data(BlinkenProtoBlp, blp); |
|
278 |
+ if (!m_destsEblp.empty()) |
|
279 |
+ noFrame2data(BlinkenProtoEblp, eblp); |
|
252 | 280 |
if (!m_destsMcuf.empty()) |
253 | 281 |
noFrame2data(BlinkenProtoMcuf, mcuf); |
254 | 282 |
|
255 |
- // send "no frame" to all static MCUF destinations |
|
283 |
+ // send "no frame" to all staticdestinations |
|
256 | 284 |
typename Dests::const_iterator itDest; |
285 |
+ for (itDest = m_destsBlp.begin(); itDest != m_destsBlp.end(); ++itDest) |
|
286 |
+ sendFrame(blp, itDest->m_addr); |
|
287 |
+ for (itDest = m_destsEblp.begin(); itDest != m_destsEblp.end(); ++itDest) |
|
288 |
+ sendFrame(eblp, itDest->m_addr); |
|
257 | 289 |
for (itDest = m_destsMcuf.begin(); itDest != m_destsMcuf.end(); ++itDest) |
258 | 290 |
sendFrame(mcuf, itDest->m_addr); |
259 | 291 |
|
... | ... |
@@ -522,7 +554,7 @@ void Sender<ADDR, SOCK>::noFrame2data(etBlinkenProto proto, std::string &data) |
522 | 554 |
{ |
523 | 555 |
// obtain "no frame" protcol data |
524 | 556 |
(void)proto; // FIXME |
525 |
- data.clear(); // FIXME |
|
557 |
+ data.assign("", 1); // FIXME |
|
526 | 558 |
} |
527 | 559 |
|
528 | 560 |
/* ################ |
529 | 561 |