Commit 9b6f43bf authored by Claes Sjofors's avatar Claes Sjofors

Modbus TCP module with both read and write

parent 7ef3456a
......@@ -71,12 +71,12 @@ static pwr_tStatus IoCardInit (
io_sCard *cp
)
{
io_sCardLocal *local;
io_sCardLocalMsg *local;
pwr_sClass_Modbus_Module *op;
int i;
op = (pwr_sClass_Modbus_Module *) cp->op;
local = (io_sCardLocal *) cp->Local;
local = ((io_sCardLocal *) cp->Local)->msg;
for (i = 0; i < IO_MAXCHAN; i++) {
local->scancount[i] = 0;
......@@ -98,12 +98,12 @@ static pwr_tStatus IoCardRead (
io_sCard *cp
)
{
io_sCardLocal *local;
io_sCardLocalMsg *local;
pwr_sClass_Modbus_Module *op;
pwr_sClass_Modbus_TCP_Slave *slave;
op = (pwr_sClass_Modbus_Module *) cp->op;
local = (io_sCardLocal *) cp->Local;
local = ((io_sCardLocal *) cp->Local)->msg;
slave = (pwr_sClass_Modbus_TCP_Slave *) rp->op;
if ( op->ScanInterval > 1) {
......@@ -118,7 +118,7 @@ static pwr_tStatus IoCardRead (
}
if (slave->Status == MB__NORMAL) {
io_bus_card_read(ctx, rp, cp, local->input_area, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
io_bus_card_read(ctx, rp, cp, slave->Inputs, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardRead\n");
return IO__SUCCESS;
......@@ -135,13 +135,13 @@ static pwr_tStatus IoCardWrite (
io_sCard *cp
)
{
io_sCardLocal *local;
io_sCardLocalMsg *local;
pwr_sClass_Modbus_Module *op;
pwr_sClass_Modbus_TCP_Slave *slave;
op = (pwr_sClass_Modbus_Module *) cp->op;
local = (io_sCardLocal *) cp->Local;
local = ((io_sCardLocal *) cp->Local)->msg;
slave = (pwr_sClass_Modbus_TCP_Slave *) rp->op;
if ( op->ScanInterval > 1) {
......@@ -159,7 +159,7 @@ static pwr_tStatus IoCardWrite (
}
if (slave->Status == MB__NORMAL) {
io_bus_card_write(ctx, cp, local->output_area, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
io_bus_card_write(ctx, cp, slave->Outputs, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS;
......
......@@ -143,9 +143,9 @@ pwr_tStatus mb_recv_data(io_sRackLocal *local,
io_sRack *rp,
pwr_sClass_Modbus_TCP_Slave *sp)
{
io_sCardLocal *local_card;
io_sCardLocalMsg *local_card;
io_sCard *cardp;
pwr_sClass_Modbus_Module *mp;
pwr_sClass_Modbus_ModuleMsg *mp;
pwr_tStatus sts;
fd_set fdr; /* For select call */
fd_set fde; /* For select call */
......@@ -158,6 +158,8 @@ pwr_tStatus mb_recv_data(io_sRackLocal *local,
unsigned char fc;
short int trans_id;
short int size_of_msg;
int modules;
int i;
/* Receive answer */
......@@ -265,75 +267,92 @@ pwr_tStatus mb_recv_data(io_sRackLocal *local,
cid = cardp->Class;
while ( ODD( gdh_GetSuperClass( cid, &cid, cardp->Objid))) ;
switch (cid) {
case pwr_cClass_Modbus_Module: {
mp = (pwr_sClass_Modbus_Module *) cardp->op;
local_card = cardp->Local;
if (local_card->trans_id == trans_id) {
fc = (unsigned char) *rb->buf;
if (fc > 0x80) {
res_fault *res_f;
res_f = (res_fault *) rb->buf;
mp->Status = res_f->ec;
break;
}
if (fc != mp->FunctionCode) {
mp->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
break;
}
mp->Status = pwr_eModbusModule_StatusEnum_OK;
switch (fc) {
case pwr_eModbus_FCEnum_ReadCoils: {
res_read *res_r;
res_r = (res_read *) rb->buf;
memcpy(local_card->input_area, res_r->buf, MIN(res_r->bc, local_card->input_size));
break;
}
case pwr_eModbus_FCEnum_ReadDiscreteInputs: {
res_read *res_r;
res_r = (res_read *) rb->buf;
memcpy(local_card->input_area, res_r->buf, MIN(res_r->bc, local_card->input_size));
break;
}
case pwr_eModbus_FCEnum_ReadHoldingRegisters: {
res_read *res_r;
res_r = (res_read *) rb->buf;
memcpy(local_card->input_area, res_r->buf, MIN(res_r->bc, local_card->input_size));
break;
}
case pwr_eModbus_FCEnum_ReadInputRegisters: {
res_read *res_r;
res_r = (res_read *) rb->buf;
memcpy(local_card->input_area, res_r->buf, MIN(res_r->bc, local_card->input_size));
break;
}
case pwr_eModbus_FCEnum_WriteMultipleCoils:
case pwr_eModbus_FCEnum_WriteMultipleRegisters:
case pwr_eModbus_FCEnum_WriteSingleRegister:
// Nothing good to do here
break;
}
found = TRUE;
switch (cid) {
case pwr_cClass_Modbus_Module:
mp = (pwr_sClass_Modbus_ModuleMsg *) &((pwr_sClass_Modbus_Module *) cardp->op)->FunctionCode;
modules = 1;
local_card = ((io_sCardLocal *)cardp->Local)->msg;
break;
case pwr_cClass_Modbus_ModuleReadWrite:
mp = &((pwr_sClass_Modbus_ModuleReadWrite *) cardp->op)->Read;
modules = 2;
local_card = ((io_sCardLocal *)cardp->Local)->msg;
break;
default:
modules = 0;
}
if ( !modules) {
cardp = cardp->next;
continue;
}
for ( i = 0; i < modules; i++) {
if (local_card->trans_id == trans_id) {
fc = (unsigned char) *rb->buf;
if (fc > 0x80) {
res_fault *res_f;
res_f = (res_fault *) rb->buf;
mp->Status = res_f->ec;
mp++;
local_card++;
continue;
}
if (fc != mp->FunctionCode) {
mp->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
mp++;
local_card++;
continue;
}
break;
mp->Status = pwr_eModbusModule_StatusEnum_OK;
switch (fc) {
case pwr_eModbus_FCEnum_ReadCoils: {
res_read *res_r;
res_r = (res_read *) rb->buf;
memcpy(local_card->input_area, res_r->buf, MIN(res_r->bc, local_card->input_size));
break;
}
case pwr_eModbus_FCEnum_ReadDiscreteInputs: {
res_read *res_r;
res_r = (res_read *) rb->buf;
memcpy(local_card->input_area, res_r->buf, MIN(res_r->bc, local_card->input_size));
break;
}
case pwr_eModbus_FCEnum_ReadHoldingRegisters: {
res_read *res_r;
res_r = (res_read *) rb->buf;
memcpy(local_card->input_area, res_r->buf, MIN(res_r->bc, local_card->input_size));
break;
}
case pwr_eModbus_FCEnum_ReadInputRegisters: {
res_read *res_r;
res_r = (res_read *) rb->buf;
memcpy(local_card->input_area, res_r->buf, MIN(res_r->bc, local_card->input_size));
break;
}
case pwr_eModbus_FCEnum_WriteMultipleCoils:
case pwr_eModbus_FCEnum_WriteMultipleRegisters:
case pwr_eModbus_FCEnum_WriteSingleRegister:
// Nothing good to do here
break;
}
found = TRUE;
}
default:
break;
} /* End - switch (cid) ... */
mp++;
local_card++;
}
if (found)
break;
cardp = cardp->next;
cardp = cardp->next;
} /* End - while(cardp) ... */
} /* End - data_size > 0 ... */
} /* End - if received message ... */
......@@ -347,11 +366,13 @@ pwr_tStatus mb_send_data(io_sRackLocal *local,
pwr_sClass_Modbus_TCP_Slave *sp,
mb_tSendMask mask)
{
io_sCardLocal *local_card;
io_sCardLocalMsg *local_card;
io_sCard *cardp;
pwr_sClass_Modbus_Module *mp;
pwr_sClass_Modbus_ModuleMsg *mp;
pwr_tStatus sts;
pwr_tCid cid;
int modules;
int i;
/* Send messages to slave */
......@@ -364,231 +385,250 @@ pwr_tStatus mb_send_data(io_sRackLocal *local,
while ( ODD( gdh_GetSuperClass( cid, &cid, cardp->Objid))) ;
switch (cid) {
case pwr_cClass_Modbus_Module:
mp = (pwr_sClass_Modbus_Module *) cardp->op;
case pwr_cClass_Modbus_Module:
mp = (pwr_sClass_Modbus_ModuleMsg *) &((pwr_sClass_Modbus_Module *) cardp->op)->FunctionCode;
modules = 1;
break;
case pwr_cClass_Modbus_ModuleReadWrite:
mp = &((pwr_sClass_Modbus_ModuleReadWrite *) cardp->op)->Read;
modules = 2;
break;
default:
modules = 0;
}
if ( !modules) {
cardp = cardp->next;
continue;
}
if (!mp->Continous && !mp->SendOp) {
for ( i = 0; i < modules; i++) {
sts = 1;
if (!mp->Continous && !mp->SendOp) {
break;
}
local_card = &((io_sCardLocal *)cardp->Local)->msg[i];
if ( mp->ScanInterval > 1 && local_card->interval_cnt != 0) {
cardp = cardp->next;
continue;
}
if (mask & mb_mSendMask_ReadReq) {
switch (mp->FunctionCode) {
case pwr_eModbus_FCEnum_ReadCoils:
case pwr_eModbus_FCEnum_ReadDiscreteInputs: {
read_req rr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
rr.head.trans_id = htons(local->trans_id);
rr.head.proto_id = 0;
rr.head.length = htons(sizeof(read_req) - 6);
rr.head.unit_id = mp->UnitId;
rr.fc = mp->FunctionCode;
rr.addr = htons(mp->Address);
rr.quant = htons(local_card->no_di);
// rr.quant = ntohs(local_card->input_size * 8);
sts = send(local->s, &rr, sizeof(read_req), MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
local->expected_msgs++;
sp->TX_packets++;
break;
}
local_card = cardp->Local;
if ( mp->ScanInterval > 1 && local_card->interval_cnt != 0) {
cardp = cardp->next;
continue;
case pwr_eModbus_FCEnum_ReadHoldingRegisters:
case pwr_eModbus_FCEnum_ReadInputRegisters: {
read_req rr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
rr.head.trans_id = htons(local->trans_id);
rr.head.proto_id = 0;
rr.head.length = htons(sizeof(read_req) - 6);
rr.head.unit_id = mp->UnitId;
rr.fc = mp->FunctionCode;
rr.addr = htons(mp->Address);
rr.quant = ntohs((local_card->input_size + 1) / 2);
sts = send(local->s, &rr, sizeof(read_req), MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
sp->TX_packets++;
local->expected_msgs++;
break;
}
} /* End - switch FC ... */
}
if (mask & mb_mSendMask_ReadReq) {
switch (mp->FunctionCode) {
case pwr_eModbus_FCEnum_ReadCoils:
case pwr_eModbus_FCEnum_ReadDiscreteInputs: {
read_req rr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
rr.head.trans_id = htons(local->trans_id);
rr.head.proto_id = 0;
rr.head.length = htons(sizeof(read_req) - 6);
rr.head.unit_id = mp->UnitId;
rr.fc = mp->FunctionCode;
rr.addr = htons(mp->Address);
rr.quant = htons(local_card->no_di);
// rr.quant = ntohs(local_card->input_size * 8);
sts = send(local->s, &rr, sizeof(read_req), MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
local->expected_msgs++;
sp->TX_packets++;
break;
}
if (mask & mb_mSendMask_WriteReq) {
switch (mp->FunctionCode) {
case pwr_eModbus_FCEnum_ReadHoldingRegisters:
case pwr_eModbus_FCEnum_ReadInputRegisters: {
read_req rr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
rr.head.trans_id = htons(local->trans_id);
rr.head.proto_id = 0;
rr.head.length = htons(sizeof(read_req) - 6);
rr.head.unit_id = mp->UnitId;
rr.fc = mp->FunctionCode;
rr.addr = htons(mp->Address);
rr.quant = ntohs((local_card->input_size + 1) / 2);
sts = send(local->s, &rr, sizeof(read_req), MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
sp->TX_packets++;
local->expected_msgs++;
break;
}
} /* End - switch FC ... */
}
case pwr_eModbus_FCEnum_WriteSingleCoil: {
write_single_req wsr;
if (mask & mb_mSendMask_WriteReq) {
switch (mp->FunctionCode) {
case pwr_eModbus_FCEnum_WriteSingleCoil: {
write_single_req wsr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
wsr.head.trans_id = htons(local->trans_id);
wsr.head.proto_id = 0;
wsr.head.length = htons(sizeof(wsr) - 6);
wsr.head.unit_id = mp->UnitId;
wsr.fc = mp->FunctionCode;
wsr.addr = htons(mp->Address);
if (local_card->output_size == 4) {
if (*(int *)local_card->output_area)
wsr.value = ntohs(0xFF00);
else wsr.value = 0;
} else if (local_card->output_size == 2) {
if (*(short int *)local_card->output_area)
wsr.value = ntohs(0xFF00);
else wsr.value = 0;
} else if (local_card->output_size == 1) {
if (*(char *)local_card->output_area)
wsr.value = ntohs(0xFF00);
else wsr.value = 0;
} else wsr.value = 0;
sts = send(local->s, &wsr, ntohs(wsr.head.length) + 6, MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
local->expected_msgs++;
sp->TX_packets++;
break;
}
mp->SendOp = FALSE;
case pwr_eModbus_FCEnum_WriteMultipleCoils: {
write_coils_req wcr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
wcr.head.trans_id = htons(local->trans_id);
wcr.head.proto_id = 0;
wcr.head.length = htons(sizeof(wcr) - 6 -
sizeof(wcr.reg) + local_card->output_size);
wcr.head.unit_id = mp->UnitId;
wcr.fc = mp->FunctionCode;
wcr.addr = htons(mp->Address);
wcr.quant = htons(local_card->no_do);
// wcr.quant = ntohs((local_card->output_size) * 8);
wcr.bc = local_card->output_size;
memcpy(wcr.reg, local_card->output_area, local_card->output_size);
sts = send(local->s, &wcr, ntohs(wcr.head.length) + 6, MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
local->expected_msgs++;
sp->TX_packets++;
break;
}
local->trans_id++;
local_card->trans_id = local->trans_id;
wsr.head.trans_id = htons(local->trans_id);
wsr.head.proto_id = 0;
wsr.head.length = htons(sizeof(wsr) - 6);
wsr.head.unit_id = mp->UnitId;
wsr.fc = mp->FunctionCode;
wsr.addr = htons(mp->Address);
if (local_card->output_size == 4) {
if (*(int *)local_card->output_area)
wsr.value = ntohs(0xFF00);
else wsr.value = 0;
} else if (local_card->output_size == 2) {
if (*(short int *)local_card->output_area)
wsr.value = ntohs(0xFF00);
else wsr.value = 0;
} else if (local_card->output_size == 1) {
if (*(char *)local_card->output_area)
wsr.value = ntohs(0xFF00);
else wsr.value = 0;
} else wsr.value = 0;
sts = send(local->s, &wsr, ntohs(wsr.head.length) + 6, MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
local->expected_msgs++;
sp->TX_packets++;
break;
}
case pwr_eModbus_FCEnum_WriteMultipleRegisters: {
write_reg_req wrr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
wrr.head.trans_id = htons(local->trans_id);
wrr.head.proto_id = 0;
wrr.head.length = htons(sizeof(wrr) - 6 -
sizeof(wrr.reg) + local_card->output_size);
wrr.head.unit_id = mp->UnitId;
wrr.fc = mp->FunctionCode;
wrr.addr = htons(mp->Address);
wrr.quant = ntohs((local_card->output_size) / 2);
wrr.bc = local_card->output_size;
memcpy(wrr.reg, local_card->output_area, local_card->output_size);
sts = send(local->s, &wrr, ntohs(wrr.head.length) + 6, MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
sp->TX_packets++;
local->expected_msgs++;
break;
}
case pwr_eModbus_FCEnum_WriteSingleRegister: {
write_single_req wrr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
wrr.head.trans_id = htons(local->trans_id);
wrr.head.proto_id = 0;
wrr.head.length = htons(sizeof(wrr) - 6);
wrr.head.unit_id = mp->UnitId;
wrr.fc = mp->FunctionCode;
wrr.addr = htons(mp->Address);
memcpy(&wrr.value, local_card->output_area, sizeof(wrr.value));
sts = send(local->s, &wrr, ntohs(wrr.head.length) + 6, MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
sp->TX_packets++;
local->expected_msgs++;
break;
}
} /* End - switch FC ... */
case pwr_eModbus_FCEnum_WriteMultipleCoils: {
write_coils_req wcr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
wcr.head.trans_id = htons(local->trans_id);
wcr.head.proto_id = 0;
wcr.head.length = htons(sizeof(wcr) - 6 -
sizeof(wcr.reg) + local_card->output_size);
wcr.head.unit_id = mp->UnitId;
wcr.fc = mp->FunctionCode;
wcr.addr = htons(mp->Address);
wcr.quant = htons(local_card->no_do);
// wcr.quant = ntohs((local_card->output_size) * 8);
wcr.bc = local_card->output_size;
memcpy(wcr.reg, local_card->output_area, local_card->output_size);
sts = send(local->s, &wcr, ntohs(wcr.head.length) + 6, MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
local->expected_msgs++;
sp->TX_packets++;
break;
}
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
case pwr_eModbus_FCEnum_WriteMultipleRegisters: {
write_reg_req wrr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
wrr.head.trans_id = htons(local->trans_id);
wrr.head.proto_id = 0;
wrr.head.length = htons(sizeof(wrr) - 6 -
sizeof(wrr.reg) + local_card->output_size);
wrr.head.unit_id = mp->UnitId;
wrr.fc = mp->FunctionCode;
wrr.addr = htons(mp->Address);
wrr.quant = ntohs((local_card->output_size) / 2);
wrr.bc = local_card->output_size;
memcpy(wrr.reg, local_card->output_area, local_card->output_size);
sts = send(local->s, &wrr, ntohs(wrr.head.length) + 6, MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
sp->TX_packets++;
local->expected_msgs++;
break;
}
case pwr_eModbus_FCEnum_WriteSingleRegister: {
write_single_req wrr;
mp->SendOp = FALSE;
local->trans_id++;
local_card->trans_id = local->trans_id;
wrr.head.trans_id = htons(local->trans_id);
wrr.head.proto_id = 0;
wrr.head.length = htons(sizeof(wrr) - 6);
wrr.head.unit_id = mp->UnitId;
wrr.fc = mp->FunctionCode;
wrr.addr = htons(mp->Address);
memcpy(&wrr.value, local_card->output_area, sizeof(wrr.value));
sts = send(local->s, &wrr, ntohs(wrr.head.length) + 6, MSG_DONTWAIT);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
sp->TX_packets++;
local->expected_msgs++;
break;
}
} /* End - switch FC ... */
}
if ( sts < 0)
break;
mp++;
}
if (sp->SingleOp)
sts = mb_recv_data(local, rp, sp);
if (sts < 0) {
sp->Status = MB__CONNDOWN;
close(local->s);
errh_Error( "Connection down to modbus slave, %s", rp->Name);
return IO__SUCCESS;
}
if (sp->Status != MB__NORMAL) return IO__SUCCESS;
if (sp->SingleOp)
sts = mb_recv_data(local, rp, sp);
break;
} /* End - switch cid ... */
if (sp->Status != MB__NORMAL) return IO__SUCCESS;
cardp = cardp->next;
......@@ -609,28 +649,15 @@ static pwr_tStatus IoRackInit (
io_sCardLocal *local_card;
io_sCard *cardp;
io_sRackLocal *local;
short input_counter;
short output_counter;
short card_input_counter;
short card_output_counter;
short no_di;
short no_do;
int no_di;
int no_do;
pwr_sClass_Modbus_TCP_Slave *op;
pwr_sClass_Modbus_Module *mp;
char name[196];
pwr_tStatus sts;
pwr_tCid cid;
io_sChannel *chanp;
int i, latent_input_counter, latent_output_counter;
pwr_tInt32 chan_size;
pwr_sClass_ChanDi *chan_di;
pwr_sClass_ChanDo *chan_do;
pwr_sClass_ChanAi *chan_ai;
pwr_sClass_ChanAit *chan_ait;
pwr_sClass_ChanIi *chan_ii;
pwr_sClass_ChanAo *chan_ao;
pwr_sClass_ChanIo *chan_io;
int i;
sts = gdh_ObjidToName(rp->Objid, (char *) &name, sizeof(name), cdh_mNName);
errh_Info( "Init of Modbus TCP Slave and Modules %s", name);
......@@ -654,167 +681,124 @@ static pwr_tStatus IoRackInit (
cardp = rp->cardlist;
input_counter = 0;
output_counter = 0;
card_input_counter = 0;
card_output_counter = 0;
latent_input_counter = 0;
latent_output_counter = 0;
unsigned int prev_input_area_offset = 0;
unsigned int prev_output_area_offset = 0;
unsigned int input_area_offset = 0;
unsigned int output_area_offset = 0;
unsigned int input_area_chansize = 0;
unsigned int output_area_chansize = 0;
while(cardp) {
local_card = calloc(1, sizeof(*local_card));
cardp->Local = local_card;
input_counter = input_counter + card_input_counter + latent_input_counter;
output_counter = output_counter + card_output_counter + latent_output_counter;
local_card->input_area = (void *) &(op->Inputs) + input_counter;
local_card->output_area = (void *) &(op->Outputs) + output_counter;
card_input_counter = 0;
card_output_counter = 0;
latent_input_counter = 0;
latent_output_counter = 0;
no_di = 0;
no_do = 0;
/* From v4.1.3 we can have subclasses, find the super class */
cid = cardp->Class;
/* Find the super class */
while ( ODD( gdh_GetSuperClass( cid, &cid, cardp->Objid))) ;
switch (cid) {
case pwr_cClass_Modbus_Module: {
pwr_sClass_Modbus_Module *mp;
case pwr_cClass_Modbus_Module:
mp = (pwr_sClass_Modbus_Module *) cardp->op;
mp->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
for (i = 0; i < cardp->ChanListSize; i++) {
chanp = &cardp->chanlist[i];
if ( is_diag( &chanp->ChanAref)) {
chanp->udata |= PB_UDATA_DIAG;
switch (chanp->ChanClass) {
case pwr_cClass_ChanIi:
chanp->offset = ((pwr_sClass_ChanIi *)chanp->cop)->Number;
chanp->size = GetChanSize( ((pwr_sClass_ChanIi *)chanp->cop)->Representation);
break;
default:
errh_Error( "Diagnostic channel class, card %s", cardp->Name);
}
continue;
}
cardp->Local = local_card;
no_di = 0;
no_do = 0;
if (chanp->ChanClass != pwr_cClass_ChanDi) {
card_input_counter += latent_input_counter;
latent_input_counter = 0;
}
local_card->msg[0].input_area = (void *) &(op->Inputs) + input_area_offset +
input_area_chansize;
local_card->msg[0].output_area = (void *) &(op->Outputs) + output_area_offset +
output_area_chansize;
if (chanp->ChanClass != pwr_cClass_ChanDo) {
card_output_counter += latent_output_counter;
latent_output_counter = 0;
}
switch (chanp->ChanClass) {
mp = (pwr_sClass_Modbus_Module *) cardp->op;
mp->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
io_bus_card_init( ctx, cardp, &input_area_offset, &input_area_chansize,
&output_area_offset, &output_area_chansize,
pwr_eByteOrderingEnum_BigEndian);
/* Count number of di and do */
for (i = 0; i < cardp->ChanListSize; i++) {
chanp = &cardp->chanlist[i];
switch (chanp->ChanClass) {
case pwr_cClass_ChanDi:
no_di++;
break;
case pwr_cClass_ChanDo:
no_do++;
break;
}
}
local_card->msg[0].input_size = input_area_offset + input_area_chansize -
prev_input_area_offset;
local_card->msg[0].output_size = output_area_offset + output_area_chansize -
prev_output_area_offset;
local_card->msg[0].no_di = no_di;
local_card->msg[0].no_do = no_do;
case pwr_cClass_ChanDi:
chan_di = (pwr_sClass_ChanDi *) chanp->cop;
if (chan_di->Number == 0) {
card_input_counter += latent_input_counter;
latent_input_counter = 0;
}
chanp->offset = card_input_counter;
chanp->mask = 1 << chan_di->Number;
if (chan_di->Representation == pwr_eDataRepEnum_Bit16)
chanp->mask = swap16(chanp->mask);
if (chan_di->Representation == pwr_eDataRepEnum_Bit32)
chanp->mask = swap32((unsigned short) chanp->mask);
if (chan_di->Number == 0) latent_input_counter = GetChanSize(chan_di->Representation);
no_di++;
// printf("Di channel found in %s, Number %d, Offset %d\n", cardp->Name, chan_di->Number, chanp->offset);
break;
case pwr_cClass_ChanAi:
chan_ai = (pwr_sClass_ChanAi *) chanp->cop;
chanp->offset = card_input_counter;
chan_size = GetChanSize(chan_ai->Representation);
chanp->size = chan_size;
chanp->mask = 0;
card_input_counter += chan_size;
io_AiRangeToCoef(chanp);
// printf("Ai channel found in %s, Number %d, Offset %d\n", cardp->Name, chan_ai->Number, chanp->offset);
break;
case pwr_cClass_ChanAit:
chan_ait = (pwr_sClass_ChanAit *) chanp->cop;
chanp->offset = card_input_counter;
chan_size = GetChanSize(chan_ait->Representation);
chanp->size = chan_size;
chanp->mask = 0;
card_input_counter += chan_size;
io_AiRangeToCoef(chanp);
break;
case pwr_cClass_ChanIi:
chan_ii = (pwr_sClass_ChanIi *) chanp->cop;
chanp->offset = card_input_counter;
chan_size = GetChanSize(chan_ii->Representation);
chanp->size = chan_size;
chanp->mask = 0;
card_input_counter += chan_size;
// printf("Ii channel found in %s, Number %d, Offset %d\n", cardp->Name, chan_ii->Number, chanp->offset);
break;
case pwr_cClass_ChanDo:
chan_do = (pwr_sClass_ChanDo *) chanp->cop;
if (chan_do->Number == 0) {
card_output_counter += latent_output_counter;
latent_output_counter = 0;
}
chanp->offset = card_output_counter;
chan_size = GetChanSize(chan_do->Representation);
chanp->mask = 1 << chan_do->Number;
if (chan_do->Representation == pwr_eDataRepEnum_Bit16)
chanp->mask = swap16(chanp->mask);
if (chan_do->Representation == pwr_eDataRepEnum_Bit32)
chanp->mask = swap32((unsigned short) chanp->mask);
if (chan_do->Number == 0) latent_output_counter = GetChanSize(chan_do->Representation);
no_do++;
// printf("Do channel found in %s, Number %d, Offset %d\n", cardp->Name, chan_do->Number, chanp->offset);
break;
case pwr_cClass_ChanAo:
chan_ao = (pwr_sClass_ChanAo *) chanp->cop;
chanp->offset = card_output_counter;
chan_size = GetChanSize(chan_ao->Representation);
chanp->size = chan_size;
chanp->mask = 0;
card_output_counter += chan_size;
io_AoRangeToCoef(chanp);
// printf("Ao channel found in %s, Number %d, Offset %d\n", cardp->Name, chan_ao->Number, chanp->offset);
break;
case pwr_cClass_ChanIo:
chan_io = (pwr_sClass_ChanIo *) chanp->cop;
chanp->offset = card_output_counter;
chan_size = GetChanSize(chan_io->Representation);
chanp->size = chan_size;
chanp->mask = 0;
card_output_counter += chan_size;
// printf("Io channel found in %s, Number %d, Offset %d\n", cardp->Name, chan_io->Number, chanp->offset);
break;
}
} /* End - for ... */
break;
}
case pwr_cClass_Modbus_ModuleReadWrite: {
pwr_sClass_Modbus_ModuleReadWrite *mp;
cardp->Local = local_card;
no_di = 0;
no_do = 0;
local_card->msg[0].input_area = (void *) &(op->Inputs) + input_area_offset +
input_area_chansize;
local_card->msg[0].output_area = (void *) &(op->Outputs) + output_area_offset +
output_area_chansize;
local_card->msg[1].input_area = (void *) &(op->Inputs) + input_area_offset +
input_area_chansize;
local_card->msg[1].output_area = (void *) &(op->Outputs) + output_area_offset +
output_area_chansize;
mp = (pwr_sClass_Modbus_ModuleReadWrite *) cardp->op;
mp->Read.Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
mp->Write.Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
io_bus_card_init( ctx, cardp, &input_area_offset, &input_area_chansize,
&output_area_offset, &output_area_chansize,
pwr_eByteOrderingEnum_BigEndian);
/* Count number of di and do */
for (i = 0; i < cardp->ChanListSize; i++) {
chanp = &cardp->chanlist[i];
switch (chanp->ChanClass) {
case pwr_cClass_ChanDi:
no_di++;
break;
case pwr_cClass_ChanDo:
no_do++;
break;
}
}
local_card->msg[0].input_size = input_area_offset + input_area_chansize -
prev_input_area_offset;
local_card->msg[0].output_size = 0;
local_card->msg[0].no_di = no_di;
local_card->msg[0].no_do = 0;
local_card->msg[1].input_size = 0;
local_card->msg[1].output_size = output_area_offset + output_area_chansize -
prev_output_area_offset;
local_card->msg[1].no_di = 0;
local_card->msg[1].no_do = no_do;
break;
break;
}
} /* End - switch ... */
local_card->input_size = card_input_counter + latent_input_counter;
local_card->output_size = card_output_counter + latent_output_counter;
local_card->no_di = no_di;
local_card->no_do = no_do;
prev_input_area_offset = input_area_offset + input_area_chansize;
prev_output_area_offset = output_area_offset + output_area_chansize;
cardp = cardp->next;
}
local->input_size = input_counter + card_input_counter + latent_input_counter;
local->output_size = output_counter + card_output_counter + latent_output_counter;
local->input_size = input_area_offset + input_area_chansize;
local->output_size = output_area_offset + output_area_chansize;
return IO__SUCCESS;
}
......
......@@ -112,6 +112,10 @@ typedef struct {
short int no_do;
int interval_cnt;
int has_read_method;
} io_sCardLocalMsg;
typedef struct {
io_sCardLocalMsg msg[2];
} io_sCardLocal;
typedef struct {
......
......@@ -2,6 +2,7 @@ MotionControl_USB
MotionControl_USBIO
Modbus_TCP_Slave
Modbus_Module
Modbus_ModuleReadWrite
Modbus_Master
Modbus_TCP_Server
Modbus_TCP_ServerModule
......
Volume OtherIO $ClassVolume 0.0.250.10
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X256"
Attr NextCix = "_X27"
Attr NextOix = "_X267"
Attr NextCix = "_X29"
Attr NextTix[0] = "_X10"
EndBody
Object Type $TypeHier 1 15-NOV-2007 14:35:37.90
......@@ -806,10 +806,10 @@ Volume OtherIO $ClassVolume 0.0.250.10
! @classlink Modbus_Module otherio_modbus_module.html
!*/
Object Modbus_TCP_Slave $ClassDef 3 07-FEB-2008 16:12:21.21
Body SysBody 21-FEB-2008 11:26:38.84
Body SysBody 17-OCT-2011 07:55:58.79
Attr Editor = 0
Attr Method = 0
Attr Flags = 41040
Attr Flags = 43088
EndBody
Object RtBody $ObjBodyDef 1 08-FEB-2008 10:26:36.84
Body SysBody 08-FEB-2008 10:26:36.85
......@@ -1114,10 +1114,10 @@ Volume OtherIO $ClassVolume 0.0.250.10
! @classlink Modbus_TPC_Slave otherio_modbus_tcp_slave.html
!*/
Object Modbus_Module $ClassDef 4 08-FEB-2008 11:05:36.53
Body SysBody 21-FEB-2008 11:29:00.89
Body SysBody 17-OCT-2011 07:54:35.93
Attr Editor = 0
Attr Method = 0
Attr Flags = 49232
Attr Flags = 51280
EndBody
Object RtBody $ObjBodyDef 1 08-FEB-2008 11:15:54.62
Body SysBody 08-FEB-2008 11:15:54.63
......@@ -1205,6 +1205,19 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndBody
EndObject
!/**
! Specifies, in relation to the scantime of the thread, how
! often the module is handled. If ScanInterval i 1, the module
! is handled every scan. If ScanInterval is for example 10, it
! is handled every 10'th scan, i.e. the scantime for the module
! will be ScanInterval times the scantime of the thread.
!*/
Object ScanInterval $Attribute 11 17-OCT-2011 08:08:42.29
Body SysBody 16-MAR-2010 08:26:09.35
Attr PgmName = "ScanInterval"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! @Summary Process that handles the card. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the card.
!
......@@ -1230,19 +1243,6 @@ Volume OtherIO $ClassVolume 0.0.250.10
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
!/**
! Specifies, in relation to the scantime of the thread, how
! often the module is handled. If ScanInterval i 1, the module
! is handled every scan. If ScanInterval is for example 10, it
! is handled every 10'th scan, i.e. the scantime for the module
! will be ScanInterval times the scantime of the thread.
!*/
Object ScanInterval $Attribute 11 16-MAR-2010 08:26:01.30
Body SysBody 16-MAR-2010 08:26:09.35
Attr PgmName = "ScanInterval"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
Object IoMethods $RtMethod 45 08-FEB-2008 11:16:05.05
Object IoCardInit $Method 46 08-FEB-2008 11:17:19.82
......@@ -1269,8 +1269,234 @@ Volume OtherIO $ClassVolume 0.0.250.10
Object Template Modbus_Module 2148761600 01-JAN-1970 01:00:00.00
Body RtBody 16-MAR-2010 08:26:27.97
Attr Continous = 1
Attr Process = 1
Attr ScanInterval = 1
Attr Process = 1
EndBody
EndObject
EndObject
!/**
! @Version 1.0
! @Group IO
! @Summary Message specification for module object for Modbus TCP I/O.
! Message specification for module object for Modbus TCP I/O.
!
! This object is used as an attribute object for modules supporting more than
! one message.
!
! @b See also
! @classlink Modbus_ModuleReadWrite otherio_modbus_modulereadwrite.html
! @classlink Modbus_Module otherio_modbus_module.html
!*/
Object Modbus_ModuleMsg $ClassDef 28 17-OCT-2011 08:03:47.05
Body SysBody 17-OCT-2011 08:03:53.09
Attr Editor = 0
Attr Method = 0
Attr Flags = 32848
EndBody
Object RtBody $ObjBodyDef 1 17-OCT-2011 08:04:34.90
Body SysBody 17-OCT-2011 08:04:09.03
Attr StructName = "Modbus_ModuleMsg"
Attr NextAix = "_X22"
EndBody
!/**
! @Summary Modbus function code.
! The function code defines the action that is to be perfomed with the Modbus slave.
! The module is handled with the scantime of the thread.
! The supported function codes are:
!
! (FC 1) ReadCoils
! (FC 2) ReadDiscreteInputs
! (FC 3) ReadHoldingRegisters
! (FC 4) ReadInputRegisters
! (FC 5) WriteSingleCoil
! (FC 15) WriteMultipleCoils
! (FC 16) WriteMultipleRegisters
!*/
Object FunctionCode $Attribute 13 17-OCT-2011 08:03:36.21
Body SysBody 17-OCT-2011 08:03:36.21
Attr PgmName = "FunctionCode"
Attr TypeRef = "OtherIO:Type-Modbus_FCEnum"
EndBody
EndObject
!/**
! @Summary Address of data area on Modbus slave.
! Address of data area on Modbus slave.
!*/
Object Address $Attribute 14 17-OCT-2011 08:03:36.21
Body SysBody 17-OCT-2011 08:03:36.21
Attr PgmName = "Address"
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
!/**
! @Summary Unit id.
! Identification of the modbus unit to communicate with. It is typically only used
! if communicating with a tpc gateway that is connected to a Modbus serial line with
! possibly several units. Usually this has no meaning and should be set to zero (0).
!*/
Object UnitId $Attribute 15 17-OCT-2011 08:03:36.21
Body SysBody 17-OCT-2011 08:03:36.21
Attr PgmName = "UnitId"
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object Status $Attribute 16 17-OCT-2011 08:03:36.21
Body SysBody 17-OCT-2011 08:03:36.21
Attr PgmName = "Status"
Attr Flags = 1040
Attr TypeRef = "OtherIO:Type-ModbusModule_StatusEnum"
EndBody
EndObject
!/**
! @Summary Continous operation of the module.
! If set to Yes the module is scanned cylically for each scan (read or write operation).
! If set to false the action defined by the FunctionCode-attribute will only be executed
! when the SendOp-attribute is set.
!*/
Object Continous $Attribute 17 17-OCT-2011 08:03:36.21
Body SysBody 17-OCT-2011 08:03:36.21
Attr PgmName = "Continous"
Attr TypeRef = "pwrb:Type-YesNoEnum"
EndBody
EndObject
!/**
! @Summary Request to execute action defined by FunctionCode-attribute once.
! This attribute is only valid if Contious-attribute is set to 'No'.
!*/
Object SendOp $Attribute 18 17-OCT-2011 08:03:36.21
Body SysBody 17-OCT-2011 08:03:36.21
Attr PgmName = "SendOp"
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Specifies, in relation to the scantime of the thread, how
! often the module is handled. If ScanInterval i 1, the module
! is handled every scan. If ScanInterval is for example 10, it
! is handled every 10'th scan, i.e. the scantime for the module
! will be ScanInterval times the scantime of the thread.
!*/
Object ScanInterval $Attribute 21 17-OCT-2011 08:03:36.21
Body SysBody 17-OCT-2011 08:03:36.21
Attr PgmName = "ScanInterval"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
Object Template Modbus_ModuleMsg 2155053056 01-JAN-1970 01:00:00.00
Body RtBody 01-JAN-1970 01:00:00.00
EndBody
EndObject
EndObject
!/**
! @Version 1.0
! @Group IO
! @Summary Module object for Modbus TCP I/O for both read and write.
! Module object for Modbus TCP I/O for both read and write.
!
! This module object makes it possible to specify one function code for reading,
! and one for writing. This is useful when creating IO module objects for
! components where both inputs and outputs are present.
!
! @b See also
! @classlink Modbus_ModuleMsg otherio_modbus_modulemsg.html
! @classlink Modbus_Module otherio_modbus_module.html
Object Modbus_ModuleReadWrite $ClassDef 27 17-OCT-2011 07:54:13.97
Body SysBody 17-OCT-2011 07:54:45.40
Attr Editor = 0
Attr Method = 0
Attr Flags = 18512
EndBody
Object RtBody $ObjBodyDef 1 17-OCT-2011 07:56:53.34
Body SysBody 17-OCT-2011 07:56:53.34
Attr StructName = "Modbus_ModuleReadWrite"
Attr NextAix = "_X6"
EndBody
!/**
! Description of module
!*/
Object Description $Attribute 3 17-OCT-2011 08:05:42.00
Body SysBody 17-OCT-2011 08:05:42.00
Attr PgmName = "Description"
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! @Summary Process that handles the card. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the card.
!
! 1: The card is read by the plc process, and is handled by a specific
! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The card is read by the rt_io_comm process.
! 4: The card is handled by an application program.
!*/
Object Process $Attribute 4 17-OCT-2011 08:06:12.09
Body SysBody 17-OCT-2011 08:06:12.09
Attr PgmName = "Process"
Attr TypeRef = "pwrb:Type-IoProcessMask"
EndBody
EndObject
!/**
! @Summary Plc thread that handles the module.
! The PlcThread object of the plc thread that handles the module.
! The module is handled with the scantime of the thread.
!*/
Object ThreadObject $Attribute 5 17-OCT-2011 08:06:12.09
Body SysBody 17-OCT-2011 08:06:12.09
Attr PgmName = "ThreadObject"
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
!/**
! Specification of the read message.
!*/
Object Read $Attribute 1 17-OCT-2011 07:57:03.88
Body SysBody 17-OCT-2011 08:05:22.17
Attr PgmName = "Read"
Attr Flags = 131072
Attr TypeRef = "OtherIO:Class-Modbus_ModuleMsg"
EndBody
EndObject
!/**
! Specification of the write message.
!*/
Object Write $Attribute 2 17-OCT-2011 07:57:26.66
Body SysBody 17-OCT-2011 08:05:27.68
Attr PgmName = "Write"
Attr Flags = 131072
Attr TypeRef = "OtherIO:Class-Modbus_ModuleMsg"
EndBody
EndObject
EndObject
Object IoMethods $RtMethod 262 17-OCT-2011 10:49:49.90
Object IoCardInit $Method 263 17-OCT-2011 10:49:49.90
Body SysBody 17-OCT-2011 10:50:06.54
Attr MethodName = "Modbus_ModuleReadWrite-IoCardInit"
EndBody
EndObject
Object IoCardRead $Method 264 17-OCT-2011 10:49:49.90
Body SysBody 17-OCT-2011 10:50:17.58
Attr MethodName = "Modbus_ModuleReadWrite-IoCardRead"
EndBody
EndObject
Object IoCardWrite $Method 265 17-OCT-2011 10:49:49.90
Body SysBody 17-OCT-2011 10:50:28.69
Attr MethodName = "Modbus_ModuleReadWrite-IoCardWrite"
EndBody
EndObject
EndObject
Object PostCreate $DbCallBack 267 17-OCT-2011 16:58:28.81
Body SysBody 17-OCT-2011 16:58:28.81
Attr MethodName = "BaseIOCard-PostCreate"
EndBody
EndObject
Object Template Modbus_ModuleReadWrite 2154790912 01-JAN-1970 01:00:00.00
Body RtBody 17-OCT-2011 08:07:19.24
Attr Process = 1
Attr Read.Continous = 1
Attr Read.ScanInterval = 1
Attr Write.Continous = 1
Attr Write.ScanInterval = 1
EndBody
EndObject
EndObject
......@@ -1284,10 +1510,10 @@ Volume OtherIO $ClassVolume 0.0.250.10
! @classlink Modbus_TPC_Slave otherio_modbus_tcp_slave.html
!*/
Object Modbus_Master $ClassDef 5 01-SEP-2008 10:52:09.59
Body SysBody 03-SEP-2008 16:03:48.36
Body SysBody 17-OCT-2011 07:55:00.34
Attr Editor = 0
Attr Method = 0
Attr Flags = 36944
Attr Flags = 38992
EndBody
Object RtBody $ObjBodyDef 1 01-SEP-2008 10:54:17.57
Body SysBody 01-SEP-2008 10:54:17.57
......@@ -1386,10 +1612,10 @@ Volume OtherIO $ClassVolume 0.0.250.10
! @classlink Modbus_TCP_ServerModule otherio_modbus_tcp_servermodule.html
!*/
Object Modbus_TCP_Server $ClassDef 6 25-NOV-2009 10:32:40.64
Body SysBody 25-NOV-2009 10:30:31.66
Body SysBody 17-OCT-2011 07:56:15.58
Attr Editor = 0
Attr Method = 0
Attr Flags = 41040
Attr Flags = 43088
EndBody
Object RtBody $ObjBodyDef 1 25-NOV-2009 10:30:31.66
Body SysBody 25-NOV-2009 10:32:51.18
......@@ -1597,10 +1823,10 @@ Volume OtherIO $ClassVolume 0.0.250.10
! @classlink Modbus_TCP_Server otherio_modbus_tcp_server.html
!*/
Object Modbus_TCP_ServerModule $ClassDef 7 25-NOV-2009 11:05:45.82
Body SysBody 25-NOV-2009 11:05:23.49
Body SysBody 17-OCT-2011 07:56:22.47
Attr Editor = 0
Attr Method = 0
Attr Flags = 49232
Attr Flags = 51280
EndBody
Object RtBody $ObjBodyDef 1 25-NOV-2009 11:05:23.49
Body SysBody 25-NOV-2009 11:06:00.66
......
......@@ -142,7 +142,8 @@ static pwr_tStatus PostCreate( ldh_tSesContext Session,
if ( !repr_set) {
wb_cdef father_cdef = sp->cdef(Class);
if ( strcmp( father_cdef.name(), "Modbus_TCP_ServerModule") == 0 ||
strcmp( father_cdef.name(), "Modbus_Module") == 0) {
strcmp( father_cdef.name(), "Modbus_Module") == 0 ||
strcmp( father_cdef.name(), "Modbus_ModuleReadWrite") == 0) {
wb_attribute a = sp->attribute( Object, "RtBody", "Representation");
if ( !a) return a.sts();
......
......@@ -104,7 +104,8 @@ static pwr_tStatus PostCreate( ldh_tSesContext Session,
if ( !repr_set) {
wb_cdef father_cdef = sp->cdef(Class);
if ( strcmp( father_cdef.name(), "Modbus_TCP_ServerModule") == 0 ||
strcmp( father_cdef.name(), "Modbus_Module") == 0) {
strcmp( father_cdef.name(), "Modbus_Module") == 0 ||
strcmp( father_cdef.name(), "Modbus_ModuleReadWrite") == 0) {
wb_attribute a = sp->attribute( Object, "RtBody", "Representation");
if ( !a) return a.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