BUG - bug that can cause you to be robbed

Forum for questions and support relating to the 1.25.x releases only.
Locked
usersenior
Posts: 24
Joined: Tue Jul 10, 2012 8:34 pm

BUG - bug that can cause you to be robbed

Post by usersenior »

Dear

first sorry my english more the subject itself is more important than that

I posted a while back how to make a default image when the zm lost the video signal, it had me paying attention to it, the more it is a bug see:

a burglar enters your home and simplemeste disconnects the cable from your camera without getting in front of it if you are looking at the monitors firefox for example the image of the camera will freeze and you may think it's all ok when in fact is not.

good, I'm looking ZM codes and found where it detects the signal was lost in the file zm_monitor.cpp

Code: Select all

if ( (TV_2_FLOAT( now ) - last_frame_sent) > max_secs_since_last_sent_frame )
        {
            INSERT CODE HERE
            Error( "Terminating, last frame sent time %f secs more than maximum of %f", TV_2_FLOAT( now ) - last_frame_sent, max_secs_since_last_sent_frame );
            break;
        }
the problem is that I set a code to send a picture when it did, most do not know as much about c + +'m struggling to implement this, the below code that could mount:

Code: Select all

int length;
                  char * buffer;

                  ifstream is;
                  is.open ("config.png", ios::binary );

                  //printf("Content-Type: Content-type: image/jpeg\n\n");
                  // get length of file:
                  is.seekg (0, ios::end);
                  length = is.tellg();
                  is.seekg (0, ios::beg);

                  // allocate memory:
                  buffer = new char [length];

                  // read data as a block:
                  is.read (buffer,length);
                  is.close();

                  cout.write (buffer,length);

                  delete[] buffer;

if you run it as a CGI on apache it displays the image later add more if the code zm_monitor he send the picture when the signal is lost over the firefox does not understand it as an image, because should be the standard of bytes sent this different or something.

Can we fix this?
Christo
Posts: 89
Joined: Wed Feb 01, 2012 9:48 pm

Re: BUG - bug that can cause you to be robbed

Post by Christo »

usersenior wrote:Dear

first sorry my english more the subject itself is more important than that

I posted a while back how to make a default image when the zm lost the video signal, it had me paying attention to it, the more it is a bug see:

a burglar enters your home and simplemeste disconnects the cable from your camera without getting in front of it if you are looking at the monitors firefox for example the image of the camera will freeze and you may think it's all ok when in fact is not.

good, I'm looking ZM codes and found where it detects the signal was lost in the file zm_monitor.cpp

Code: Select all

if ( (TV_2_FLOAT( now ) - last_frame_sent) > max_secs_since_last_sent_frame )
        {
            INSERT CODE HERE
            Error( "Terminating, last frame sent time %f secs more than maximum of %f", TV_2_FLOAT( now ) - last_frame_sent, max_secs_since_last_sent_frame );
            break;
        }
the problem is that I set a code to send a picture when it did, most do not know as much about c + +'m struggling to implement this, the below code that could mount:

Code: Select all

int length;
                  char * buffer;

                  ifstream is;
                  is.open ("config.png", ios::binary );

                  //printf("Content-Type: Content-type: image/jpeg\n\n");
                  // get length of file:
                  is.seekg (0, ios::end);
                  length = is.tellg();
                  is.seekg (0, ios::beg);

                  // allocate memory:
                  buffer = new char [length];

                  // read data as a block:
                  is.read (buffer,length);
                  is.close();

                  cout.write (buffer,length);

                  delete[] buffer;

if you run it as a CGI on apache it displays the image later add more if the code zm_monitor he send the picture when the signal is lost over the firefox does not understand it as an image, because should be the standard of bytes sent this different or something.

Can we fix this?
Hello,

I have fixed this with a workaround using the Imagemagick package.

It detects Signal loss, broken wiring and low infrared..

Kind regards, Christo
usersenior
Posts: 24
Joined: Tue Jul 10, 2012 8:34 pm

Re: BUG - bug that can cause you to be robbed

Post by usersenior »

as you did for the Imagemagick act this way?
Christo
Posts: 89
Joined: Wed Feb 01, 2012 9:48 pm

Re: BUG - bug that can cause you to be robbed

Post by Christo »

usersenior wrote:as you did for the Imagemagick act this way?

Hello senior,

Youll have to grab a frame of each monitor and run this through a commandfilter to know the status.
(zmu -m 1 -U "user" -P "password" -i) or
( wget -O /var/www/images/dynamic.jpg "http://xxx.x.xxx.xxx:xx/cgi-bin/nph-zms?mode=single&monitor=9&scale=50&user=xxxx&pass=yyyyy" )

The basic command for the analysis of a videoframe is "identify -format %k"

depending on the returned color value..you know the status.
for instance is the value is 1... you know that the monitor is offline or shutdown.
a BlueMute frame depending on framesize returns a value of 300-330 colors..
if the returned color value is below 300 (and greater than 1) there isn't enough light to detect anything (IR defect)


This program runs on cron and does it's job just fine.
it's implemented with an Email feature that warns if anything changes!

Success and regards, Christo
Locked