How can get TCP data on CF

116 views
Skip to first unread message

Alexander S Argollo

unread,
May 15, 2013, 7:18:36 AM5/15/13
to comman...@googlegroups.com
Hi Guys I working to make a controller via Iviewer and I didn't know how can I get TCP data to procedure a commad feedback. I have done the command and I need to trigger the command response. I used Barry's relay module as reference. Below they can see the part of code and TCP datq log (wireshark). I didn't know a CF command and JS code that I can get TCP data.

Somebody can help me, i used as reference your Devantech_Relays Sw to start my sw design (Zigbee Gateway Module),its based on client to server (D-bus)

Could you advise me each CF Command API or Javascript procedure that i can use to fix it?

You can see the part of the code command (Function) below (Send to Server done and working):

sendToZBPServer_GetFWVersion: function() { // envio dos comandos para o Gateway
// Comando na interface do iviewer ZB.actions();
if(ZB.trace) CF.log("\nRL.actions: function started"); // incia o log
if (ZB.system == "Zigbee_Gateway") {
// GetFWVersion command
var ZB_OBJ ="<Object>ZBP_Node</Object>\x0D\x0A";
var ZB_FUN ="<methodName>Node_GetNumNodes</methodName>\x0D\x0A";
CF.send(ZB.system,"<zbpPacket>\x0D\x0A" +ZB_OBJ +ZB_FUN +"<id>16000</id>\x0D\x0A"+"</zbpPacket>\x0D\x0A");
};
}

I need to capture the responses,specially the String "f212" from server to client, that you can see below:

<Object>ZBP_Node</Object>
<methodName>Node_GetNumNodes</methodName>
<id>31336</id>
</zbpPacket>.<zbpPacketResponse><Object>ZBP_Node</Object><methodName>Node_GetNumNodes</methodName><Arguments><Argument type="ushort">1</Argument><Argument type="QVector&lt;ushort&gt;" length="1">[f212]</Argument></Arguments><id>31336</id><session>bcfd18e6-74e7-41ac-982e-8311adece220</session></zbpPacketResponse>

Somebody can help, each CF command i need to use?

Thanks a lot

Barry Gordon

unread,
May 15, 2013, 8:45:23 AM5/15/13
to comman...@googlegroups.com
This is a general message to the community:

I am more than willing to assist any individual in any way I can with their
CF projects. However my expertise (what there is of it) lies in using
iViewer with Javascript. I know very little about the operations of iViewer
as related to basic operations, especially feedback parsing without using
Javascript.

In my work I generally use CF.send() to get things to an external system,
building the message body in Javascript. I use CF.request() if the external
system is a well understood/trusted (by me) http server. On the return side
I just have iViewer present the feedback strings it receives from an
external control system to a Javascript function where I then parse it
myself and isolate what I need. I find this much easier as the paradigm for
doing the parsing is basically the same for all external systems I have come
across. Doing it this way keeps me in my comfort zone. I know nothing about
Crestron systems, having never owned one or used one.

Things I post on my web site are there for the viewing and downloading, BUT
they assume you have a reasonable working knowledge of Javascript and its
use with iViewer.

I do have the advantage that I was a professional IT person (started as a
programmer and ended up as the Director of IT operations worldwide for a
fortune 100 company) and I am a code bum at heart.

About five years ago I started playing with the Philips Pronto PRO which was
a Javascript based remote. When I started I had never programmed in
Javascript so I had the double learning curve of the Pronto PRO and
Javascript. I did have the advantage of being a programmer and learning
another language was not that difficult for me as I had to do it many times.
I now have a large library of code snippets in Javascript that I can use in
my various projects. I still play around with the Pronto PRO as I like a
hard button remote for controlling my theater and for guests.

If you are serious about building Home Automation and/or Home Theater
systems the best advice I can give you is to learn how to program. The basic
principles of programming apply to all languages. Javascript is just one of
many and is an excellent language. It is modern, well documented with plenty
of resources online and in books. If you have never programmed (and I mean
writing code in a recognized programming language) get a book on basic
programming ideally using Pascal as the language. Pascal was designed to
teach programming. You can just start with Javascript but is easier of you
first understand programming concepts.
--
You received this message because you are subscribed to the Google Groups
"CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Nahshon Williams

unread,
May 15, 2013, 9:02:39 AM5/15/13
to comman...@googlegroups.com
Barry I would subscribe to your youtube channel and even pay a fee.
Yes there are many "how tos" out there, but I get the impression your
matured flavour of programming and obvious inclination to home
automation would make for fascinating and educating viewing for all.

As your site is already a treasure trove of information I think some
videos explaining in detail what your thinking is and why you feel
certain best practices need to be adopted would be invaluable to the
community.

If you did a video a week, I would watch that over Arrow or glee ;-) and
you could probably have one project that you build on with time.

New comers can go and watch from scratch and still be involved when they
catch up.

Just a thought, as your passion and pain come through in these emails.
You cannot seem to fathom why people do not take the time to learn
something that will have such a huge impact in their work and by
extension lives.


One name for the channel could be "CF JS with the BeeGee" :-)
Any way I hope you understand what I mean

Nahshon



A CF Java script with the Bee Gee will

Barry Gordon

unread,
May 15, 2013, 11:07:02 AM5/15/13
to comman...@googlegroups.com
Thank you for the flattering comments. Unfortunately videography is not one
of my forte's. I never could get interested in either Photography or video
making. Strange perhaps, since members of my family are into the
photographic and cinema worlds. I am not a subscriber to Facebook (I have a
page but rarely go there), and do not use twitter. Heck, I very rarely
text.

I think it is a generational thing. My generation was a little more into
privacy where the current generation appears to be very much into public
sharing.

I obviously do eMail and drop in at several of the forums that share my
interests.

Maybe someday I will do the video thing, but I really am a movie watcher not
a maker.

Thanks again

Alexander S Argollo

unread,
May 15, 2013, 8:51:37 PM5/15/13
to comman...@googlegroups.com
Hi Barry, the message was that you wrote to me?

I just wrote that i used your reference because i get a JS that you genty shared with me the Devantech Relay Module.

BR
Alex

Alexander S Argollo

unread,
May 15, 2013, 9:10:29 PM5/15/13
to comman...@googlegroups.com
Hi Guys, i working with this projete (JS) to build a connection on Zigbee Gateway (Harmony Geteway), using Iviewer, from a Smartenit co (http://www.simplehomenet.com/).

I have constructed a JS to send a command, acording Smartenit API,  (based on CF.send) and i have a difcult to built a procedure how to get the feedeback, the Harmony Gateways working on a D-Bus (client x server) and for each command (D-BUS API) exist a specific response. As i tried to explain early i need to get it on a TCP data. I know that CF.Send was made to send a TCP data (any data) but i sinserely didnt know how can i procedure to get this information on TCP data.

Any body can help about it?

Thanks a lot
Alex

Jarrod Bell

unread,
May 15, 2013, 9:27:56 PM5/15/13
to comman...@googlegroups.com
You need to first create a feedback item in your system properties, then use JavaScript to watch for the event of incoming data.
Use a single dot as the regex: .

Then listen to the CF.FeedbackMatchedEvent by name, as per the instructions in the API docs:
http://www.commandfusion.com/docs/scripting/net.html#cF.FeedbackMatchedEvent

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--

Alexander S Argollo

unread,
May 15, 2013, 10:00:12 PM5/15/13
to comman...@googlegroups.com, jar...@commandfusion.com
Jarrod, thanks a lot for your quickly reply. I'll study more about regex and feeedback procedure.

Sorry for my dificult to understanding about CF, i was made a lot of question. I'll improve my CF knowledge soon.

BR
Alex

Terence

unread,
May 15, 2013, 10:35:56 PM5/15/13
to comman...@googlegroups.com, jar...@commandfusion.com
We have many examples of how feedback, regex and CF.FeedbackMatchedEvent is being used - just drop by our github resource page at https://github.com/CommandFusion and download some of the modules there for your study. All the best!
Reply all
Reply to author
Forward
0 new messages