Hello, i have been talking in the IRC channel, and so I will copy here what I've said there. Hope someone can help. Thanks
[11:12:46] <jonaspaulo_> lets say i have a 4 switch openwrt board with a sensor connected via spi or uart
[11:13:02] <jonaspaulo_> how can i integrate the sensor with linuxMCE?
[11:13:23] <jonaspaulo_> i mean i plug via ethernet the core to one ethernet port on the switch
[11:13:33] <jonaspaulo_> but afterwards how do i access the sensor data
[11:14:02] <jonaspaulo_> lets assume the processing of data is already passed through the spi to the ethernet port
[11:14:08] <possy> jonaspaulo_, open up a thread in the forum. I am sure hari will have some information for you
[11:14:17] <jonaspaulo_> kk
[11:14:19] <jonaspaulo_> will do
[11:14:24] <jonaspaulo_> cause my project
[11:14:37] <jonaspaulo_> has sensors connected to various openwrt boards
[11:14:52] <jonaspaulo_> like zigbee which i talked to TSCHAKeee2 about
[11:15:02] <jonaspaulo_> possibly trying to do some drivers for it
[11:15:12] <jonaspaulo_> like bluetooth with an ethernet bridge also
[11:15:16] <jonaspaulo_> a vga cam
[11:15:20] <jonaspaulo_> and some wireless sensors
[11:15:36] <jonaspaulo_> but none has really and outgoing connection like usb or rs232
[11:15:45] <jonaspaulo_> and instead are connected directly to the openwrt board
[11:16:13] <jonaspaulo_> the goal was to integrate all this in linuxmce
I posted this entry in the wiki http://wiki.linuxmce.org/index.php/Startup_Info_For_Developers#.27.27.27First_Steps_in_making_your_own_device_driver.27.27.27__.28WIP.29 and today i was testing it to see if everything is ok. But before that i was trying to add a general usb cam to the system, and as i am doing that i got a warning of low harddrive free space left 0o. How is it possible? i haven't done almost nothing nor installed nothing. and my hard drive is 60 gb :S
Well I made a .pdf in order to present my linuxmce network config and expose some doubts. If someone can please read it and tell me something about it i would be very appreciated since my schedule to deliver the project is tighten up and I am not moving on :/
here is the link: http://filebin.ca/kwccfg
Quote from: jonaspaulo on March 29, 2010, 10:42:00 PM
Well I made a .pdf in order to present my linuxmce network config and expose some doubts. If someone can please read it and tell me something about it i would be very appreciated since my schedule to deliver the project is tighten up and I am not moving on :/
here is the link: http://filebin.ca/kwccfg
Hmmm... the 'Switches' you mention in the PDF are all network switches correct? ie they switch IP packets. Therefore assuming that is true you do not need to make DCE devices for these at all as S1, S2 & S3 are just passive parts of your LAN. Its the devices connected to the ports of the S1-3 switches that will need devices.
Andrew
yes IP based. But don't i need to add templates at least to SW 2 and 3 as interface devices to the sensors? Since i think all sensors must have an interface device? Thanks for looking into it
Quote from: totallymaxed on March 30, 2010, 09:32:21 AM
Hmmm... the 'Switches' you mention in the PDF are all network switches correct?
No. They are devices like the GC-100 afaict
So as "possy" in the irc suggested, i will present here the questions, nor the system though ( you can read it please in the pdf , its easier than post here).
The goal is to connect the sensors to LinuxMCE, they all provide their info via TCP/IP since they are connected to the switches and provide their info through the ethernet ports, i need to make the code in c++ on the end of LinuxMCE to receive that data.
Question 1 - I have three switches in the system, one to raise the number of lan ports (S1), and the other two which have sensors connected to them via SPI, rs2323, CAN. The S1 is connected to the core pc, and the other two are connected to this first one. Do i need to create a template device for any of the switches ( the main one and the sensor's ones) or letting the system know them in any way? (since they are just used to interconnect the system?)
Question 2 - For the sensors themselves should I mimic for example the motion sensor, the one you already have in the system? in terms of events, commands ,etc for the template? And what differs from yours is the real implementation c++ code?
THanks
Hi
I'll try to answer, but not knowing the details, it's hard to give any detailed answer ;)
1. You are talking about switches. It is not clear from your post if some of these (S1?) are a plain ethernet switch. If it is, its not necessary to create any device template for it.
If they are different types of switches, I would recommend that you somehow make it clear what type each one is.
1 & 2. Device templates (DT). If you need special device templates for the sensors depends on how it is best to implement this device driver.
For instance the ZWave driver has a special ZWave DT for the USB controller itself, and uses generic DTs for any ZWave sensor and other ZWave device connected.
In that setup, all commands are sent to the ZWave DT/Device, which then sends the correct command to the sensor/device. Each sensor/device DT has a port/channel data which uniquely identifies the device within the ZWave network.
Using this approach you'd have to write one piece of code which is responsible for communication between LMCE and your switches and sensors.
In your PDF you are talking about selecting "writing c++ code" for the sensor DT. Is that really necessary?
I'd prefer to keep the number of code-requiring DTs as low as possible. Maybe some or all devices can use the same approach as ZWave, use generic DTs and a central ZWave driver/DT?
br,
sambuca
1. yes they are just ethernet switches, so there's no need to even add it somehow to linuxmce right? just plug
2. yes that approach would be the best one, i didn't know it was possible. so the ZWaveDT/Device equivalent in my scenario would be S2 and S3 which have the sensors connected to them. and yes i guess its easier to create code to act in the switches. So for the sensors i just mimic templates which similar functions to mine (like motion sensor, etc) and then control then via the "central driver" right?
Another thing how should i create that "central driver"? I have to associate it with some switch? (S2 and S3) , create the template and then implement the code?
Thanks a lot for the info
2.
Yes, if you don't have any reason not to, I would recommend writing one driver.
So basically, first you would add a device template with the switch (S2/S3) in mind and select "Write c++ code". There are LMCE utilities that will generate the C++ skeleton to write your code in. Real easy. This gives you a complete executable that will connect to the dcerouter and can communicate with LMCE.
In this template, you can specify commands and events for the device. You could see the ZWave and probably other existing DTs what could make sense to add. For instance: you will probably add a "Sensor tripped" event, as your sensors will fire this, and the device receive it and send the event to LMCE.
Is the S2 and S3 switches the same model, or present much the same functionality? If so, maybe you should create one driver (and one device template) for both. You could then add two devices in LMCE, one for each switch.
For the sensor templates, I would use the existing ones, if they suit your need. Basically, sensors will only emit events, and has only a few device data. If you need to store much data in the devices, maybe you could add new DTs for them.
regards,
sambuca
Quote from: jonaspaulo on March 30, 2010, 11:08:20 AM
yes IP based. But don't i need to add templates at least to SW 2 and 3 as interface devices to the sensors? Since i think all sensors must have an interface device? Thanks for looking into it
So therefore you do not need any DT's for the S1-2 network switches at all...just think of these as part of the network cabling itself. The Sensors themselves are connected to an RJ45 socket on the S1-2 switches and it is these sensors that need DT's.
Andrew
@sambuca thanks i am trying to code now the general control template to S2 and S3 switches (they are the same brand) , seeing the one for gc100 but it has code god knows what that does lol, but i am trying to do something by looking into it :/
@totallymaxed no, i mean the sensors themselves aren't connected directly to the switch via RJ45 socket but instead via SPI protocol, or CAN protocol, so i guess S1 doesn't need a DT and S2-S3 need as sambuca mentioned no?
jonaspaulo,
please clearify: The switches you talk about, are these network switches, where you can multiple PCs, network devices to, or are they boxes, which connect on one side to the network, and on the other side to sensors and devices?
i.e. is it something like this:
1 - http://en.wikipedia.org/wiki/Network_switch
or something like this:
2 - http://www.globalcache.com/products/gc-100/models1/
as i said they are all three normal network switches (http://en.wikipedia.org/wiki/Network_switch) running openwrt , but the uses are different :) the first one acts as a normal network switch and it allows me to just connect the other two. This other two, S2 and S3 connect to the "main" one and have connected via SPI or CAN some sensors. thanks
Quote from: jonaspaulo on March 31, 2010, 01:09:21 PM
as i said they are all three normal network switches (http://en.wikipedia.org/wiki/Network_switch) running openwrt , but the uses are different :) the first one acts as a normal network switch and it allows me to just connect the other two. This other two, S2 and S3 connect to the "main" one and have connected via SPI or CAN some sensors. thanks
So what is the physical connection between the sensors and your S2 & S3 switches?
Quoteand have connected via SPI or CAN some sensors
through GPIO pins in the switches
Quote from: jonaspaulo on March 31, 2010, 10:56:56 PM
Quoteand have connected via SPI or CAN some sensors
through GPIO pins in the switches
ok...you might have mentioned that 'small' detail earlier ;-)
So you have extended or adapter openwrt in some way to allow the sensors data to be accessed or pushed out onto the LAN I assume...or does something have to poll a port on an IP address to get at the sensors data? Please explain this aspect...how does the various sensors data get transferred across the LAN?
Andrew
yes that is my doubt also. my job in the project is the part of integration with linuxmce, and the part of sensors is of other persons, and of course i need to know that. but since it is already in a open state, what would be the best approach to seamelessly integrate with linuxMCE?
Quote from: jonaspaulo on April 01, 2010, 12:25:18 AM
yes that is my doubt also. my job in the project is the part of integration with linuxmce, and the part of sensors is of other persons, and of course i need to know that. but since it is already in a open state, what would be the best approach to seamelessly integrate with linuxMCE?
Well you need to provide a technical description of how data from the sensors is accessed from the network side of the openwrt switch. By that I mean ignoring LinuxMCE how would the data the sensors collect be made available to the LAN. Does the switch allocate each sensor to a port number (my guess is that is probably does). The next question is does the switch have a protocol or API that allows remote LAN based devices to communicate with it? My assumption is again that it must... and it is that API/Protocol that must be built into a Device Template in LinuxMCE so that your S2/S3 switches can be auto-detected on the LAN when you plug them in and any sensors that are attached can be discovered - ie to make the switch PnP etc.
The concept of the switches + sensors sounds very exciting...but you need to make more of the LAN side API/Protocol publicly available otherwise no one here can really be of much help to you. How you implement the internal aspects of the switch and the sensors need not be discussed in any detail.
All the best
Andrew
hm i see, i will work on it and update this. since the sensors aren't ready yet and i have to continue my part of the project, i will simulate a sensor in some pc in the network for now. thanks a lot for the help
@totallymaxed some other questions, isn't there documentation about all the functions available to use or at least the most needed ones? Another thing , regarding the sensors how is handled the communication between them and LMCE? I mean i need to code the sensors to send their info periodically to the network in order to LMCE catch that info? Or do i implement some sort of polling algorithm or other method? thanks
Quote from: jonaspaulo on April 10, 2010, 03:50:07 PM
@totallymaxed some other questions, isn't there documentation about all the functions available to use or at least the most needed ones? Another thing , regarding the sensors how is handled the communication between them and LinuxMCE? I mean i need to code the sensors to send their info periodically to the network in order to LinuxMCE catch that info? Or do i implement some sort of polling algorithm or other method? thanks
As I said earlier in the thread if you can provide more information about the devices, what they need to communicate with etc etc then forum member can help you - without that information then its difficult for anyone to be very helpful.
There is plenty of documented code in the svn & examples in the wiki - look in both for examples of what you need.
All the best
Andrew