Commit 21b54ca4 authored by Claes Sjofors's avatar Claes Sjofors

Xtt camera control added

parent fda40c50
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_a_cameraposition.wb_load -- Defines the class CameraPosition.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Data for camera position
! Data for camera position.
!*/
Object CameraPosition $ClassDef 655
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr PopEditor = 1
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "CameraPosition"
EndBody
!/**
! Optional description.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Pan value.
! Range 0 - 100.
!*/
Object Pan $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Tilt value.
! Range 0 - 100.
!*/
Object Tilt $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Zoom value.
! Range 0 - 100.
!*/
Object Zoom $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
EndObject
EndObject
EndSObject
......@@ -93,7 +93,6 @@ SObject pwrb:Class
Object X $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags = 0
EndBody
EndObject
!/**
......@@ -102,7 +101,6 @@ SObject pwrb:Class
Object Y $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags = 0
EndBody
EndObject
!/**
......@@ -111,7 +109,6 @@ SObject pwrb:Class
Object Width $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags = 0
EndBody
EndObject
!/**
......@@ -120,7 +117,6 @@ SObject pwrb:Class
Object Height $Attribute 9
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags = 0
EndBody
EndObject
!/**
......@@ -132,10 +128,44 @@ SObject pwrb:Class
! - Iconify Open the graph iconified.
! - ControlPanel Show a control panel with progress bar, Play, Pause and Stop buttons.
!*/
Object Options $Attribute 15
Object Options $Attribute 10
Body SysBody
Attr TypeRef = "pwrb:Type-VideoOptionsMask"
Attr Flags = 0
EndBody
EndObject
!/**
! Protocol for camera control.
!*/
Object Control $Attribute 11
Body SysBody
Attr TypeRef = "pwrb:Type-CameraControlEnum"
EndBody
EndObject
!/**
! Width of stream in pixel.
!*/
Object StreamWidth $Attribute 12
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Height of stream in pixel.
!*/
Object StreamHeight $Attribute 13
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Camera preset positions.
!*/
Object PresetPosition $Attribute 14
Body SysBody
Attr TypeRef = "pwrb:Class-CameraPosition"
Attr Flags |= PWR_MASK_CLASS
Attr Flags |= PWR_MASK_ARRAY
Attr Elements = 10
EndBody
EndObject
EndObject
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_td_cameracontrolenum.wb_load -- Defines the enum type CameraControl
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Enumeration for yes/no.
!*/
Object CameraControlEnum $TypeDef 81
Body SysBody
Attr TypeRef = "pwrs:Type-$Enum"
Attr PgmName = "CameraControlEnum"
EndBody
!/**
! No communication.
!*/
Object No $Value
Body SysBody
Attr PgmName = "No"
Attr Text = "No"
Attr Value = 0
EndBody
EndObject
!/**
! Communication with ONVIF.
!*/
Object ONVIF $Value
Body SysBody
Attr PgmName = "ONVIF"
Attr Text = "ONVIF"
Attr Value = 1
EndBody
EndObject
!/**
! Communication with VAPIX.
!*/
Object VAPIX $Value
Body SysBody
Attr PgmName = "VAPIX"
Attr Text = "VAPIX"
Attr Value = 2
EndBody
EndObject
EndObject
EndSObject
......@@ -737,7 +737,7 @@ XttMultiViewGtk::XttMultiViewGtk( GtkWidget *mv_parent_wid, void *mv_parent_ctx,
strmctx[i*rows + j] = new XttStreamGtk( toplevel, this, "No title",
xttvideo.URL,
mv.Action[i*rows+j].Width, mv.Action[i*rows+j].Height,
0, 0, 0, options, 1, sts);
0, 0, 0, options, 1, &aref, sts);
strmctx[i*rows + j]->close_cb = multiview_strm_close_cb;
......@@ -1275,7 +1275,7 @@ int XttMultiViewGtk::set_subwindow_source( const char *name, char *source, char
XttStreamGtk *ctx = new XttStreamGtk( toplevel, this, "No title",
xttvideo.URL, w, h, 0, 0,
0, xttvideo.Options, 1, &lsts);
0, xttvideo.Options, 1, &object_aref, &lsts);
GtkWidget *comp_w = (GtkWidget *)ctx->get_widget();
......
This diff is collapsed.
......@@ -59,26 +59,38 @@ class XttStreamGtk : public XttStream {
pwr_tTime mb_press_time;
int mb_press_x;
int mb_press_y;
int scroll_x;
int scroll_y;
int scroll_direction;
int scroll_cnt;
int popupmenu_x;
int popupmenu_y;
GtkWidget *slider; /* Slider widget to keep track of current position */
GtkWidget *parent_wid;
GtkWidget *toplevel;
GtkWidget *video_form;
GtkWidget *main_box;
// CoWowFocusTimerGtk focustimer;
GtkWidget *ptz_box;
GtkWidget *ptz_pan;
GtkWidget *ptz_tilt;
GtkWidget *ptz_zoom;
void *overlay;
static int gst_initialized;
XttStreamGtk( GtkWidget *parent_wid, void *parent_ctx, const char *name, const char *uri,
int width, int height, int x, int y,
double scan_time, unsigned int options, int embedded, pwr_tStatus *sts);
double scan_time, unsigned int options, int embedded, pwr_tAttrRef *arp, pwr_tStatus *sts);
~XttStreamGtk();
void pop();
void set_size( int width, int height);
void *get_widget() { return main_box;}
void create_popup_menu( int x, int y);
static void scroll_cb( void *data);
static void refresh( void *data);
static void refresh_ui( XttStreamGtk *strm);
......@@ -97,6 +109,40 @@ class XttStreamGtk : public XttStream {
static void state_changed_cb( GstBus *bus, GstMessage *msg, void *data);
static void application_cb( GstBus *bus, GstMessage *msg, void *data);
static gboolean mousebutton_cb( GtkWidget *widget, GdkEvent *event, void *data);
static void menu_position_func( GtkMenu *menu, gint *x, gint *y, gboolean *push_in,
gpointer data);
static void activate_zoomreset( GtkWidget *w, gpointer data);
static void activate_zoomin( GtkWidget *w, gpointer data);
static void activate_zoomout( GtkWidget *w, gpointer data);
static void activate_scroll_left( GtkWidget *w, gpointer data);
static void activate_scroll_right( GtkWidget *w, gpointer data);
static void activate_page_left( GtkWidget *w, gpointer data);
static void activate_page_right( GtkWidget *w, gpointer data);
static void activate_scroll_down( GtkWidget *w, gpointer data);
static void activate_scroll_up( GtkWidget *w, gpointer data);
static void activate_page_down( GtkWidget *w, gpointer data);
static void activate_page_up( GtkWidget *w, gpointer data);
static void activate_preset_position1( GtkWidget *w, gpointer data);
static void activate_preset_position2( GtkWidget *w, gpointer data);
static void activate_preset_position3( GtkWidget *w, gpointer data);
static void activate_preset_position4( GtkWidget *w, gpointer data);
static void activate_preset_position5( GtkWidget *w, gpointer data);
static void activate_preset_position6( GtkWidget *w, gpointer data);
static void activate_preset_position7( GtkWidget *w, gpointer data);
static void activate_preset_position8( GtkWidget *w, gpointer data);
static void activate_preset_position9( GtkWidget *w, gpointer data);
static void activate_preset_position10( GtkWidget *w, gpointer data);
static void activate_preset_store_pos1( GtkWidget *w, gpointer data);
static void activate_preset_store_pos2( GtkWidget *w, gpointer data);
static void activate_preset_store_pos3( GtkWidget *w, gpointer data);
static void activate_preset_store_pos4( GtkWidget *w, gpointer data);
static void activate_preset_store_pos5( GtkWidget *w, gpointer data);
static void activate_preset_store_pos6( GtkWidget *w, gpointer data);
static void activate_preset_store_pos7( GtkWidget *w, gpointer data);
static void activate_preset_store_pos8( GtkWidget *w, gpointer data);
static void activate_preset_store_pos9( GtkWidget *w, gpointer data);
static void activate_preset_store_pos10( GtkWidget *w, gpointer data);
static void activate_get_position( GtkWidget *w, gpointer data);
};
......
......@@ -352,10 +352,10 @@ XttMultiView *XNavGtk::multiview_new( const char *name, pwr_tAttrRef *aref,
XttStream *XNavGtk::stream_new( const char *name, const char *uri,
int width, int height, int x, int y, double scan_time,
unsigned int options, int embedded, pwr_tStatus *sts)
unsigned int options, int embedded, pwr_tAttrRef *arp, pwr_tStatus *sts)
{
return new XttStreamGtk( parent_wid, this, name, uri, width, height, x, y,
scan_time, options, embedded, sts);
scan_time, options, embedded, arp, sts);
}
GeCurve *XNavGtk::gecurve_new( char *name, char *filename, GeCurveData *data,
......
......@@ -103,7 +103,7 @@ class XNavGtk : public XNav {
int (*is_authorized_cb) (void *, unsigned int));
XttStream *stream_new( const char *name, const char *uri,
int width, int height, int x, int y, double scan_time,
unsigned int options, int embedded, pwr_tStatus *sts);
unsigned int options, int embedded, pwr_tAttrRef *arp, pwr_tStatus *sts);
GeCurve *gecurve_new( char *name, char *filename, GeCurveData *data,
int pos_right, unsigned int options);
XttFileview *fileview_new( pwr_tOid oid, char *title, char *dir, char *pattern,
......
This diff is collapsed.
......@@ -44,6 +44,35 @@
class CoWow;
class CoWowTimer;
class XttCameraControl {
public:
pwr_tURL url;
XttCameraControl( char *x_url) {}
~XttCameraControl() {}
virtual void zoom_relative( double factor) {}
virtual void zoom_absolute( double factor) {}
virtual void pan_relative( double value) {}
virtual void pan_absolute( double value) {}
virtual void tilt_relative( double value) {}
virtual void tilt_absolute( double value) {}
virtual void pan_tilt_zoom_absolute( double pan, double tilt, double zoom) {}
virtual int get_position( double *pan, double *tilt, double *zoom) { return 0;}
};
class XttCameraControlVapix : public XttCameraControl {
public:
XttCameraControlVapix( char *x_url);
~XttCameraControlVapix() {}
void zoom_relative( double factor);
void zoom_absolute( double factor);
void pan_relative( double value);
void pan_absolute( double value);
void tilt_relative( double value);
void tilt_absolute( double value);
void pan_tilt_zoom_absolute( double pan, double tilt, double zoom);
int get_position( double *pan, double *tilt, double *zoom);
};
class XttStream {
public:
void *parent_ctx;
......@@ -51,28 +80,47 @@ class XttStream {
int embedded;
pwr_tURL uri;
CoWowTimer *timerid;
CoWowTimer *scroll_timerid;
CoWow *wow;
int scan_time;
int width;
int height;
void (*close_cb)( void *, XttStream *);
XttCameraControl *camera_control;
pwr_tAttrRef aref;
XttStream( void *st_parent_ctx, const char *name, const char *st_uri,
int st_width, int st_height, int x, int y,
double st_scan_time, unsigned int st_options, int st_embedded) :
parent_ctx(st_parent_ctx), options(st_options), embedded(st_embedded), timerid(0), width(st_width),
height(st_height), close_cb(0) {
double st_scan_time, unsigned int st_options, int st_embedded, pwr_tAttrRef *st_arp) :
parent_ctx(st_parent_ctx), options(st_options), embedded(st_embedded), timerid(0), scroll_timerid(0),
width(st_width), height(st_height), close_cb(0) {
strncpy( uri, st_uri, sizeof(uri));
if ( st_scan_time < 0.02)
scan_time = 1000;
else
scan_time = 1000 * st_scan_time;
camera_control = new XttCameraControlVapix(uri);
if ( st_arp)
aref = *st_arp;
else
memset( &aref, 0, sizeof(aref));
}
virtual ~XttStream() {
delete camera_control;
}
virtual ~XttStream() {}
void action_click( int x, int y);
void action_mb2click( int x, int y);
void action_mb3click( int x, int y);
void action_areaselect( int x, int y, int w, int h);
void action_scroll( int direction, int x, int y, int cnt);
void activate_preset_position( int idx);
void activate_preset_store_pos( int idx);
virtual void pop() {}
virtual void set_size( int width, int height) {}
virtual void *get_widget() { return 0;}
virtual void create_popup_menu( int x, int y) {}
};
#endif
......
......@@ -385,7 +385,7 @@ class XNav {
int (*is_authorized_cb) (void *, unsigned int)) {return 0;}
virtual XttStream *stream_new( const char *name, const char *uri,
int width, int height, int x, int y, double scan_time,
unsigned int options, int embedded, pwr_tStatus *sts) {return 0;}
unsigned int options, int embedded, pwr_tAttrRef *arp, pwr_tStatus *sts) {return 0;}
virtual GeCurve *gecurve_new( char *name, char *filename, GeCurveData *data,
int pos_right, unsigned int options) {return 0;}
virtual XttFileview *fileview_new( pwr_tOid oid, char *title, char *dir, char *pattern,
......
......@@ -3581,7 +3581,7 @@ static int xnav_open_func( void *client_data,
strmctx->pop();
}
else {
strmctx = xnav->stream_new( name_str, url_str, width, height, x, y, 0, options, 0, &sts);
strmctx = xnav->stream_new( name_str, url_str, width, height, x, y, 0, options, 0, &aref, &sts);
if ( EVEN(sts)) {
xnav->message(' ', XNav::get_message(sts));
return sts;
......@@ -3660,7 +3660,7 @@ static int xnav_open_func( void *client_data,
strmctx->pop();
}
else {
strmctx = xnav->stream_new( name_str, url_str, width, height, x, y, 0, options, 0, &sts);
strmctx = xnav->stream_new( name_str, url_str, width, height, x, y, 0, options, 0, 0, &sts);
if ( EVEN(sts)) {
xnav->message(' ', XNav::get_message(sts));
return sts;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment