News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ClaudioLNX

#1
Users / Re: Generic IP Device - Configure
November 12, 2011, 09:03:22 AM
I'm very sorry...thom.....but i dont find the ip variable in IP Camera template.
Perhaps i don't use conn object? is a problem?

IP Camera Template Code
conn_.Reconnect()
auth_s=device_.devdata_[114]+":"+device_.devdata_[115]
auth_a=Array.new;
auth_s.each{|c| auth_a.push(c)}

fix_path=device_.devdata_[2];
fix_path='/'+fix_path if(fix_path[0]!='/'[0]);

s = "GET "+fix_path+" HTTP/1.0\r\n"
s+= "Accept: */*\r\n"
s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
s+= "\r\n"

conn_.Send(s)

My Code

require'net/http'
fix_path=device_.devdata_[2];
fix_path='/'+fix_path if(fix_path[0]!='/'[0]);
h=Net::HTTP.new('192.168.1.201',80)
resp,data=h.get(fix_path+absolute_channel.to_s,nil)


Claudio
#2
Users / Re: Generic IP Device - Configure
November 10, 2011, 08:56:50 PM
ok...... look my code......if you have other problem...say me .. i
But because Joakim said: "perhaps this discussion should be in the Developer's forum and not in the Users." ....  ;D ....perhaps we have to open a new topic in Developers!!


require'net/http'
fix_path=device_.devdata_[2];
fix_path='/'+fix_path if(fix_path[0]!='/'[0]);
h=Net::HTTP.new('192.168.1.201',80)
resp,data=h.get(fix_path+absolute_channel.to_s,nil)

absolute_channel is an input parameter.
fix_path is a device_data "path"

Claudio

PS:last problem (for me) is a IP: i have hardcode the ip ....
#3
Users / Re: Generic IP Device - Configure
November 10, 2011, 03:59:49 PM
I'm very happy... if i can help u....
but now I do not have access to the code. Tonight I'll copy the code here and I'll explain how to do

Claudio
#4
Users / Re: Generic IP Device - Configure
November 06, 2011, 12:04:23 PM
OK....done... perfect! (the error was because i hadn't restart router)

but if i want know the device data IP in ruby code?
Other data have a number (example #2 for path) .. IP data  no!!! I wish  not replicate IP in other data field.

How i have to do? where i can find the all property of device object?


PS: sorry.....I hope that my behavior is correct, otherwise I apologize

#5
Users / Re: Generic IP Device - Configure
November 05, 2011, 04:01:51 PM
thanks.....i have turn on my first light!!!!!  ;D
but i hardcode :-[ the path and ip.....infact

.. when i use variable path (device_.devdata_[2];) i have the path with ip address.
example
in config: path is only "/forms.htm"
in log if i print variable: path is "192.168.1.201/forms.htm"

i need two  different value: ipaddress and path!
with path i can use a my new data, but with ip? how can i have he value of ip?

thanks again!!!
#6
Users / Re: Generic IP Device - Configure
November 01, 2011, 12:56:41 PM
Thanks......i'll try ....

Claudio
#7
Users / Generic IP Device - Configure
October 31, 2011, 12:31:47 PM
Sorry for my question ( i'm newbie) and for my English (i'm italian) ...:) ...

I have a simple switch over ethernet that i use for different utilities( light, radio, etc) .... I can switch on or off on browser with command
192.168.1.201/forms.htm?led1=1 ----> turn on
192.168.1.201/forms.htm?led1=0 ----> turn off

how can I create a device that implements this switch? i have to write code or i can use any template?

Thanks a lot
Claudio