Commit 74f05bbb authored by Claes's avatar Claes

Support for Hilscher cifX Profinet Controller added

parent 5bc8a36a
/*
* Proview $Id$
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef rt_io_hilscher_cifx_h
#define rt_io_hilscher_cifx_h
typedef struct {
unsigned long channel;
......@@ -9,6 +29,7 @@ typedef struct {
unsigned int dev_init;
unsigned int dev_init_cnt;
unsigned int dev_init_limit;
int softlimit_logged;
int input_area_size;
int output_area_size;
void *input_area;
......@@ -20,3 +41,20 @@ typedef struct {
int float_representation;
} io_sLocalHilscher_cifX_Device;
typedef struct {
unsigned long channel;
unsigned long board;
CIFXHANDLE chan;
unsigned int diag_cnt;
unsigned int diag_interval;
unsigned int dev_init;
unsigned int dev_init_cnt;
unsigned int dev_init_limit;
int softlimit_logged;
int input_area_size;
int output_area_size;
void *input_area;
void *output_area;
} io_sLocalHilscher_cifX_PnController;
#endif
......@@ -322,8 +322,10 @@ static pwr_tStatus IoAgentRead( io_tCtx ctx, io_sAgent *ap)
op->ErrorCount++;
}
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit && !local->softlimit_logged) {
errh_Error( "IO Error soft limit reached on agent '%s'", ap->Name);
local->softlimit_logged = 1;
}
if ( op->ErrorCount >= op->ErrorHardLimit) {
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
......@@ -360,8 +362,10 @@ static pwr_tStatus IoAgentWrite( io_tCtx ctx, io_sAgent *ap)
xDriverGetErrorDescription( sts, op->ErrorStr, sizeof(op->ErrorStr));
}
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit && !local->softlimit_logged) {
errh_Error( "IO Error soft limit reached on agent '%s'", ap->Name);
local->softlimit_logged = 1;
}
if ( op->ErrorCount >= op->ErrorHardLimit) {
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
......
......@@ -12,6 +12,7 @@ GPIO_Module
Maxim_DS18B20
USB_Agent
Velleman_K8055_Board
Hilscher_cifX_PnController
Hilscher_cifX_Master
Hilscher_cifX_Module
USB_Joystick
......
Volume OtherIO $ClassVolume 0.0.250.10
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X233"
Attr NextCix = "_X24"
Attr NextOix = "_X242"
Attr NextCix = "_X25"
Attr NextTix[0] = "_X10"
EndBody
Object Type $TypeHier 1 15-NOV-2007 14:35:37.90
......@@ -2904,6 +2904,176 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndBody
EndObject
EndObject
Object Hilscher_cifX_PnController $ClassDef 24 23-MAY-2011 11:01:53.65
Body SysBody 23-MAY-2011 11:01:37.07
Attr Editor = 0
Attr Method = 0
Attr Flags = 38992
EndBody
Object RtBody $ObjBodyDef 1 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:02:08.50
Attr StructName = "Hilscher_cifX_PnController"
Attr NextAix = "_X31"
EndBody
Object Description $Attribute 14 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "Description"
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object Specification $Attribute 15 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "Specification"
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object DataSheet $Attribute 16 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "DataSheet"
Attr TypeRef = "pwrs:Type-$URL"
EndBody
EndObject
Object IP_Address $Attribute 27 24-MAY-2011 08:21:37.53
Body SysBody 24-MAY-2011 08:21:12.63
Attr PgmName = "IP_Address"
Attr TypeRef = "pwrs:Type-$String32"
EndBody
EndObject
Object SubnetMask $Attribute 28 24-MAY-2011 08:21:57.03
Body SysBody 24-MAY-2011 08:23:57.17
Attr PgmName = "SubnetMask"
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
Object DeviceName $Attribute 29 24-MAY-2011 08:22:20.62
Body SysBody 24-MAY-2011 08:24:00.64
Attr PgmName = "DeviceName"
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
Object DeviceType $Attribute 30 24-MAY-2011 08:22:25.89
Body SysBody 24-MAY-2011 08:24:03.36
Attr PgmName = "DeviceType"
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
Object Alias $Attribute 17 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "Alias"
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
Object Channel $Attribute 18 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "Channel"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object Status $Attribute 19 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "Status"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object Process $Attribute 20 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "Process"
Attr TypeRef = "pwrb:Type-IoProcessMask"
EndBody
EndObject
Object ThreadObject $Attribute 21 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "ThreadObject"
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
Object ErrorCount $Attribute 22 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "ErrorCount"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object ErrorStr $Attribute 23 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "ErrorStr"
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object ErrorSoftLimit $Attribute 24 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "ErrorSoftLimit"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object ErrorHardLimit $Attribute 25 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "ErrorHardLimit"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object Diag $Attribute 26 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr PgmName = "Diag"
Attr Flags = 131072
Attr TypeRef = "OtherIO:Class-Hilscher_cifX_Diag"
EndBody
EndObject
EndObject
Object IoMethods $RtMethod 234 23-MAY-2011 11:01:37.07
Object IoAgentInit $Method 235 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:02:25.93
Attr MethodName = "Hilscher_cifX_PnController-IoAgentInit"
EndBody
EndObject
Object IoAgentClose $Method 236 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:02:36.54
Attr MethodName = "Hilscher_cifX_PnController-IoAgentClose"
EndBody
EndObject
Object IoAgentRead $Method 237 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:02:43.74
Attr MethodName = "Hilscher_cifX_PnController-IoAgentRead"
EndBody
EndObject
Object IoAgentWrite $Method 238 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:02:50.73
Attr MethodName = "Hilscher_cifX_PnController-IoAgentWrite"
EndBody
EndObject
EndObject
Object ConfiguratorPoson $Menu 239 23-MAY-2011 11:01:37.07
Object Pointed $Menu 240 23-MAY-2011 11:01:37.07
Object Connect $MenuButton 241 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr ButtonName = "Connect PlcThread"
Attr MethodName = "$Objid-Connect"
Attr MethodArguments[0] = "ThreadObject"
Attr MethodArguments[1] = "PlcThread"
Attr FilterName = "$Objid-IsOkConnect"
Attr FilterArguments[0] = "ThreadObject"
Attr FilterArguments[1] = "PlcThread"
EndBody
EndObject
EndObject
EndObject
Object PostCreate $DbCallBack 242 23-MAY-2011 11:01:37.07
Body SysBody 23-MAY-2011 11:01:37.07
Attr MethodName = "BaseIORack-PostCreate"
EndBody
EndObject
Object Template Hilscher_cifX_PnController 2154004480 01-JAN-1970 01:00:00.00
Body RtBody 24-MAY-2011 08:26:34.69
Attr IP_Address = "10.0.0.1"
Attr SubnetMask = "255.255.255.0"
Attr DeviceName = "controller"
Attr DeviceType = "cifX RE/PNM"
Attr Process = 1
Attr ErrorSoftLimit = 25
Attr ErrorHardLimit = 50
EndBody
EndObject
EndObject
Object Hilscher_cifX_Master $ClassDef 17 23-FEB-2011 15:22:46.32
Body SysBody 23-FEB-2011 14:03:13.10
Attr Editor = 0
......
......@@ -44,6 +44,7 @@
#include "rt_pnak.h"
#include "co_dcli.h"
#include "rt_pn_gsdml_data.h"
#include "rt_io_pnak_locals.h"
#include "rt_io_pn_locals.h"
#include "rt_pn_iface.h"
......@@ -86,7 +87,7 @@ static pwr_tStatus IoAgentInit (
pwr_sClass_PnControllerSoftingPNAK *op;
pwr_tUInt16 sts;
io_sAgentLocal *local;
io_sRackLocal *r_local;
io_sPnRackLocal *r_local;
char fname[196];
char hname[40];
......@@ -281,8 +282,8 @@ static pwr_tStatus IoAgentInit (
for (slave_list = ap->racklist, ii = 0; slave_list != NULL;
slave_list = slave_list->next, ii++) {
slave_list->Local = (unsigned char *) calloc(1, sizeof(io_sRackLocal));
r_local = (io_sRackLocal *) slave_list->Local;
slave_list->Local = (unsigned char *) calloc(1, sizeof(io_sPnRackLocal));
r_local = (io_sPnRackLocal *) slave_list->Local;
for (jj = 0; jj < local->device_data[ii + 1]->iocr_data.size(); jj++) {
......
......@@ -36,10 +36,11 @@
#include "rt_errh.h"
#include "rt_pb_msg.h"
#include "rt_profinet.h"
#include "rt_pnak.h"
//#include "rt_profinet.h"
//#include "rt_pnak.h"
#include "co_dcli.h"
#include "rt_pn_gsdml_data.h"
//#include "rt_io_pnak_locals.h"
#include "rt_io_pn_locals.h"
......@@ -53,7 +54,7 @@ static pwr_tStatus IoRackInit (
io_sRack *rp
)
{
io_sCardLocal *local_card;
io_sPnCardLocal *local_card;
io_sCard *cardp;
short input_counter;
short output_counter;
......@@ -89,10 +90,10 @@ static pwr_tStatus IoRackInit (
latent_output_count = 0;
while(cardp) {
local_card = (io_sCardLocal *) calloc(1, sizeof(*local_card));
local_card = (io_sPnCardLocal *) calloc(1, sizeof(*local_card));
cardp->Local = local_card;
local_card->input_area = ((io_sRackLocal *)(rp->Local))->inputs;
local_card->output_area = ((io_sRackLocal *)(rp->Local))->outputs;
local_card->input_area = ((io_sPnRackLocal *)(rp->Local))->inputs;
local_card->output_area = ((io_sPnRackLocal *)(rp->Local))->outputs;
/* From v4.1.3 we can have subclasses, find the super class */
......@@ -230,11 +231,9 @@ static pwr_tStatus IoRackRead (
io_sRack *rp
)
{
pwr_sClass_PnControllerSoftingPNAK *mp;
pwr_sClass_PnDevice *sp;
sp = (pwr_sClass_PnDevice *) rp->op;
mp = (pwr_sClass_PnControllerSoftingPNAK *) ap->op;
/* The reading of the process image is now performed at the agent level,
this eliminates the need for board specific code at the rack level. */
......@@ -247,7 +246,7 @@ static pwr_tStatus IoRackRead (
}
if (sp->ErrorCount > sp->ErrorSoftLimit ) {
memset(((io_sRackLocal *)(rp->Local))->inputs, 0, ((io_sRackLocal *)(rp->Local))->bytes_of_input);
memset(((io_sPnRackLocal *)(rp->Local))->inputs, 0, ((io_sPnRackLocal *)(rp->Local))->bytes_of_input);
}
// if (sp->ErrorCount > sp->ErrorHardLimit && sp->StallAction >= pwr_ePbStallAction_EmergencyBreak) {
......@@ -267,11 +266,9 @@ static pwr_tStatus IoRackWrite (
io_sRack *rp
)
{
pwr_sClass_PnControllerSoftingPNAK *mp;
pwr_sClass_PnDevice *sp;
sp = (pwr_sClass_PnDevice *) rp->op;
mp = (pwr_sClass_PnControllerSoftingPNAK *) ap->op;
/* The writing of the process image is now performed at the agent level,
this eliminates the need for board specific code at the rack level. */
......
......@@ -52,11 +52,11 @@ static pwr_tStatus IoCardInit (
io_sCard *cp
)
{
io_sCardLocal *local;
io_sPnCardLocal *local;
pwr_sClass_PnModule *op;
op = (pwr_sClass_PnModule *) cp->op;
local = (io_sCardLocal *) cp->Local;
local = (io_sPnCardLocal *) cp->Local;
op->Status = PB__NORMAL;
......@@ -74,12 +74,12 @@ static pwr_tStatus IoCardRead (
io_sCard *cp
)
{
io_sCardLocal *local;
io_sPnCardLocal *local;
pwr_sClass_PnModule *op;
pwr_sClass_PnDevice *slave;
op = (pwr_sClass_PnModule *) cp->op;
local = (io_sCardLocal *) cp->Local;
local = (io_sPnCardLocal *) cp->Local;
slave = (pwr_sClass_PnDevice *) rp->op;
op->Status = slave->Status;
......@@ -105,12 +105,12 @@ static pwr_tStatus IoCardWrite (
io_sCard *cp
)
{
io_sCardLocal *local;
io_sPnCardLocal *local;
pwr_sClass_PnModule *op;
pwr_sClass_PnDevice *slave;
op = (pwr_sClass_PnModule *) cp->op;
local = (io_sCardLocal *) cp->Local;
local = (io_sPnCardLocal *) cp->Local;
slave = (pwr_sClass_PnDevice *) rp->op;
op->Status = slave->Status;
......@@ -134,8 +134,8 @@ static pwr_tStatus IoCardClose (
io_sCard *cp
)
{
io_sCardLocal *local;
local = (io_sCardLocal *) cp->Local;
io_sPnCardLocal *local;
local = (io_sPnCardLocal *) cp->Local;
free ((char *) local);
......
......@@ -20,160 +20,20 @@
#ifndef rt_io_pn_locals_h
#define rt_io_pn_locals_h
#include "rt_profinet.h"
#include "rt_pnak.h"
/* rt_io_pn_locals.h -- Profinet io handling locals. */
typedef struct _PN_Alarm_Data {
unsigned short alarm_type;
unsigned short alarm_prio;
unsigned short rem_alarms;
unsigned int slot_number;
unsigned int sub_slot_number;
unsigned int module_ident_number;
unsigned int submodule_ident_number;
unsigned short alarm_spec;
unsigned short data_length;
unsigned char *data;
} PN_Alarm_Data;
class PnIOCRData {
public:
PnIOCRData() : type(0), number_modules(0), identifier(0), io_data_length(0) {}
unsigned short type;
unsigned short number_modules;
unsigned short identifier;
unsigned short io_data_length; // bytes of io-data including status;
unsigned short clean_io_data_length; // bytes of io-data including status;
unsigned char *io_data;
unsigned char *clean_io_data;
~PnIOCRData() {}
int print( ofstream& fp);
};
class PnSubmoduleData {
public:
PnSubmoduleData() : subslot_number(0), subslot_idx(0), type(0), state(0), ident_number(0), phys_ident_number(0) {}
unsigned short subslot_number;
unsigned short subslot_idx;
unsigned short type;
unsigned short state;
unsigned int ident_number;
unsigned int phys_ident_number;
unsigned short io_in_data_length; // bytes of pure io-data
unsigned short offset_io_in; // offset in io-data area for this iocr
unsigned short offset_clean_io_in; // offset in io-data area for this iocr
unsigned short offset_status_in; // offset in io-data area for this iocr
unsigned short io_out_data_length; // bytes of pure io-data
unsigned short offset_io_out; // offset in io-data area for this iocr
unsigned short offset_clean_io_out; // offset in io-data area for this iocr
unsigned short offset_status_out; // offset in io-data area for this iocr
~PnSubmoduleData() {}
int print( ofstream& fp);
};
class PnModuleData {
public:
PnModuleData() : slot_number(0), slot_idx(0), state(0), ident_number(0), phys_ident_number(0) {}
unsigned int slot_number;
unsigned int slot_idx;
unsigned short state;
unsigned int ident_number;
unsigned int phys_ident_number;
vector<PnSubmoduleData *> submodule_data;
~PnModuleData() {
for ( unsigned int i = 0; i < submodule_data.size(); i++)
delete submodule_data[i];
}
int print( ofstream& fp);
};
class PnDeviceData {
public:
PnDeviceData() : device_ref(0), alarm_ref(0), device_state(0), no_diff_modules(0) {memset(&alarm_data, 0, sizeof(PN_Alarm_Data));}
unsigned short device_ref;
unsigned short alarm_ref;
unsigned short device_state;
unsigned short no_diff_modules;
PN_Alarm_Data alarm_data;
vector<PnModuleData *> module_data;
vector<PnIOCRData *> iocr_data;
~PnDeviceData() { device_reset();}
void device_reset() {
for ( unsigned int i = 0; i < module_data.size(); i++)
delete module_data[i];
module_data.clear();
for ( unsigned int i = 0; i < iocr_data.size(); i++)
delete iocr_data[i];
iocr_data.clear();
}
int copy_slot( unsigned int slot_idx);
int cut_slot( unsigned int slot_idx);
int paste_slot( unsigned int slot_idx);
};
class PnDeviceInfo {
public:
PnDeviceInfo() {}
unsigned char ipaddress[4];
unsigned char macaddress[6];
unsigned char subnetmask[4];
char devname[80];
int vendorid;
int deviceid;
};
typedef struct _agent_args {
void *local;
io_sAgent *ap;
} agent_args;
class io_sAgentLocal {
public :
io_sAgentLocal() {}
T_PNAK_SERVICE_REQ_RES service_req_res;
T_PNAK_SERVICE_CON service_con;
unsigned char ipaddress[4];
unsigned char macaddress[6];
unsigned char subnetmask[4];
vector<PnDeviceData *> device_data;
vector<PnDeviceInfo *> dev_info;
pthread_t handle_events;
agent_args args;
};
typedef struct _io_sRackLocal {
unsigned short bytes_of_input;
unsigned short bytes_of_output;
unsigned char *inputs;
unsigned char *outputs;
} io_sRackLocal;
typedef struct _io_sPnRackLocal {
unsigned short bytes_of_input;
unsigned short bytes_of_output;
unsigned char *inputs;
unsigned char *outputs;
} io_sPnRackLocal;
typedef struct _io_sCardLocal {
typedef struct _io_sPnCardLocal {
unsigned int input_area_size;
unsigned int output_area_size;
unsigned char *input_area;
unsigned char *output_area;
} io_sCardLocal;
} io_sPnCardLocal;
#endif
/*
* Proview $Id$
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef rt_io_pnak_locals_h
#define rt_io_pnak_locals_h
#include "rt_profinet.h"
#include "rt_pnak.h"
/* rt_io_pnak_locals.h -- Profinet io handling locals. */
typedef struct _PN_Alarm_Data {
unsigned short alarm_type;
unsigned short alarm_prio;
unsigned short rem_alarms;
unsigned int slot_number;
unsigned int sub_slot_number;
unsigned int module_ident_number;
unsigned int submodule_ident_number;
unsigned short alarm_spec;
unsigned short data_length;
unsigned char *data;
} PN_Alarm_Data;
class PnIOCRData {
public:
PnIOCRData() : type(0), number_modules(0), identifier(0), io_data_length(0) {}
unsigned short type;
unsigned short number_modules;
unsigned short identifier;
unsigned short io_data_length; // bytes of io-data including status;
unsigned short clean_io_data_length; // bytes of io-data including status;
unsigned char *io_data;
unsigned char *clean_io_data;
~PnIOCRData() {}
int print( ofstream& fp);
};
class PnSubmoduleData {
public:
PnSubmoduleData() : subslot_number(0), subslot_idx(0), type(0), state(0), ident_number(0), phys_ident_number(0) {}
unsigned short subslot_number;
unsigned short subslot_idx;
unsigned short type;
unsigned short state;
unsigned int ident_number;
unsigned int phys_ident_number;
unsigned short io_in_data_length; // bytes of pure io-data
unsigned short offset_io_in; // offset in io-data area for this iocr
unsigned short offset_clean_io_in; // offset in io-data area for this iocr
unsigned short offset_status_in; // offset in io-data area for this iocr
unsigned short io_out_data_length; // bytes of pure io-data
unsigned short offset_io_out; // offset in io-data area for this iocr
unsigned short offset_clean_io_out; // offset in io-data area for this iocr
unsigned short offset_status_out; // offset in io-data area for this iocr
~PnSubmoduleData() {}
int print( ofstream& fp);
};
class PnModuleData {
public:
PnModuleData() : slot_number(0), slot_idx(0), state(0), ident_number(0), phys_ident_number(0) {}
unsigned int slot_number;
unsigned int slot_idx;
unsigned short state;
unsigned int ident_number;
unsigned int phys_ident_number;
vector<PnSubmoduleData *> submodule_data;
~PnModuleData() {
for ( unsigned int i = 0; i < submodule_data.size(); i++)
delete submodule_data[i];
}
int print( ofstream& fp);
};
class PnDeviceData {
public:
PnDeviceData() : device_ref(0), alarm_ref(0), device_state(0), no_diff_modules(0) {memset(&alarm_data, 0, sizeof(PN_Alarm_Data));}
unsigned short device_ref;
unsigned short alarm_ref;
unsigned short device_state;
unsigned short no_diff_modules;
PN_Alarm_Data alarm_data;
vector<PnModuleData *> module_data;
vector<PnIOCRData *> iocr_data;
~PnDeviceData() { device_reset();}
void device_reset() {
for ( unsigned int i = 0; i < module_data.size(); i++)
delete module_data[i];
module_data.clear();
for ( unsigned int i = 0; i < iocr_data.size(); i++)
delete iocr_data[i];
iocr_data.clear();
}
int copy_slot( unsigned int slot_idx);
int cut_slot( unsigned int slot_idx);
int paste_slot( unsigned int slot_idx);
};
class PnDeviceInfo {
public:
PnDeviceInfo() {}
unsigned char ipaddress[4];
unsigned char macaddress[6];
unsigned char subnetmask[4];
char devname[80];
int vendorid;
int deviceid;
};
typedef struct _agent_args {
void *local;
io_sAgent *ap;
} agent_args;
class io_sAgentLocal {
public :
io_sAgentLocal() {}
T_PNAK_SERVICE_REQ_RES service_req_res;
T_PNAK_SERVICE_CON service_con;
unsigned char ipaddress[4];
unsigned char macaddress[6];
unsigned char subnetmask[4];
vector<PnDeviceData *> device_data;
vector<PnDeviceInfo *> dev_info;
pthread_t handle_events;
agent_args args;
};
#endif
......@@ -41,7 +41,7 @@
#include "co_dcli.h"
#include "rt_pn_gsdml_data.h"
#include "rt_io_base.h"
#include "rt_io_pn_locals.h"
#include "rt_io_pnak_locals.h"
#define _PN_U32_HIGH_WORD(U32) ((PN_U16) ((U32) >> 16))
#define _PN_U32_LOW_WORD(U32) ((PN_U16) (U32) )
......@@ -1546,5 +1546,6 @@ void *handle_events(void *ptr) {
// pThisSmObject->Running = PN_FALSE;
}
}
return 0;
}
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