summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Eefting <edwin@datux.nl>2012-11-29 19:05:50 (GMT)
committer Edwin Eefting <edwin@datux.nl>2012-11-29 19:05:50 (GMT)
commit1caff40caf383a672b0e4baabcdb0a4d22bc65e2 (patch)
tree20c9fa8af3fd81e269c18988ce18cda3800ecfa6
parent2ddebd5e47464a8868b25dcf3d38c3b823526160 (diff)
improved debugging/status page
-rw-r--r--ccallman.cpp23
-rw-r--r--cconfig.h2
-rw-r--r--modules/dmx.module/module.cpp40
-rw-r--r--modules/docs/html/annotated.html2
-rw-r--r--modules/docs/html/classes.html2
-rw-r--r--modules/mp.module/module.cpp114
-rw-r--r--modules/pl_dir.module/module.cpp7
-rw-r--r--modules/play_vlc.module/module.cpp4
-rw-r--r--wwwdir/dmx.html42
-rw-r--r--wwwdir/synapse/status.html10
10 files changed, 152 insertions, 94 deletions
diff --git a/ccallman.cpp b/ccallman.cpp
index 59b261c..d6ab957 100644
--- a/ccallman.cpp
+++ b/ccallman.cpp
@@ -100,20 +100,21 @@ void CcallMan::endCall(CcallList::iterator callI)
void CcallMan::getStatus(Cvar & var)
{
- //NOTE: only running calls, otherwise the performance inpact is too big when the queue fills up
for (CcallList::iterator callI=callList.begin(); callI!=callList.end(); callI++)
{
Cvar c;
- if (callI->started)
- {
- c["data"]=*callI->msg;
- c["event"]=callI->msg->event;
- c["src"]=callI->msg->src;
- c["dst"]=callI->dst->id;
- c["dstUserName"]=callI->dst->user->getName();
- c["dstModule"]=callI->dst->module->name;
- var["queue"].list().push_back(c);
- }
+ if (callI->started)
+ c["started"]=true;
+ else
+ c["started"]=false;
+
+ c["data"]=*callI->msg;
+ c["event"]=callI->msg->event;
+ c["src"]=callI->msg->src;
+ c["dst"]=callI->dst->id;
+ c["dstUserName"]=callI->dst->user->getName();
+ c["dstModule"]=callI->dst->module->name;
+ var["queue"].list().push_back(c);
}
var["statCallsQueued"]=statCallsQueued;
diff --git a/cconfig.h b/cconfig.h
index a886464..cb6c91b 100644
--- a/cconfig.h
+++ b/cconfig.h
@@ -35,7 +35,7 @@ namespace synapse
{
using namespace std;
using namespace boost::filesystem;
-
+
class Cconfig : public Cvar
{
diff --git a/modules/dmx.module/module.cpp b/modules/dmx.module/module.cpp
index 383d088..b28ec74 100644
--- a/modules/dmx.module/module.cpp
+++ b/modules/dmx.module/module.cpp
@@ -17,6 +17,7 @@
#include "cnetman.h"
+#include "cconfig.h"
#include "synapse.h"
#include <boost/regex.hpp>
#include <sstream>
@@ -28,7 +29,11 @@ using namespace std;
int moduleSessionId=0;
int netSessionId=0;
-Cvar dmxValues;
+
+namespace dmx
+{
+
+synapse::Cconfig dmxValues;
SYNAPSE_REGISTER(module_Init)
{
@@ -36,9 +41,12 @@ SYNAPSE_REGISTER(module_Init)
moduleSessionId=msg.dst;
+ dmxValues.load("etc/synapse/dmx.conf");
+
+
out.clear();
out.event="core_ChangeModule";
- out["maxThreads"]=10;
+ out["maxThreads"]=1;
out.send();
out.clear();
@@ -51,6 +59,11 @@ SYNAPSE_REGISTER(module_Init)
out["name"]="http_json";
out.send();
+ out.clear();
+ out.event="core_LoadModule";
+ out["name"]="timer";
+ out.send();
+
out.clear();
out.event="core_NewSession";
out.send();
@@ -198,6 +211,25 @@ SYNAPSE_REGISTER(module_SessionStart)
}
}
+SYNAPSE_REGISTER(timer_Ready)
+{
+ ERROR("JA");
+ Cmsg out;
+ out.event="timer_Set";
+ out["seconds"]=10;
+ out["repeat"]=-1;
+ out["dst"]=dst;
+ out["event"]="dmx_Timer";
+ out.dst=msg.src;
+ out.send();
+ ERROR("kek");
+}
+
+SYNAPSE_REGISTER(dmx_Timer)
+{
+ if (dmxValues.isChanged())
+ dmxValues.save();
+}
SYNAPSE_REGISTER(dmx_Connect)
{
@@ -245,6 +277,7 @@ SYNAPSE_REGISTER(dmx_Set)
out.send();
dmxValues[msg["channel"]]["value"]=msg["value"];
+ dmxValues.changed();
}
@@ -265,6 +298,8 @@ SYNAPSE_REGISTER(dmx_SetPosition)
out.src=0;
out.dst=0;
out.send();
+
+ dmxValues.changed();
}
SYNAPSE_REGISTER(dmx_Get)
@@ -305,3 +340,4 @@ SYNAPSE_REGISTER(module_Shutdown)
//let the net module shut down to fix the rest
net.doShutdown();
}
+} \ No newline at end of file
diff --git a/modules/docs/html/annotated.html b/modules/docs/html/annotated.html
index bab25f6..0d8fe1e 100644
--- a/modules/docs/html/annotated.html
+++ b/modules/docs/html/annotated.html
@@ -66,7 +66,7 @@
<tr><td class="indexkey"><a class="el" href="classpl_1_1Citer.html">pl::Citer</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="classpl_1_1CiterMan.html">pl::CiterMan</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="classCnetAmi.html">CnetAmi</a></td><td class="indexvalue"></td></tr>
- <tr><td class="indexkey"><a class="el" href="classCnetDmx.html">CnetDmx</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="classdmx_1_1CnetDmx.html">dmx::CnetDmx</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="classCnetHttp.html">CnetHttp</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="classCnetLirc.html">CnetLirc</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="classCnetModule.html">CnetModule</a></td><td class="indexvalue"></td></tr>
diff --git a/modules/docs/html/classes.html b/modules/docs/html/classes.html
index 044ca64..b57ed24 100644
--- a/modules/docs/html/classes.html
+++ b/modules/docs/html/classes.html
@@ -60,7 +60,7 @@
<table style="margin: 10px; white-space: nowrap;" align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
<tr><td rowspan="2" valign="bottom"><a name="letter_C"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;C&#160;&#160;</div></td></tr></table>
</td><td valign="top"><a class="el" href="classasterisk_1_1Cgroup.html">Cgroup</a> (asterisk)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classCnetAmi.html">CnetAmi</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpaper_1_1CpaperClient.html">CpaperClient</a> (<a class="el" href="namespacepaper.html">paper</a>)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpong_1_1Cpong.html">Cpong</a> (pong)&#160;&#160;&#160;</td></tr>
-<tr><td valign="top"><a class="el" href="classChttpSession.html">ChttpSession</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classCnetDmx.html">CnetDmx</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpaper_1_1CpaperObject.html">CpaperObject</a> (<a class="el" href="namespacepaper.html">paper</a>)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpong_1_1Cposition.html">Cposition</a> (pong)&#160;&#160;&#160;</td></tr>
+<tr><td valign="top"><a class="el" href="classChttpSession.html">ChttpSession</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classdmx_1_1CnetDmx.html">CnetDmx</a> (dmx)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpaper_1_1CpaperObject.html">CpaperObject</a> (<a class="el" href="namespacepaper.html">paper</a>)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpong_1_1Cposition.html">Cposition</a> (pong)&#160;&#160;&#160;</td></tr>
<tr><td valign="top"><a class="el" href="classasterisk_1_1Cchannel.html">Cchannel</a> (asterisk)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classChttpSessionMan.html">ChttpSessionMan</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classCnetHttp.html">CnetHttp</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpl_1_1Cpath.html">Cpath</a> (<a class="el" href="namespacepl.html">pl</a>)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classasterisk_1_1Cserver.html">Cserver</a> (asterisk)&#160;&#160;&#160;</td></tr>
<tr><td valign="top"><a class="el" href="classsynapse__curl_1_1Ccurl.html">Ccurl</a> (synapse_curl)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpl_1_1Citer.html">Citer</a> (<a class="el" href="namespacepl.html">pl</a>)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classCnetLirc.html">CnetLirc</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classplay__vlc_1_1CPlayer.html">CPlayer</a> (<a class="el" href="namespaceplay__vlc.html">play_vlc</a>)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classasterisk_1_1Csession.html">Csession</a> (asterisk)&#160;&#160;&#160;</td></tr>
<tr><td valign="top"><a class="el" href="classasterisk_1_1Cdevice.html">Cdevice</a> (asterisk)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpl_1_1CiterMan.html">CiterMan</a> (<a class="el" href="namespacepl.html">pl</a>)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classCnetModule.html">CnetModule</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpong_1_1Cplayer.html">Cplayer</a> (pong)&#160;&#160;&#160;</td><td valign="top"><a class="el" href="classpl_1_1CsortedDir.html">CsortedDir</a> (<a class="el" href="namespacepl.html">pl</a>)&#160;&#160;&#160;</td></tr>
diff --git a/modules/mp.module/module.cpp b/modules/mp.module/module.cpp
index db4c9de..278ac9b 100644
--- a/modules/mp.module/module.cpp
+++ b/modules/mp.module/module.cpp
@@ -19,71 +19,93 @@
#include "synapse.h"
#include "cconfig.h"
#include "clog.h"
-int counter;
-int counterSleep;
-SYNAPSE_REGISTER(module_Init)
+namespace mp
{
- Cmsg out;
+ using namespace std;
- out.clear();
- out.event="core_ChangeModule";
- out["maxThreads"]=1;
- out.send();
+ int playerId;
- out.clear();
- out.event="core_ChangeSession";
- out["maxThreads"]=1;
- out.send();
+ SYNAPSE_REGISTER(module_Init)
+ {
+ Cmsg out;
- ///tell the rest of the world we are ready for duty
- out.clear();
- out.event="core_Ready";
- out.send();
+ playerId=0;
+ out.clear();
+ out.event="core_ChangeModule";
+ out["maxThreads"]=1;
+ out.send();
- out.clear();
+ out.clear();
+ out.event="core_ChangeSession";
+ out["maxThreads"]=1;
+ out.send();
- out.event="core_LoadModule";
- out["name"]="play_vlc";
- out.send();
+ out.clear();
+ out.event="core_LoadModule";
+ out["name"]="play_vlc";
+ out.send();
+ }
-}
+ SYNAPSE_REGISTER(play_vlc_Ready)
+ {
+ Cmsg out;
+ out.event="core_LoadModule";
+ out["name"]="pl_dir";
+ out.send();
+ }
-SYNAPSE_REGISTER(play_vlc_Ready)
-{
-}
+ SYNAPSE_REGISTER(pl_dir_Ready)
+ {
+ Cmsg out;
+ out.event="core_LoadModule";
+ out["name"]="http_json";
+ out.send();
-SYNAPSE_REGISTER(play_vlc_Ready)
-{
- playUrl="http://listen.di.fm/public3/chilloutdreams.pls";
- Cmsg out;
- out.dst=msg["session"];
- out.event="play_NewPlayer";
- out["description"]="second player instance";
- out.send();
-}
+ out.clear();
+ out.event="pl_Create";
+ out["id"]="/home/psy/pl";
+ out.send();
-//a new player has emerged
-SYNAPSE_REGISTER(play_Player)
-{
- Cmsg out;
- out.dst=msg.src;
- out.event="play_Open";
- out["url"]=playUrl;
- out.send();
+ }
+ SYNAPSE_REGISTER(http_json_Ready)
+ {
+ //tell the rest of the world we are ready for duty
+ Cmsg out;
+ out.clear();
+ out.event="core_Ready";
+ out.send();
+ }
- playUrl="/home/psy/mp3/01. Experience (1992)/sadfds";
+ // SYNAPSE_REGISTER(play_vlc_Ready)
+ // {
+ // playUrl="http://listen.di.fm/public3/chilloutdreams.pls";
+ // Cmsg out;
+ // out.dst=msg["session"];
+ // out.event="play_NewPlayer";
+ // out["description"]="second player instance";
+ // out.send();
+ // }
-}
+ //a new player has emerged
+ SYNAPSE_REGISTER(play_Player)
+ {
+ //for now we just support one player
+ if (!playerId)
+ playerId=msg.src;
+ }
-SYNAPSE_REGISTER(play_InfoMeta)
-{
+ SYNAPSE_REGISTER(play_InfoMeta)
+ {
-}
+ }
+
+
+}
diff --git a/modules/pl_dir.module/module.cpp b/modules/pl_dir.module/module.cpp
index 4b7ca14..ab618f1 100644
--- a/modules/pl_dir.module/module.cpp
+++ b/modules/pl_dir.module/module.cpp
@@ -36,6 +36,7 @@ This module can dynamicly generate playlists from directory's. It also can cache
#include "exception/cexception.h"
#define BOOST_FILESYSTEM_VERSION 3
+
#include "boost/filesystem.hpp"
@@ -71,12 +72,6 @@ namespace pl
out["maxThreads"]=1;
out.send();
- out.clear();
- out.event="core_LoadModule";
- out["path"]="modules/http_json.module/libhttp_json.so";
- out.send();
-
-
//tell the rest of the world we are ready for duty
out.clear();
out.event="core_Ready";
diff --git a/modules/play_vlc.module/module.cpp b/modules/play_vlc.module/module.cpp
index 6cbfce4..0c0b239 100644
--- a/modules/play_vlc.module/module.cpp
+++ b/modules/play_vlc.module/module.cpp
@@ -493,7 +493,7 @@ SYNAPSE_REGISTER(module_SessionStart)
SYNAPSE_REGISTER(module_SessionEnd)
{
players[dst].destroy();
- players.erase(msg.dst);
+ players.erase(dst);
}
/** Get a list of players
@@ -592,7 +592,7 @@ SYNAPSE_REGISTER(play_Open)
*/
SYNAPSE_REGISTER(play_Stop)
{
- players[msg.dst].stop();
+ players[dst].stop();
}
diff --git a/wwwdir/dmx.html b/wwwdir/dmx.html
index e389847..0bc58bd 100644
--- a/wwwdir/dmx.html
+++ b/wwwdir/dmx.html
@@ -61,7 +61,7 @@
// $(".colorwheel").each(function()
// {
-
+/*
var cw = Raphael.colorwheel(10,0,300);
cw.onchange=function(color)
{
@@ -88,7 +88,7 @@
};
// });
-
+*/
synapse_register("dmx_Update",function(msg_src, msg_dst, msg_event, msg)
{
if (msg.value!=null)
@@ -141,31 +141,29 @@
<h1>Dyne village light controller</h1>
<div>
<div class='draggable' _channel='1' style='left:150px'>
- <div class='slider' _channel='1'></div>
+ <div class='slider' _channel='1'>groen</div>
</div>
-
- <div class='Xdraggable' _channel='15' >
- <div class='colorwheel' _channel='15' style='left:300px; position:absolute'></div>
+ <div class='draggable' _channel='2' style='left:150px'>
+ <div class='slider' _channel='2'>blauw</div>
+ </div>
+ <div class='draggable' _channel='9' style='left:150px'>
+ <div class='slider' _channel='9'>9</div>
+ </div>
+ <div class='draggable' _channel='4' style='left:150px'>
+ <div class='slider' _channel='4'>4</div>
+ </div>
+ <div class='draggable' _channel='5' style='left:150px'>
+ <div class='slider' _channel='5'>5</div>
+ </div>
+ <div class='draggable' _channel='6' style='left:150px'>
+ <div class='slider' _channel='6'>6</div>
+ </div>
+ <div class='draggable' _channel='7' style='left:150px'>
+ <div class='slider' _channel='7'>7</div>
</div>
-<!--
- <div class='draggable' _channel='5'>
- <div class='slider' _channel='5'></div>
- </div>
-
- <div class='draggable' _channel='7'>
- <div class='slider' _channel='7'></div>
- </div>
-
- <div class='draggable' _channel='6'>
- <div class='slider' _channel='6'></div>
- </div>
- <div class='draggable' _channel='8'>
- <div class='slider' _channel='8'></div>
- </div>
- -->
</div>
diff --git a/wwwdir/synapse/status.html b/wwwdir/synapse/status.html
index 49b673a..5c6b2bb 100644
--- a/wwwdir/synapse/status.html
+++ b/wwwdir/synapse/status.html
@@ -86,17 +86,23 @@
}
$('#queue').empty();
- $('#queue').append("<tr><th>Event<th>Src<th>Dst<th>Data</tr>");
+ $('#queue').append("<tr><th>Event<th>Src<th>Dst<th>started</th>Data</tr>");
for (var call in msg["queue"])
{
var html;
var m=msg["queue"][call];
+ //NOTE:usually when things stay queued and never run, something is wrong with the number-of-threads per session or module
+ var on='';
+ if (!m["started"])
+ on='on';
+
$('#queue').append(
- "<tr>"+
+ "<tr class='"+on+"'>"+
"<td>"+m["event"]+
"<td>"+m["src"]+
"<td>"+m["dst"]+":"+m["dstUserName"]+"@"+m["dstModule"]+
+ "<td>"+m["started"]+
"<td>"+"<pre>"+JSON.stringify(m["data"],null," ")+"</pre>"+
"</tr>"
);