Author Topic: Generic IP Device - Configure  (Read 9855 times)

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Generic IP Device - Configure
« Reply #15 on: November 11, 2011, 12:42:32 am »
the ip address is available as a variable. Please look at the Panasonic IP Camera template.

-Thom

ClaudioLNX

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Generic IP Device - Configure
« Reply #16 on: 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
Code: [Select]
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
Code: [Select]
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

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Generic IP Device - Configure
« Reply #17 on: November 13, 2011, 01:51:38 am »
you're making this too hard, bro.

way too hard.

seriously, stop. before I smack you.

if you use conn_. guess what?

all of those details are set up for you, you just need to send and receive data down that pipe appropriately.

*thwap-you-upside-the-head* ;)

-Thom