You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Christofer Dutz <ch...@c-ware.de> on 2022/11/22 15:43:32 UTC

[DISCUSS] Make the PlcConnection return PlcFieldHandler and PlcValueHandler instances?

Hi all,

till now we always created the PlcFieldHandler and PlcValueHandlers in the Driver code statically.

Now with the updated ADS driver we have some completely new possibilities:

  *   We can check if a tag exists before executing the query
  *   We can check the type and structure of values we want to write before sending them to the PLC
  *   We can start using some fancy array notation which we can validate the query before sending the request.

The only problem I currently have, it that the FieldHandler and ValueHandler are both created detached from the Connection, where the information is present.

So, I would like to change that the Connection is responsible of creating the PlcValueHandler and PlcValueHandler.


With this we could even do crazy stuff like:

  *   In S7 give an error warning if the type of S7 doesn’t support the datatype, that the user wanted to use?
  *   Possibly rewrite fields, if we’re using an incompatible S7 type (Like if I’m on a S7-1200 and want to read a LINT, which the 1200 doesn’t support), then we could replace this with a 2-element array of DINT and still support datatypes the device itself doesn’t.
  *   We could provide an error if someone wants to use the S7 driver subscription API with a PLC, that doesn’t support that.
  *   … I probably could go on forever ;-)


What do you folks think?


Chris

Re: [DISCUSS] Make the PlcConnection return PlcFieldHandler and PlcValueHandler instances?

Posted by Lukas Ott <ot...@gmail.com>.
Nice job Sebastian and Christofer! Awesome work! :-)

Am Di., 22. Nov. 2022 um 19:48 Uhr schrieb Christofer Dutz <
christofer.dutz@c-ware.de>:

> Hi all,
>
> So, thanks to Sebastian’s great work on the Go SPI, making the ADS driver
> use context aware TagHandlers and ValueHandlers, was super easy.
> And regarding my last email … I’ve simply provided two Constructors … one
> that takes a DriverContext and one that doesn’t. It the TagHandler doesn’t
> have the DriverContext, it just does a statical structural check and if
> it’s there if will add all of the cool stuff, we now have at our disposal.
>
> Chris
>
>
> From: Christofer Dutz <ch...@c-ware.de>
> Date: Tuesday, 22. November 2022 at 19:10
> To: dev@plc4x.apache.org <de...@plc4x.apache.org>
> Subject: Re: [DISCUSS] Make the PlcConnection return PlcFieldHandler and
> PlcValueHandler instances?
> Hi all,
>
> I just noticed a “CheckTagAddress” function in PLC4Go’s PlcDriver type.
> So if we provide address checking beyond the normal static checks, we
> can’t really check the dynamic stuff on the PlcDriver level.
>
> Chris
>
>
> From: Christofer Dutz <ch...@c-ware.de>
> Date: Tuesday, 22. November 2022 at 16:44
> To: dev@plc4x.apache.org <de...@plc4x.apache.org>
> Subject: [DISCUSS] Make the PlcConnection return PlcFieldHandler and
> PlcValueHandler instances?
> Hi all,
>
> till now we always created the PlcFieldHandler and PlcValueHandlers in the
> Driver code statically.
>
> Now with the updated ADS driver we have some completely new possibilities:
>
>   *   We can check if a tag exists before executing the query
>   *   We can check the type and structure of values we want to write
> before sending them to the PLC
>   *   We can start using some fancy array notation which we can validate
> the query before sending the request.
>
> The only problem I currently have, it that the FieldHandler and
> ValueHandler are both created detached from the Connection, where the
> information is present.
>
> So, I would like to change that the Connection is responsible of creating
> the PlcValueHandler and PlcValueHandler.
>
>
> With this we could even do crazy stuff like:
>
>   *   In S7 give an error warning if the type of S7 doesn’t support the
> datatype, that the user wanted to use?
>   *   Possibly rewrite fields, if we’re using an incompatible S7 type
> (Like if I’m on a S7-1200 and want to read a LINT, which the 1200 doesn’t
> support), then we could replace this with a 2-element array of DINT and
> still support datatypes the device itself doesn’t.
>   *   We could provide an error if someone wants to use the S7 driver
> subscription API with a PLC, that doesn’t support that.
>   *   … I probably could go on forever ;-)
>
>
> What do you folks think?
>
>
> Chris
>

Re: [DISCUSS] Make the PlcConnection return PlcFieldHandler and PlcValueHandler instances?

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi all,

So, thanks to Sebastian’s great work on the Go SPI, making the ADS driver use context aware TagHandlers and ValueHandlers, was super easy.
And regarding my last email … I’ve simply provided two Constructors … one that takes a DriverContext and one that doesn’t. It the TagHandler doesn’t have the DriverContext, it just does a statical structural check and if it’s there if will add all of the cool stuff, we now have at our disposal.

Chris


From: Christofer Dutz <ch...@c-ware.de>
Date: Tuesday, 22. November 2022 at 19:10
To: dev@plc4x.apache.org <de...@plc4x.apache.org>
Subject: Re: [DISCUSS] Make the PlcConnection return PlcFieldHandler and PlcValueHandler instances?
Hi all,

I just noticed a “CheckTagAddress” function in PLC4Go’s PlcDriver type.
So if we provide address checking beyond the normal static checks, we can’t really check the dynamic stuff on the PlcDriver level.

Chris


From: Christofer Dutz <ch...@c-ware.de>
Date: Tuesday, 22. November 2022 at 16:44
To: dev@plc4x.apache.org <de...@plc4x.apache.org>
Subject: [DISCUSS] Make the PlcConnection return PlcFieldHandler and PlcValueHandler instances?
Hi all,

till now we always created the PlcFieldHandler and PlcValueHandlers in the Driver code statically.

Now with the updated ADS driver we have some completely new possibilities:

  *   We can check if a tag exists before executing the query
  *   We can check the type and structure of values we want to write before sending them to the PLC
  *   We can start using some fancy array notation which we can validate the query before sending the request.

The only problem I currently have, it that the FieldHandler and ValueHandler are both created detached from the Connection, where the information is present.

So, I would like to change that the Connection is responsible of creating the PlcValueHandler and PlcValueHandler.


With this we could even do crazy stuff like:

  *   In S7 give an error warning if the type of S7 doesn’t support the datatype, that the user wanted to use?
  *   Possibly rewrite fields, if we’re using an incompatible S7 type (Like if I’m on a S7-1200 and want to read a LINT, which the 1200 doesn’t support), then we could replace this with a 2-element array of DINT and still support datatypes the device itself doesn’t.
  *   We could provide an error if someone wants to use the S7 driver subscription API with a PLC, that doesn’t support that.
  *   … I probably could go on forever ;-)


What do you folks think?


Chris

Re: [DISCUSS] Make the PlcConnection return PlcFieldHandler and PlcValueHandler instances?

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi all,

I just noticed a “CheckTagAddress” function in PLC4Go’s PlcDriver type.
So if we provide address checking beyond the normal static checks, we can’t really check the dynamic stuff on the PlcDriver level.

Chris


From: Christofer Dutz <ch...@c-ware.de>
Date: Tuesday, 22. November 2022 at 16:44
To: dev@plc4x.apache.org <de...@plc4x.apache.org>
Subject: [DISCUSS] Make the PlcConnection return PlcFieldHandler and PlcValueHandler instances?
Hi all,

till now we always created the PlcFieldHandler and PlcValueHandlers in the Driver code statically.

Now with the updated ADS driver we have some completely new possibilities:

  *   We can check if a tag exists before executing the query
  *   We can check the type and structure of values we want to write before sending them to the PLC
  *   We can start using some fancy array notation which we can validate the query before sending the request.

The only problem I currently have, it that the FieldHandler and ValueHandler are both created detached from the Connection, where the information is present.

So, I would like to change that the Connection is responsible of creating the PlcValueHandler and PlcValueHandler.


With this we could even do crazy stuff like:

  *   In S7 give an error warning if the type of S7 doesn’t support the datatype, that the user wanted to use?
  *   Possibly rewrite fields, if we’re using an incompatible S7 type (Like if I’m on a S7-1200 and want to read a LINT, which the 1200 doesn’t support), then we could replace this with a 2-element array of DINT and still support datatypes the device itself doesn’t.
  *   We could provide an error if someone wants to use the S7 driver subscription API with a PLC, that doesn’t support that.
  *   … I probably could go on forever ;-)


What do you folks think?


Chris