My connection wasn't being shared either, although I did comment about
the anomoly of the access via the Wiser CNI.
Are there no basic setup instructions ! ? If not then I will write
some up but here's some quick backround...
Basically the model is that one iViewer , I'll call it the 'master',
needs a project with a TCP connection to C-Bus named 'cbus'. Because
a C-Bus CNI or PCI can only have one attached client (unless shared
through say a Global Cache serial) a second UDP connection named
'broadcast' is employed to forward update information to any other
active iViewers. I had expected that any C-Bus button presses on
iViewers are heard by the master (UDP broadcast) and then an
appropriate command forwarded to C-Bus over TCP but I can't see any
code for this :-( aspect. This means that as long as the iViewer
'master' is communicating with C-Bus then others are updated but they
can't control C-Bus and this will cease if it closes.
C-Bus periodically sends messages called MMI's that act as a
synchronisation method. The JS decodes the Level MMI's when received
(and provided the CNI is in a mode that sends them) to synch initial
button state on connection. The JS also monitors the originating
commands that change a group level on C-Bus and updates the state of
any button/slider who's join number 'matches' the group number.
Within the GUI configuration you create an offset for a button number
eg 1000 and hence button 1023 would 'match' C-Bus group 23. The
application number (eg 56 for lighting) is not stored in or derived
from the button number but each of the two supported applications
(lighting 56 and trigger 202) has it's own configurable offset . As
there are a max of 256 groups per application this is quite economical
on join usage but not flexible or necessarily easy to reverse lookup
or expand should you wish to support the other C-Bus applications.
However lighting and trigger cover the needs for most people.
Similar to my issues with xAP device identification the usage of the
join number to identify the C-Bus endpoint is messy but hopefully this
should go away when we have tags available.
The C-Bus plugin reads the XML file that C-Bus Toolkit creates (neat)
and you select individual groups within lighting or trigger
applications to add preset commands that then get listed under the
cbus connection. You can then drag the commands onto a button/slider
that has a suitable join number such that it then controls the C-Bus
group.
I am not sure quite what aspects of C-Bus there might be within the
DLL (I suspect only the GUI is within this code) but I've now had a
chance to better understand what is being done in the Javascript and
it's fairly straight forward. However no initialisation or setup of
the PCI / CNI is done upon initial connection and no check that it is
in the right mode. Hence no restore on exit is needed. This means
that it must be preconfigured to be in the correct mode or the
connection won't work. Various other applications that connect to the
CNI/PCI (C-Gate, C-Bus Toolkit via C-Gate and C-Bus Diagnostics) may
well change the mode and cause difficulties. There are also the
power up defaults for the interface to consider. This is I'm fairly
sure where all the problems are happening. Also no MMI request is
issued upon connect to speed state synchronisation.
In my usage of attaching via a single CNI and changing it's
defaults and then disconnecting and reconnecting from iViewer I did
not get a lot of success , I am not sure if this is because of an exit
cleanup of defaults by Diagnostics. I did get it to work by
configuring a second remote CNI .
Key to troubleshooting is ensuring that the system shows 'connected'
and that data can be seen continually arriving from C-Bus and creating
feedback matches. Pressing a button should show data being sent. Then
it's important that the correct data is arriving from the interface
and the mode setup here is all important. Checksums are required and
validated. The actual data (sIn) arrives via feedback from the cbus
connection and calls a function called doNetworkTraffic if you're
interested. This routine is a good place to check that checksums are
working too.