Page 1 of 2

how to create a filter for send a mail if the signal is loss

Posted: Mon Nov 12, 2007 12:03 pm
by alcool
hi,

I would like create a zm filter for signaling the state down of a camera.
For example, after the theft of a camera.
I have see the options ZM_SIGNAL_CHECK_POINTS and ZM_SIGNAL_CHECK_COLOUR, but I don't know how to for setting the filter.

Some help?
THX

bye

Posted: Mon Nov 12, 2007 3:32 pm
by achix
Have you managed to get "Signal" events?
(Along with "Alarm" events).

(Has anybody done it?)

If you get Signal events, then you treat them just like Alarm events
to build your filters, etc...

Posted: Mon Nov 12, 2007 4:56 pm
by alcool
Detaching a camera do not causes events...
In option->configuration I have chacked
ZM_SIGNAL_CHECK_POINTS
and I have set
ZM_SIGNAL_CHECK_COLOUR at 000000 (the color that I see when the camera is detached)
But the counter of the events remains at 0

how i can do?

help please

Posted: Tue Nov 13, 2007 2:02 pm
by achix
If your cameras are local, then by the docs, some "Signal" events
should be generated.
If not, then i guess this is either a bug or a poorly documented feature.

Posted: Tue Nov 13, 2007 3:16 pm
by zoneminder
Are you using normal analog video cameras? You have set the signal lost colour to black, is that what you see when you disconnect the camera?

Finally, what mode are your cameras running in?

Posted: Wed Nov 14, 2007 10:03 am
by achix
To be honest i never got a Signal event myself,
although 90% of the time my cameras are not connected
and i get the classic blue "signal lost" image.

Posted: Wed Nov 14, 2007 10:19 am
by zoneminder
Is it exactly the same blue? Have you checked with a colour picker as maybe it's just a bit different perhaps.

Otherwise I may have to put some extra debug in to see what's happening.

Posted: Wed Nov 14, 2007 10:20 am
by cordel
Have you set ZM_SIGNAL_CHECK_COLOUR for blue?
You'll have to capture a blue image from you card and open it in something like GIMP to find the correct color code.

Posted: Wed Nov 14, 2007 11:03 am
by achix
i'll try & check tonight.

Posted: Wed Nov 14, 2007 12:06 pm
by achix
Checking with a ZM installation we have here at work
(v 1.22.1), i set ZM_SIGNAL_CHECK_COLOUR to 000000,
or FFFFFF (it didnt make any difference)
yet for the unconnected cameras i got a blue screen,
whose color was (as per Gimp color Picker) : 0000C0,
and no Signal events.

Posted: Wed Nov 14, 2007 10:19 pm
by zoneminder
If possible I would recommend trying with 1.22.3 as 1.22.1 was a while ago. I will see if I can see any fixes in that area that might have occured between versions though.

Posted: Thu Nov 15, 2007 8:19 am
by achix
I had totally misunderstood the purpose of ZM_SIGNAL_CHECK_COLOUR. :(
However i think the problem is there.

We have a 1.22.1 linux system with LMLBT44 at work and i have a 1.22.3 FreeBSD with LMLBT4M system at home.

At work i checked with Gimp and the color picker for non connected cameras gave RGB 0,0,192 (0x0000C0).

At home this morning i checked with PhotoShop and it also gave 0,0,192.
I put this 0000C0 value to set ZM_SIGNAL_CHECK_COLOUR,
restared ZM and the problem was there, i could not get any Signal events, at any camera function, be it Monitor, Modect.

In the help of ZM_SIGNAL_CHECK_COLOUR it writes about the color:
The default, which is a shade of blue, is most common but other systems may differ.
When we say system what do we mean? driver? card?

Posted: Thu Nov 15, 2007 3:47 pm
by achix
Also how often is it checked?

Posted: Thu Nov 15, 2007 9:04 pm
by achix
I think i got it :D, in

Code: Select all

bool Monitor::CheckSignal( const Image *image )
the computation of the random index was as follows:

Code: Select all

int index = (rand()*pixels)/RAND_MAX;
which at least for my 32bit FreeBSD always returned 0,
since no matter what any int most probably is less than RAND_MAX=(2^31)-1.
Apart from this, for some reason i dont know, the pixel at 0 position of the buffer
always had RGB=000000, which was different than 0000C0=ZM_SIGNAL_CHECK_COLOUR, but anyway index should be random.
I changed the index computation as follows:

Code: Select all

    float foo = ((float) rand()) / ((float) RAND_MAX);
    int index = pixels/3 + (int)((float) pixels * foo / 3.0f);
so index lies between pixels/3 and 2*pixels/3.
(i thought there was some noise at positions near 0, hence this hack).

Now when camera Function is other than monitor, i get Signal events!

All the above are for FreeBSD, but given the semantics are the same
(rand conforming to ISO/IEC 9899:1990), i dont see any reason why the above situation would not hold in 32bit Linuxes too.

Posted: Fri Nov 16, 2007 10:30 am
by achix
May i add a speculation here?
Was the development done in a 64 bit machine?

Also, i'd like to hear if anybody had success with Signal lost in any 32 bit machine.