Re: Anyone here experience with Emerson DeltaV communication?

2018-06-11 Thread Niclas Hedhman
--- a.txt2018-06-12 11:47:24.0 +0800
+++ b.txt2018-06-12 11:47:37.0 +0800
@@ -11,7 +11,7 @@

 But for now … done enough hex-dump-reading for today …

-#ifdef PLC
+#ifndef PLC
 #define PLC = Plenty of Lovely Craftbeer
 #endif



On Sat, Jun 9, 2018 at 12:00 AM, Christofer Dutz 
wrote:

> Hi all,
>
> today I had a very interesting appointment with a large pharmaceutical
> company which are planning on giving PLC4X a try. If this works this would
> be a huge thing for our project as well as that company.
> After discussing multiple options of safely communicating PLC data from
> inside the production-network to a less safe network, we started
> investigating the protocols going over the wire.
>
> The controllers used are Emerson DeltaV MV Controllers and they
> communicate with a matching Emerson OS (Operator-System … not OperatING
> System) … for me this is sort of a Emerson SCADA System.
>
> What directly popped my eye was that all communication is done using UDP
> on port 18507 and every packet sent starts with the first two bytes “0xFA”
> and “0xCE” … “FACE” … I couldn’t find any mention of a protocol name and
> hereby no spec or whatsoever information. Right now I’m doing a manual
> pattern detection in my WireShark recording and will definitely start
> automating that to prove my assumptions.
>
> But I was hoping that someone here on the list might be able to provide
> some information and eventually give me the one or the other useful hint.
>
> But for now … done enough hex-dump-reading for today …
>
> #ifdef PLC
> #define PLC = Plenty of Lovely Craftbeer
> #endif
>
> Have a nice weekend :-)
>
> Chris
>



-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Master ? Slave? Both?

2017-12-30 Thread Niclas Hedhman
I am getting the impression that only "Master" side of these protocols are
in scope. Or?

In any case, I have previously made a C library for ModBus (from spec), and
I could see if it is worth dusting off and contribute. Is it of interest,
or? It might not be complete, and I recall it follows a OO-style of C
programming that not everyone appreciate.


Cheers
-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Master ? Slave? Both?

2017-12-31 Thread Niclas Hedhman
Alright... I also forgot that these protocols are now TCP/IP capable, and I
have no clue what that means. In the old serial comm world it was much
clearer.

Cheers
Niclas

On Sun, Dec 31, 2017 at 6:53 PM, Christofer Dutz <christofer.d...@c-ware.de>
wrote:

> Hi Niclas,
>
> well I wouldn’t say that we should do just Master. I guess right now
> development has been driven by the use case. And the probably most
> important use case for me was reading from an S7. One use case down the S7
> road that I would like to implement soon is that a client using PLC4X can
> subscribe for Alarm messages and Parameter values of a S7 PLC and that then
> actively sends data to PLC4X. Would that be called “slave”? If it is, I
> guess both are highly important, just haven’t got to the point of
> implementing that.
>
> Chris
>
>
>
> Am 31.12.17, 05:02 schrieb "hedh...@gmail.com im Auftrag von Niclas
> Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
>
> I am getting the impression that only "Master" side of these protocols
> are
> in scope. Or?
>
> In any case, I have previously made a C library for ModBus (from
> spec), and
> I could see if it is worth dusting off and contribute. Is it of
> interest,
> or? It might not be complete, and I recall it follows a OO-style of C
> programming that not everyone appreciate.
>
>
> Cheers
>     --
> Niclas Hedhman, Software Developer
> http://polygene.apache.org - New Energy for Java
>
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Serialport comms?

2018-02-12 Thread Niclas Hedhman
Hi,
I was thinking about converting some of my protocol implementations to
plc4x, but I have only worked in the serialport space, (e.g Modbus/RTU
rather than Modbus/TCP).

There is a ancient Java specification (Java Comms API), which is not only
literally from last millennium, but rather poor as well.

So, what choices do we have?

* GNU has an implementation, which is rather bad Java code and the C/native
side needed a bit tweaking last time I worked with it.

* The best implementation I know is commercial, but perhaps we can entice a
code donation and/or a Apache Licensed API. I'll investigate that one...

* Our own implementation from scratch, which kind of belongs in Apache APR,
at least the C/native part.


Cheers
-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Is Junit5 the way to go?

2018-02-10 Thread Niclas Hedhman
The difference between Junit4 and Junit5 are relatively minor from a user's
perspective. The real difference is when creating Runners for special need
systems, such as Spring

So, going with JUnit4 for now is not a bad thing...

But, it seems that there is some legacy that should be scrapped, because it
actually makes a difference.


Avoid the Assert.isEqual(), Assert.isTrue() and so on, and only use the
Hamcrest library for conditions, i.e. assertThat.
The benefit is that one can use (or make) much more complex tests, which
are otherwise ugly to write or report back what is expected.

assertThat( myInteger, equalTo( 15 ) );

assertThat( myCollection, hasItem( "Niclas" ));

assertThat( myCollection, hasItems( "Niclas", "Justin", "Chris" ));

Arbitrarily complex matchers can be made, and give a reasonable error
message when failing.


If I can find some time in the next couple of days, I will take a look and
propose changes...


On Feb 9, 2018 16:35, "Justin Mclean"  wrote:

> Hi,
>
> > thanks for finding that ... guess when porting all these thousands of
> statements, I must have missed one or two "replace: ' == ' with
> ').isEqualTo('” __
>
> Yep I can imaging my brain zoning out when doing that :-)
>
> > Well the main reason was probably, that I wanted to replace the
> "assertTrue(A==B)" with something like "assertEqual(A, B)" as this outputs
> the "expected" and the actual "value" and hereby provides a little more
> information than a simple "was false". So I had the option of converting it
> to JUint "Assert.assertEquals" or update it to AssertJ's
> "Assertions.assertThat().isEqualTo()" which I think is a little more
> readable
>
> You know that Junit4 also has a assertThat? It’s has a slightly different
> signature which what threw me when I first looked at the changes.
>
> Thanks,
> Justin


Re: Is Junit5 the way to go?

2018-02-11 Thread Niclas Hedhman
Personally, I find the AssertJ (and practically all other attempts at this)
less powerful and harder to work with, as the DSL is not necessarily
intuitive, well it isn't for me when writing it, although one can guess
what it means when reading it, but perhaps that is the case for Hamcrest
too for other people. Additionally, if you ONLY know JUnit4, then a subset
of Hamcrest is already included inside the JUnit jar file. In essence, both
AssertJ and Hamcrest was a "solution" to the older JUnit assertion
mechanism.

In AssertJ, there seems to be a "bias" towards creating your own Unit Test
Assertion classes, so that the tests reads more nicely. And in Hamcrest,
the "bias" is towards creating a ever-growing library of generic assertions
independent of the unit tests at hand. IMHO, the former can still be done
in Hamcrest, but I have not seen that, and I have also seldom seen anyone
creating their own AssertJ assertion classes.

Across the Java community, more people are comfortable with Hamcrest than
AssertJ, probably due to Junit's inclusion of some of it.

My recommendation is to use JUnit4 + Hamcrest library + creating PLC4X
specific Matchers (if needed).


I spent this morning changing the AssertJ to Hamcrest across all tests. You
want a PR?
https://github.com/niclash/incubator-plc4x/commit/2080c40c02249db5f5ec0cf0b37b0ea0524de922


Cheers
Niclas



On Sun, Feb 11, 2018 at 5:31 PM, Christofer Dutz <christofer.d...@c-ware.de>
wrote:

> Hi Nicolas,
>
> While I was at it, I press everything to junit 4 and migrated all junit
> Assert statements with assertj assertions. Do you have any opinion to these
> two options? Hamcrest vs. AssertJ?
>
> Chris
>
> Outlook for Android<https://aka.ms/ghei36> herunterladen
>
>
>
> Von: Niclas Hedhman
> Gesendet: Sonntag, 11. Februar, 05:17
> Betreff: Re: Is Junit5 the way to go?
> An: dev@plc4x.apache.org
>
>
> The difference between Junit4 and Junit5 are relatively minor from a
> user's perspective. The real difference is when creating Runners for
> special need systems, such as Spring So, going with JUnit4 for now is not a
> bad thing... But, it seems that there is some legacy that should be
> scrapped, because it actually makes a difference. Avoid the
> Assert.isEqual(), Assert.isTrue() and so on, and only use the Hamcrest
> library for conditions, i.e. assertThat. The benefit is that one can use
> (or make) much more complex tests, which are otherwise ugly to write or
> report back what is expected. assertThat( myInteger, equalTo( 15 ) );
> assertThat( myCollection, hasItem( "Niclas" )); assertThat( myCollection,
> hasItems( "Niclas", "Justin", "Chris" )); Arbitrarily complex matchers can
> be made, and give a reasonable error message when failing. If I can find
> some time in the next couple of days, I will take a look and propose
> changes... On Feb 9, 2018 16:35, "Justin Mclean" wrote: > Hi, > > > thanks
> for finding that ... guess when porting all these thousands of >
> statements, I must have missed one or two "replace: ' == ' with >
> ').isEqualTo('” __ > > Yep I can imaging my brain zoning out when doing
> that :-) > > > Well the main reason was probably, that I wanted to replace
> the > "assertTrue(A==B)" with something like "assertEqual(A, B)" as this
> outputs > the "expected" and the actual "value" and hereby provides a
> little more > information than a simple "was false". So I had the option of
> converting it > to JUint "Assert.assertEquals" or update it to AssertJ's >
> "Assertions.assertThat().isEqualTo()" which I think is a little more >
> readable > > You know that Junit4 also has a assertThat? It’s has a
> slightly different > signature which what threw me when I first looked at
> the changes. > > Thanks, > Justin
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Batch reads with JPA like annotation magic?

2018-02-19 Thread Niclas Hedhman
native to provide the address directly and give
> up on the flexibility to change the PLC-type / Protocol)
> >
> > Providing would definitely be the less preferred option, but I guess
> we would have to provide a way that is extremely simple for new developers
> to get started. I wouldn’t want to overwhelm them with too much magic in
> the start.
> >
> > The connection could be extended to look a (configurable) property
> file. A property property () would then use this property map in the
> connection to get the real address string for the given property - hereby
> keeping the full portability.
> >
> > Maybe it would be better to have two separate property annotations:
> one for property-based and one for hard-coded address strings.
> >
> > The benefit would be that we then could simplify the integrations to
> frameworks like Edgent as we could create sources and sinks based on the
> POJO type.
> >
> > What do you think?
> >
> > Chris
>
>
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Making your first release

2018-08-28 Thread Niclas Hedhman
I agree with Justin and Juliana and would suggest;  Spend some time to get
the release process automated and smooth, then start a 0.x release train,
with no compatibility guarantees.

On Sun, Aug 26, 2018 at 5:29 PM, Julian Feinauer <
j.feina...@pragmaticminds.de> wrote:

> Hi Justin,
>
>
>
> I like your suggestion and also wanted to suggest a first release soon as
> we start to experiment with plc4j a lot in one project and I don’t like to
> reference snapshots with the lot of changes going on (or are planned).
>
> What do the others think of this?
>
>
>
> Julian
>
>
>
> Am 26.08.18, 02:22 schrieb "Justin Mclean" :
>
>
>
> Hi,
>
>
>
> While looking through the incubator reports it’s come to my attention
> that this podling hasn’t made a release yet and has been in the incubator
> for 250+ days.  "Release early and release often” should be the guideline
> to follow. What is holding up this project making it first release?
> Remember a first release doesn’t have to be perfect and each release just
> needs to be better than the last.
>
>
>
> Thanks,
>
> Justin
>
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Creating a Kafka Stream connector for PLC4X?

2018-03-12 Thread Niclas Hedhman
I have some Kafka experience, but not used Kafka Streams. But I think the
most straight forward approach would still be to have a Kafka Producer on
the PLC4X side simply writing to one or more Kafka topics, which is
relatively simple.

You need to 'configure' during the instance creation;

Properties properties = new Properties();
properties.put( ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, cli.kafka );
properties.put( ProducerConfig.LINGER_MS_CONFIG, 1 );
properties.put( ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
StringSerializer.class.getName() );
properties.put( ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
StringSerializer.class.getName() );
KafkaProducer<String, String> producer = new KafkaProducer<>( properties );

And once you have the producer, you can push a message to the topic with or
without a key, like this;

producer.send( new ProducerRecord<>( "your-topic", value ) );



I am pretty sure Kafka Streams can take over from the topic queue.


Cheers
Niclas

On Mon, Mar 12, 2018 at 10:38 PM, Christofer Dutz <christofer.d...@c-ware.de
> wrote:

> Hi,
>
> last week I attended the Kafka meetup of a colleague of mine and in his
> talk he introduced Kafka Streams and to me it sounded like a „Clustered
> Edgent“.
>
> My second thought was: would it not be cool to implement such a Kafka
> Stream Connector?
>
> Anyone here got the knowhow to do that? Shouldn’t be that difficult.
>
> Chris
>



-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Creating a Kafka Stream connector for PLC4X?

2018-03-13 Thread Niclas Hedhman
Sorry, don't know what that is or what it really is, compared to what I
wrote...

On Tue, Mar 13, 2018 at 8:50 PM, Christofer Dutz <christofer.d...@c-ware.de>
wrote:

> Argh ... I wanted to propose a Kafka Connect and not a Kafka Steam adapter
> ( ...
>
> By the way my currently most used setup is actually using PLC4X for PLC
> communication and using Edgents Kafka Connector to publish to Kafka.
>
> A Kafka Connect adapter would allow to directly connect it to Kafka.
>
> Chris
>
>
> Am 13.03.18, 00:02 schrieb "hedh...@gmail.com im Auftrag von Niclas
> Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
>
> I have some Kafka experience, but not used Kafka Streams. But I think
> the
> most straight forward approach would still be to have a Kafka Producer
> on
> the PLC4X side simply writing to one or more Kafka topics, which is
> relatively simple.
>
> You need to 'configure' during the instance creation;
>
> Properties properties = new Properties();
> properties.put( ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, cli.kafka );
> properties.put( ProducerConfig.LINGER_MS_CONFIG, 1 );
> properties.put( ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
> StringSerializer.class.getName() );
> properties.put( ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
> StringSerializer.class.getName() );
> KafkaProducer<String, String> producer = new KafkaProducer<>(
> properties );
>
> And once you have the producer, you can push a message to the topic
> with or
> without a key, like this;
>
> producer.send( new ProducerRecord<>( "your-topic", value ) );
>
>
>
> I am pretty sure Kafka Streams can take over from the topic queue.
>
>
> Cheers
> Niclas
>
> On Mon, Mar 12, 2018 at 10:38 PM, Christofer Dutz <
> christofer.d...@c-ware.de
> > wrote:
>
> > Hi,
> >
> > last week I attended the Kafka meetup of a colleague of mine and in
> his
> > talk he introduced Kafka Streams and to me it sounded like a
> „Clustered
> > Edgent“.
> >
> > My second thought was: would it not be cool to implement such a Kafka
>     > Stream Connector?
> >
> > Anyone here got the knowhow to do that? Shouldn’t be that difficult.
> >
> > Chris
> >
>
>
>
> --
> Niclas Hedhman, Software Developer
> http://polygene.apache.org - New Energy for Java
>
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Creating a Kafka Stream connector for PLC4X?

2018-03-23 Thread Niclas Hedhman
Kafka Connect is the ability to run a "source" and/or "sink" of streaming
data on the Kafka instance itself. It defines the APIs so people can
include the component (and its configuration) from the command-line. Part
of the Kafka Connect component are Key and Value serialization, and in
Kafka Connect itself, one can apply additional transformations of those
messages.

For PLC4X,

I would imagine that the Source Connector would be configurable with a long
list of data points to be scanned, possibly with some conditions,
priorities and other algorithms to decide what/when to be scanned, at what
interval and which topic is the destination. Of course PLC4X configuration
of protocols would also be needed.

The Sink Connector would read from N topics, and the message would contain
what values to be written to where. It should be enough to do this
on-demand.

I have not figured out how the Source Connector will distributed the work
load in the cluster. One would assume that there is some mechanism in
place, otherwise the ETL (Extract Load Transform) use case would not work,
and ETL seems to be a major case for Kafka Connect.


My conclusion; I think this is a great idea, and that we should aim for
implementing. However, I think it is more important to have more protocols
in place first, so that the PLC4X abstraction is tuned for disparate types
of systems, before attempting to apply another abstraction onto PLC4X API.
And for that, I think we need to increase the number of hands (my own
included) to help out, which requires that the people with the vision and
understanding of the details, need to work more on documentation and less
on exotic integration. I think it is the most urgent issue in this project.


Cheers
Niclas


On Thu, Mar 22, 2018 at 5:58 PM, Niclas Hedhman <nic...@hedhman.org> wrote:

>
> Chris,
> I came across a presentation by coincidence that mentioned "Kafka
> Connect", so I will research this over the weekend and see what it is, and
> how it fits with PLC4X. The presenter only mentioned that a "Kafka Connect"
> component is enable by configuration (in Kafka was implied but not sure)
> rather than programming.
>
> More next week.
> Niclas
>
> On Wed, Mar 21, 2018 at 5:19 PM, Niclas Hedhman <nic...@hedhman.org>
> wrote:
>
>>
>> Alright... So to repeat (and I think you get this much)... Kafka is in
>> principle very simple; Put any byte array into a topic in one end, and
>> readers can get that byte array from that topic somewhere else. Just a
>> simple message queue, at an abstract level. And the Kafka client libraries
>> for doing this is dead easy to use, producer.send() and consumer.poll()
>> respectively.
>>
>> So, I suspect that you are talking about some higher level than base
>> Kafka, possibly masquerading the Kafka transport as some other transport
>> abstraction or a component implementing some protocol, such as MQTT [1],
>> that behind the end point feeds Kafka. But I could be completely off-track
>> and some really clever ideas are at play here, that I don't realize yet.
>> So, yes, please invite people to discuss further.
>>
>> Niclas
>>
>> [1] MQTT feeding Kafka is something I will implement myself in the not
>> too distant future
>>
>> On Wed, Mar 21, 2018 at 4:50 PM, Christofer Dutz <
>> christofer.d...@c-ware.de> wrote:
>>
>>> Hi Niclas,
>>>
>>> have to admit I don't know in detail either ... it was part of a talk a
>>> colleague of mine held at a Kafka meetup in our office. Also I'm not into
>>> Kafka half as deep as you ... from a user point of view it looked as if
>>> such a Kafka Connect adapter would be a good idea. I'm trying to convince
>>> that colleague to contribute ... perhaps he could register here and shed
>>> some light on the topic ... I'll continue the convincing (even if another
>>> codecentric participant wouldn't increase company diversity)
>>>
>>> Chris
>>>
>>>
>>> Am 13.03.18, 16:41 schrieb "hedh...@gmail.com im Auftrag von Niclas
>>> Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
>>>
>>> Sorry, don't know what that is or what it really is, compared to
>>> what I
>>> wrote...
>>>
>>> On Tue, Mar 13, 2018 at 8:50 PM, Christofer Dutz <
>>> christofer.d...@c-ware.de>
>>> wrote:
>>>
>>> > Argh ... I wanted to propose a Kafka Connect and not a Kafka Steam
>>> adapter
>>> > ( ...
>>> >
>>> > By the way my currently most used setup is actually using PLC4X
>>> for PLC
>>>   

Re: [DRAFT] March Podling Report PLC4X

2018-04-03 Thread Niclas Hedhman
ir own maturity?
>
> We have a mix of new participants and experienced Apache people involved.
> So far, the new participants have shown great willingness and success in
> adopting the Apache Way.
> However, we still need to continue:
> the on-boarding
> increasing the diversity of the team
> Also, will we need to decide and establish all the processes involved in
> releasing software at Apache
>
>
>
>
> Am 31.03.18, 05:25 schrieb "hedh...@gmail.com im Auftrag von Niclas
> Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
>
> IMHO, it is a bit long and details more than the Board needs to know.
>
> In general, there is a tendency to not want to see company names
> splurted
> around, and perhaps all the PLC4X-specific terms could be shortened
> into
> generic technical language, and shortened.
>
> Cheers
> Niclas
>
> On Sat, Mar 31, 2018 at 3:09 AM, Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Ok … a little earlier than expected … please comment :-)
> >
> > Chris
> >
> > 
> > ---
> >
> > Apache PLC4X (incubating)
> >
> >
> > PLC4X is a set of libraries for communicating with industrial
> programmable
> > logic controllers (PLCs) using a variety of protocols but with a
> shared API.
> >
> >
> > Most important issues to address while moving towards graduation:
> >
> > Building the community: The PPMC and committer group has a large
> > percentage of codecentric employees, we have been recruiting people
> from
> > other companies, but will have to continue these efforts for
> establishing a
> > healthy Apache community.
> > Onboarding of new committers: With PLC4X several people on the team
> are
> > not very familiar with the Apache Way. We have started and will
> continue
> > our efforts on this onboarding.
> > Make our first release
> >
> > Any Issues the Incubator PMC or ASF Board might wish/need to be
> aware of:
> >
> > In contrast to previous reports some of the concerns regarding
> > availability and usability of specifications have been resolved.
> Especially
> > for using the Modbus and the OPC-UA specifications Christofer was
> able to
> > get official permissions from the corresponding foundations to use
> the
> > specifications. These permission Emails have been filed in the
> private list
> > for documentation.
> >
> > One of the external foundations (Profinet) doesn’t have a free
> membership.
> > In general, the CEO of the European branch of the Profinet
> Foundation has
> > signaled that it should be possible for the ASF to become a member
> and have
> > an outside company pay the membership fees, but we have to discuss
> the
> > details (With them as well as the ASF).
> >
> > How has the community developed since the last report?
> >
> > Christofer has invested most of his time in March spreading the word
> about
> > PLC4X.
> > A first POC has been created for the company “Kampf Schneid- und
> > Wickeltechnik GmbH & Co. KG” which is currently going into production
> > An article about Apache Edgent and Apache PLC4X has been published
> as a
> > cover-story in the German JavaSPEKTRUM magazines Industrial IoT
> special
> > edition (https://www.sigs-datacom.de/digital/javaspektrum/). One
> PLC4X
> > talk has been accepted to the Apache EU Roadshow 2018 in Berlin and
> one
> > will be at the Silpion Techcamp in Hamburg (
> https://techcamp.hamburg/) in
> > the first April week.
> >
> > The dev-list subscriptions has gone up by one from February, we are
> hoping
> > to increase the number in the next few weeks (However quite some
> emails
> > come in from un-registered users that have to pass moderation).
> >
> > We now have a Twitter account: https://twitter.com/ApachePlc4x as
> another
> > channel of communicating interesting PLC4X facts.
> >
> > How has the project developed since the last report?
> >
> > Sebastian worked hard on replacing the scripted Jenkins pipeline
> > definition to a declarative version.
> > After receiving the permission to use and implement the Modbus
> protocol,
> > the Driver skeletons

Re: [DRAFT] March Podling Report PLC4X

2018-04-04 Thread Niclas Hedhman
I don't think you need Mentor to do it. I have added it...

I see Justin being Mentor, so _should_ be easy to get a sign-off.

On Wed, Apr 4, 2018 at 1:23 PM, Christofer Dutz <christofer.d...@c-ware.de>
wrote:

> Hi Niclas,
>
> I'll keep that in mind for the next report, could one of the mentors
> please add the report for me (I think this has to be a mentor)
>
> Chris
>
> Outlook for Android<https://aka.ms/ghei36> herunterladen
>
> 
> From: hedh...@gmail.com <hedh...@gmail.com> on behalf of Niclas Hedhman <
> nic...@hedhman.org>
> Sent: Wednesday, April 4, 2018 2:09:07 AM
> To: dev@plc4x.apache.org
> Subject: Re: [DRAFT] March Podling Report PLC4X
>
> I think it is still a lot more detail than needed, but I don't think you
> need to spend more time on making it smaller this time around. Maybe the
> Incubator is more fuzzy than the Board, since "How has the project
> developed since the last report?" invites a lot more technical detail than
> what the Board care about, which is "community health", "are people getting
> along", "are releases made", "any new committers and PMC members", "any
> trademark issues with 3rd parties", "publicity and conferences" and stuff
> like that.
>
> If you look at TLP reports, e.g.
> https://www.apache.org/foundation/records/minutes/
> 2018/board_minutes_2018_02_21.txt,
> you should notice that mostly non-technical stuff gets to the board.
>
>
> Cheers
> NIclas
>
> On Tue, Apr 3, 2018 at 3:22 PM, Christofer Dutz <christofer.d...@c-ware.de
> >
> wrote:
>
> > Ok ... so here a little less verbose version ... this ok?
> >
> > Chris
> >
> > 
> > ---
> >
> > Apache PLC4X (incubating)
> >
> >
> > PLC4X is a set of libraries for communicating with industrial
> programmable
> > logic controllers (PLCs) using a variety of protocols but with a shared
> API.
> >
> >
> > Most important issues to address while moving towards graduation:
> >
> > Building the community: The PPMC and committer group has a large
> > percentage of codecentric employees, we have been recruiting people from
> > other companies, but will have to continue these efforts for
> establishing a
> > healthy Apache community.
> > Onboarding of new committers: With PLC4X several people on the team are
> > not very familiar with the Apache Way. We have started and will continue
> > our efforts on this onboarding.
> > Make our first release
> >
> > Any Issues the Incubator PMC or ASF Board might wish/need to be aware of:
> >
> > In contrast to previous reports some of the concerns regarding
> > availability and usability of specifications have been resolved.
> Especially
> > for using the Modbus and the OPC-UA specifications Christofer was able to
> > get official permissions from the corresponding foundations to use the
> > specifications. These permission Emails have been filed in the private
> list
> > for documentation.
> >
> > One of the external foundations (Profinet) doesn’t have a free
> membership.
> > In general, the CEO of the European branch of the Profinet Foundation has
> > signaled that it should be possible for the ASF to become a member and
> have
> > an outside company pay the membership fees, but we have to discuss the
> > details (With them as well as the ASF).
> >
> > How has the community developed since the last report?
> >
> > Christofer has invested most of his time in March spreading the word
> about
> > PLC4X.
> > A first POC has been created for a company which is currently going into
> > production
> > An article about Apache Edgent and Apache PLC4X has been published as a
> > cover-story in the German JavaSPEKTRUM magazines Industrial IoT special
> > edition (https://www.sigs-datacom.de/digital/javaspektrum/). One PLC4X
> > talk has been accepted to the Apache EU Roadshow 2018 in Berlin and one
> > will be at the Silpion Techcamp in Hamburg (https://techcamp.hamburg/)
> in
> > the first April week.
> >
> > The dev-list subscriptions has gone up by one from February, we are
> hoping
> > to increase the number in the next few weeks (However quite some emails
> > come in from un-registered users that have to pass moderation).
> >
> > We now have a Twitter account: https://twitter.com/ApachePlc4x as
> another
> > channel of communicating interesting PLC4X facts.
> >
> >

Re: Creating a Kafka Stream connector for PLC4X?

2018-03-22 Thread Niclas Hedhman
Chris,
I came across a presentation by coincidence that mentioned "Kafka Connect",
so I will research this over the weekend and see what it is, and how it
fits with PLC4X. The presenter only mentioned that a "Kafka Connect"
component is enable by configuration (in Kafka was implied but not sure)
rather than programming.

More next week.
Niclas

On Wed, Mar 21, 2018 at 5:19 PM, Niclas Hedhman <nic...@hedhman.org> wrote:

>
> Alright... So to repeat (and I think you get this much)... Kafka is in
> principle very simple; Put any byte array into a topic in one end, and
> readers can get that byte array from that topic somewhere else. Just a
> simple message queue, at an abstract level. And the Kafka client libraries
> for doing this is dead easy to use, producer.send() and consumer.poll()
> respectively.
>
> So, I suspect that you are talking about some higher level than base
> Kafka, possibly masquerading the Kafka transport as some other transport
> abstraction or a component implementing some protocol, such as MQTT [1],
> that behind the end point feeds Kafka. But I could be completely off-track
> and some really clever ideas are at play here, that I don't realize yet.
> So, yes, please invite people to discuss further.
>
> Niclas
>
> [1] MQTT feeding Kafka is something I will implement myself in the not too
> distant future
>
> On Wed, Mar 21, 2018 at 4:50 PM, Christofer Dutz <
> christofer.d...@c-ware.de> wrote:
>
>> Hi Niclas,
>>
>> have to admit I don't know in detail either ... it was part of a talk a
>> colleague of mine held at a Kafka meetup in our office. Also I'm not into
>> Kafka half as deep as you ... from a user point of view it looked as if
>> such a Kafka Connect adapter would be a good idea. I'm trying to convince
>> that colleague to contribute ... perhaps he could register here and shed
>> some light on the topic ... I'll continue the convincing (even if another
>> codecentric participant wouldn't increase company diversity)
>>
>> Chris
>>
>>
>> Am 13.03.18, 16:41 schrieb "hedh...@gmail.com im Auftrag von Niclas
>> Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
>>
>> Sorry, don't know what that is or what it really is, compared to what
>> I
>> wrote...
>>
>> On Tue, Mar 13, 2018 at 8:50 PM, Christofer Dutz <
>> christofer.d...@c-ware.de>
>> wrote:
>>
>> > Argh ... I wanted to propose a Kafka Connect and not a Kafka Steam
>> adapter
>> > ( ...
>> >
>> > By the way my currently most used setup is actually using PLC4X for
>> PLC
>> > communication and using Edgents Kafka Connector to publish to Kafka.
>> >
>> > A Kafka Connect adapter would allow to directly connect it to Kafka.
>> >
>> > Chris
>> >
>> >
>> > Am 13.03.18, 00:02 schrieb "hedh...@gmail.com im Auftrag von Niclas
>> > Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
>> >
>> > I have some Kafka experience, but not used Kafka Streams. But I
>> think
>> > the
>> > most straight forward approach would still be to have a Kafka
>> Producer
>> > on
>> > the PLC4X side simply writing to one or more Kafka topics,
>> which is
>> > relatively simple.
>> >
>> > You need to 'configure' during the instance creation;
>> >
>> > Properties properties = new Properties();
>> > properties.put( ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
>> cli.kafka );
>> > properties.put( ProducerConfig.LINGER_MS_CONFIG, 1 );
>> > properties.put( ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
>> > StringSerializer.class.getName() );
>> > properties.put( ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
>> > StringSerializer.class.getName() );
>> > KafkaProducer<String, String> producer = new KafkaProducer<>(
>> > properties );
>> >
>> > And once you have the producer, you can push a message to the
>> topic
>> > with or
>> > without a key, like this;
>> >
>> > producer.send( new ProducerRecord<>( "your-topic", value ) );
>> >
>> >
>> >
>> > I am pretty sure Kafka Streams can take over from the topic
>

Re: Creating a Kafka Stream connector for PLC4X?

2018-03-21 Thread Niclas Hedhman
Alright... So to repeat (and I think you get this much)... Kafka is in
principle very simple; Put any byte array into a topic in one end, and
readers can get that byte array from that topic somewhere else. Just a
simple message queue, at an abstract level. And the Kafka client libraries
for doing this is dead easy to use, producer.send() and consumer.poll()
respectively.

So, I suspect that you are talking about some higher level than base Kafka,
possibly masquerading the Kafka transport as some other transport
abstraction or a component implementing some protocol, such as MQTT [1],
that behind the end point feeds Kafka. But I could be completely off-track
and some really clever ideas are at play here, that I don't realize yet.
So, yes, please invite people to discuss further.

Niclas

[1] MQTT feeding Kafka is something I will implement myself in the not too
distant future

On Wed, Mar 21, 2018 at 4:50 PM, Christofer Dutz <christofer.d...@c-ware.de>
wrote:

> Hi Niclas,
>
> have to admit I don't know in detail either ... it was part of a talk a
> colleague of mine held at a Kafka meetup in our office. Also I'm not into
> Kafka half as deep as you ... from a user point of view it looked as if
> such a Kafka Connect adapter would be a good idea. I'm trying to convince
> that colleague to contribute ... perhaps he could register here and shed
> some light on the topic ... I'll continue the convincing (even if another
> codecentric participant wouldn't increase company diversity)
>
> Chris
>
>
> Am 13.03.18, 16:41 schrieb "hedh...@gmail.com im Auftrag von Niclas
> Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
>
> Sorry, don't know what that is or what it really is, compared to what I
> wrote...
>
> On Tue, Mar 13, 2018 at 8:50 PM, Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Argh ... I wanted to propose a Kafka Connect and not a Kafka Steam
> adapter
> > ( ...
> >
> > By the way my currently most used setup is actually using PLC4X for
> PLC
> > communication and using Edgents Kafka Connector to publish to Kafka.
> >
> > A Kafka Connect adapter would allow to directly connect it to Kafka.
> >
> > Chris
> >
> >
> > Am 13.03.18, 00:02 schrieb "hedh...@gmail.com im Auftrag von Niclas
> > Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
> >
> > I have some Kafka experience, but not used Kafka Streams. But I
> think
> > the
> > most straight forward approach would still be to have a Kafka
> Producer
> > on
> > the PLC4X side simply writing to one or more Kafka topics, which
> is
> > relatively simple.
> >
> > You need to 'configure' during the instance creation;
> >
> > Properties properties = new Properties();
> > properties.put( ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
> cli.kafka );
> > properties.put( ProducerConfig.LINGER_MS_CONFIG, 1 );
> > properties.put( ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
> > StringSerializer.class.getName() );
> > properties.put( ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
> > StringSerializer.class.getName() );
> > KafkaProducer<String, String> producer = new KafkaProducer<>(
> > properties );
> >
> > And once you have the producer, you can push a message to the
> topic
> > with or
> > without a key, like this;
> >
> > producer.send( new ProducerRecord<>( "your-topic", value ) );
> >
> >
> >
> > I am pretty sure Kafka Streams can take over from the topic
> queue.
> >
> >
> > Cheers
> > Niclas
> >
> > On Mon, Mar 12, 2018 at 10:38 PM, Christofer Dutz <
> > christofer.d...@c-ware.de
> > > wrote:
> >
> > > Hi,
> > >
> > > last week I attended the Kafka meetup of a colleague of mine
> and in
> > his
> > > talk he introduced Kafka Streams and to me it sounded like a
> > „Clustered
> > > Edgent“.
> > >
> > > My second thought was: would it not be cool to implement such
> a Kafka
> > > Stream Connector?
> > >
> > > Anyone here got the knowhow to do that? Shouldn’t be that
> difficult.
> > >
> > > Chris
> > >
> >
> >
> >
> > --
> > Niclas Hedhman, Software Developer
> > http://polygene.apache.org - New Energy for Java
> >
> >
> >
>
>
> --
> Niclas Hedhman, Software Developer
> http://polygene.apache.org - New Energy for Java
>
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Batch reads with JPA like annotation magic?

2018-03-05 Thread Niclas Hedhman
Polygene is highly opinionated, for better and worse. Minimally, Polygene
requires to start a runtime, and that everything needed is declared
explicitly upfront at boot time. The minimal start code is something like;


public static void main( String[] args )
throws Exception
{
app = new SingletonAssembler( module -> {
module.transients( Boiler.class, Ahu.class, Fan.class )
  .withMixins( Plc4xBackingPropertyMixin.class );

module.services( Plc4xPollService.class )
  .withMixins( Plc4xModbusDriver.class );
:
:
} );
}


If one wants to implement additional behavior in the Boiler class, then you
create Mixin classes. Let's say we want to capture the temperature once an
hour.

@Mixins(HistoryMixin.class)
interface Boiler
{
@Plc4x( url="s7://..", period=6 )
Property temperature();

List temperatureHistory();
}

public abstract class HistoryMixin
implements Boiler, Scheduled
{
int maxHours = 24;

LinkedBlockingDeque history = new LinkedBlockingDeque<>();

@Override
public void tick()
{
Double value = temperature().get();
history.addLast(value);
while( history.size() > maxHours )
{
history.removeFirst();
}
}

@Override
public List temperatureHistory()
{
return new ArrayList<>( history );
}
}


Above, let's say that "Scheduled" is a service to allow something to get a
tick() upon some period/interval. What I want to draw attention to is that
the HistoryMixin is implementing only the method(s) it need to, and that
the Boiler interface can declare such permanent functionality as an
annotation, instead of as a start-up declaration in the assembly. The fact
that the Mixin is abstract is handled by the runtime and it will compose
all these individual (so called) fragments into a single object (we call it
a Composite) when you instantiate it from the builder.

It is a whole new different way of writing software. Some people love it,
and others have a hard time understanding how it can possibly work. Just
scratching the surface, and please read
https://hedhman.wordpress.com/2017/05/10/introducing-apache-polygene/ for a
larger introduction to the subject.


If you don't want to write the entire project in Polygene "style", you need
to either use the Spring library bridge (possibly need upgrade that one a
bit), where each Service in Polygene will show up as a Spring bean, or
leverage various points of external hooks for Polygene, such
importedServices.


Don't want to bore you too much.


My actual main point was that your suggestion/idea can quickly become quite
a large undertaking and detract from the primary focus that (I think) PLC4X
should have. And bringing up Polygene was more to show that what you
suggest can be done very easily already in Polygene, and all that work
wouldn't be needed.


Cheers
Niclas


On Tue, Mar 6, 2018 at 4:35 AM, Christofer Dutz <christofer.d...@c-ware.de>
wrote:

> Hi Niclas,
>
> after recovering from that nasty Flu, that is plaguing Germany at the
> moment, I am working on catching up on what I missed.
> I tried to follow, but some things I felt to worn out to work my head
> around.
>
> Could you elaborate a little on Ploygene? How would this allow extending
> our requests with additional magic? Does this work in a simple way: No need
> to configure plugins, code generation or learn some complex API? I would
> like to keep PLC4X as simple as possible, but as extendable as possible.
>
> So I'm always open for new ideas (
>
> Chris
>
>
>
> Am 20.02.18, 03:32 schrieb "hedh...@gmail.com im Auftrag von Niclas
> Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
>
> Being the Overlord of Magic that can be done in Java, I have some
> comments
> to make on this idea.
>
> 1. In principle what you suggest can already be done quite easily in
> Apache
> Polygene, by creating a "generic mixin" that overrides the generic
> PropertyMixin. Polygene is probably way more powerful than anything you
> could dream up here. Although Polygene has a strong JSON serialization
> and
> persistence "story", both fully pluggable, it does not use the Glasgow
> spec, a.k.a JavaBeans, a.k.a "getter/setter naming convention", which
> has
> been plaguing the Java community for 2 decades now.
> If I created a Plc4xBackingPropertyMixin, which I think would only
> take a
> few hours, maybe a couple of days, depending on how advance we want
> it, you
> would end up with;
>
>
>
>
> *public interface Boiler{*
>
> *@Plc4x( url="s7://..", period=5000, priority=low )*
>
>
> *Property running();*
&

Re: Batch reads with JPA like annotation magic?

2018-03-06 Thread Niclas Hedhman
Chris,
that is exactly my line of thought as well.

On Tue, Mar 6, 2018 at 4:43 PM, Christofer Dutz <christofer.d...@c-ware.de>
wrote:

> Hi Niclas,
>
> as far as I understood Polygene especially after your examples. I would be
> hesitant to use this per default in PLC4Xs core. It does seem to add quite
> a lot of complexity which I personally would like to avoid. I don't want to
> confuse potential users. Especially the ones peeking into our world from
> the Automation side of the industry. If we present them with something they
> can't immediately wrap their heads around, I doubt we will have much
> adoption from their side.
>
> However if it was possible to use Polygene to implement some "JPA for
> PLCs" like functionality, I think a dedicated integration module for this
> alongside examples would be a good way to go.
>
> What do you (all) think?
>
> Chris
>
>
>
>
> Am 06.03.18, 07:24 schrieb "hedh...@gmail.com im Auftrag von Niclas
> Hedhman" <hedh...@gmail.com im Auftrag von nic...@hedhman.org>:
>
> Polygene is highly opinionated, for better and worse. Minimally,
> Polygene
> requires to start a runtime, and that everything needed is declared
> explicitly upfront at boot time. The minimal start code is something
> like;
>
>
> public static void main( String[] args )
> throws Exception
> {
> app = new SingletonAssembler( module -> {
> module.transients( Boiler.class, Ahu.class, Fan.class )
>   .withMixins( Plc4xBackingPropertyMixin.class );
>
> module.services( Plc4xPollService.class )
>   .withMixins( Plc4xModbusDriver.class );
> :
> :
> } );
> }
>
>
> If one wants to implement additional behavior in the Boiler class,
> then you
> create Mixin classes. Let's say we want to capture the temperature
> once an
> hour.
>
> @Mixins(HistoryMixin.class)
> interface Boiler
> {
> @Plc4x( url="s7://..", period=6 )
> Property temperature();
>
> List temperatureHistory();
> }
>
> public abstract class HistoryMixin
> implements Boiler, Scheduled
> {
> int maxHours = 24;
>
> LinkedBlockingDeque history = new LinkedBlockingDeque<>();
>
> @Override
> public void tick()
> {
> Double value = temperature().get();
> history.addLast(value);
> while( history.size() > maxHours )
> {
> history.removeFirst();
> }
> }
>
> @Override
> public List temperatureHistory()
> {
> return new ArrayList<>( history );
> }
> }
>
>
> Above, let's say that "Scheduled" is a service to allow something to
> get a
> tick() upon some period/interval. What I want to draw attention to is
> that
> the HistoryMixin is implementing only the method(s) it need to, and
> that
> the Boiler interface can declare such permanent functionality as an
> annotation, instead of as a start-up declaration in the assembly. The
> fact
> that the Mixin is abstract is handled by the runtime and it will
> compose
> all these individual (so called) fragments into a single object (we
> call it
> a Composite) when you instantiate it from the builder.
>
> It is a whole new different way of writing software. Some people love
> it,
> and others have a hard time understanding how it can possibly work.
> Just
> scratching the surface, and please read
> https://hedhman.wordpress.com/2017/05/10/introducing-apache-polygene/
> for a
> larger introduction to the subject.
>
>
> If you don't want to write the entire project in Polygene "style", you
> need
> to either use the Spring library bridge (possibly need upgrade that
> one a
> bit), where each Service in Polygene will show up as a Spring bean, or
> leverage various points of external hooks for Polygene, such
> importedServices.
>
>
> Don't want to bore you too much.
>
>
> My actual main point was that your suggestion/idea can quickly become
> quite
> a large undertaking and detract from the primary focus that (I think)
> PLC4X
> should have. And bringing up Polygene was more to show that what you
> suggest can be done very easily already in Polygene, and all that work
> wouldn't be needed.
>
>
> Cheers
> Niclas
>
>
> On Tue, Mar 6, 2018 at 4:35 AM, Chris

Re: [WARNING] Please don't commit anything to `master` effective immediately

2018-11-18 Thread Niclas Hedhman
At Polygene we referred to this article;
http://nvie.com/posts/a-successful-git-branching-model/ and borrowed the
nice graphics to our page. The one on
http://plc4x.apache.org/developers/contributing.html is impossible for me
to see, probably because of colors and not enough contrast, but also too
small.


Cheers
Niclas

On Sun, Nov 18, 2018 at 4:20 PM Christofer Dutz 
wrote:

> Ok …
>
> So it seems the branch and version updates worked nicely.
> I just pushed some documentation update and this should be available in
> the website soon.
> I added some documentation to the Contributing page (started filling this
> with content: http://plc4x.apache.org/developers/contributing.html)
> And I added some documentation to the release documentation:
> http://plc4x.apache.org/developers/release.html
> But as I mentioned … could be a few minutes till the website is updated.
>
> Chris
>
> Von: Otto Fowler 
> Datum: Mittwoch, 14. November 2018 um 15:55
> An: "dev@plc4x.apache.org" , Christofer Dutz <
> christofer.d...@c-ware.de>
> Betreff: Re: [WARNING] Please don't commit anything to `master` effective
> immediately
>
> Have you written up something in confluence and in the root of the source
> dir that documents the branching strategy?
>
>
>
> On November 14, 2018 at 07:59:11, Christofer Dutz (
> christofer.d...@c-ware.de<mailto:christofer.d...@c-ware.de>) wrote:
> Hi all,
>
> I just thought I‘d post this as a reminder. I am currently in the process
> of creating the new `develop` branch and currently adjusting the build
> scripts do what they did for master for develop now.
>
> From now on, the only commits done to master should be the release manager
> merging the latest release version back to master after a successful
> release.
>
> Commits to master will cause a lot of problems from now on.
>
> Chris
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Exciting news for Apache comimtters

2019-05-31 Thread Niclas Hedhman
To clarify; The offer from Jetbrains refers to the "paid for" editions and
to be used for non-commercial, open source development ONLY. For other
uses, please use the "community editions" (where available) or subscribe to
the tool chain (which nowadays is a lot cheaper than it used to be).

To apply, go to https://www.jetbrains.com/community/opensource/ and to the
bottom of the page (Supporting the Apache Software Foundation)

Cheers
Niclas

On Fri, May 31, 2019 at 3:09 PM Christofer Dutz 
wrote:

> Hi all,
>
> As we are now supporting more and more languages, the question of IDEs for
> these Languages come up.
> I don’t know if you followed the latest announcements, but Jetbrains seem
> to have extended their offer to the ASF.
> In the past Apache Committers could request a free IntelliJ license from
> them. This seems to have been extended
> To the full toolbox. So now you could also use CLion for C++ and the
> Python IDE free of charge.
>
> If you’re interested, give me a ping and I’ll try to find out what you
> have to do to get that offer.
>
> Chris
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: [DriverGen] Major refactoring and great improvements

2019-05-29 Thread Niclas Hedhman
re now Language-(output)-modules which also are
> discovered similar to how we discover drivers in the classpath
>   *   The input modules generally provide only the spec
>   *   The output modules contain everything needed to produce
> output for a given language
>   *   In order to allow experimentation of the output variants the
> output modules contain everything needed to generate the output
>   *   My implementation of a language-template-java uses
> freemarker to generate output, but others could simply use other techniques
>
> So far I have a pojo template that will generate the POJO classes
> for the types in the spec.
> Right now I’m working on the little tool that will tell the output
> which Java type it should use for which spec type …
> but as soon as that’s done I’m looking forward to implementing the
> IO components.
>
> All of this is happening in the “feature/code-gen” branch … and
> all my code-generation related code is in sandbox/code-generation
>
> So far the update …
>
> Chris
>
>
>
>
>

-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: [ANNOUNCE] Björn Höper joins PLC4X PMC

2019-05-13 Thread Niclas Hedhman
Welcome, Björn, to Plc4x and (IIUIC) the Apache Software Foundation itself.

Niclas

On Mon, May 13, 2019 at 11:48 PM Julian Feinauer <
j.feina...@pragmaticminds.de> wrote:

> Hi all,
>
> I am pleased to announce that Björn Höper has accepted an invitation to
> join the PLC4X PMC.
> Although Björn is not so long with the Project yet, he has shown a lot of
> energy and willingness to bring the project forward.
> And he also quickly became a very well-integrated part of our community.
>
> Please join me in congratulating Björn, I’m very happy to have you on
> board!
>
> Julian (on behalf of the PLC4X PMC)
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: [generation] Another approach to generated drivers

2019-04-29 Thread Niclas Hedhman
Outsider looking in; Many language runtimes allows embedding of other
languages' runtimes within. So why not pick a languages that is reasonably
easy to integrate into other languages, and then write the drivers in a
fully fledged programming language, rather than the DFDL abstraction or
creating a new DSL with a whole slew of consequences later on.

Languages that might be suitable; JavaScript, Lua, Forth, microPython or
even C...

Niclas

On Mon, Apr 29, 2019 at 2:20 PM Julian Feinauer <
j.feina...@pragmaticminds.de> wrote:

> Hi all,
>
> just wanted to sum up some talks and discussions we had off-list about the
> whole topic of driver generation / providing drivers in other languages.
> Currently, there are the following two approaches going on:
>
> Driver Generation based on DFDL by Chris:
> Chris already shared his branch and is working on the generation of
> drivers based on the specification of the messages and a state machine.
> This should then generate Code based on Freemarker Templates.
>
> Proxy Drivers by me, Chris and also others:
> We have a thrift based server / client spec.
> A simple Java Server is implemented as Interop Server and we work on
> providing client in other languages.
> This is a separate feature (as Proxy) but in a mode, where the Client
> itself starts the server in the background, this is an intermediate
> solution to already provide other language bindings (although at a cost).
> All work is done in the PLC4X-111 branch and I hope that we will be able
> to Merge that soon (Chris spend a lot of effort to include all the new
> stuff in our build).
>
> And there is a new thing coming currently which is mostly Driven by
> Matthias and myself regarding the driver code generation.
> We went over Chris example code (and the xmls) and our heads nearly
> exploded as it is so abstract.
> And as Matthias does a lot with model based code generation we had a long
> discussion about using a model based approach (probably with a DSL).
> So we currently try to investigate that a bit but also with a focus on
> research. In fact, we have the potential that we can engage some students
> from his institute to participate at the work.
> In fact, we even started a private Repo where we prepare a Paper to
> discuss the matter.
> As this would be our first “PLC4X Paper” everybody is invited to join us
> and should simply ping me (with github credentials), to get repo access.
> If we make it through we will will of course list everybody who
> contributed as author.
>
> To make it clear, this work, the DSL based driver generation tries to
> achieve the same as Chris approach based on DFDL just through another way.
> And right now I’m unable to say which one is better, could be better and
> where are the drawbacks and advantages. So we want to investigate that to
> have a basis for a discussion and decision. In fact, both approaches should
> be equally powerful, so one could be able to translate one to the other and
> vice versa, in theory.
> I consider it highly important to have a good and easy way to develop and
> maintain drivers as this is the crucial thing for the future of PLC4X.
>
> So please feel free to comment or discuss, if you feel like : )
>
> Julian
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: [DISCUSS] Rename CRUNCH to something different

2019-09-08 Thread Niclas Hedhman
peanut gallery; I would recommend a descriptive name, in format of "PLC4X
Abc", rather than a stand-alone name. Somewhere in the future, you may have
a dozen of these and one wouldn't know where to start looking.

Cheers
Niclas

On Mon, Sep 9, 2019 at 4:51 AM Julian Feinauer 
wrote:

> Hi all,
>
> I just discussed (off-list) with Justin the next steps needed.
> They are
>
> * fill out software grant (pm)
> * Start IP clearance vote on incubator list (JF)
> * Gather ICLA from all contributors of CRUNCH
>
> Parallel I’d like to start a discuss on how we should call it as PLC4X
> subproject.
>
> Any ideas or suggestions?
>
> Julian
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Usage of Netty - JSerialcom-Bridge

2019-08-07 Thread Niclas Hedhman
The so called Category A licenses are allowed to be included as a
dependency AND/OR in source form of Apache projects, but we must respect
the language of those licenses. MIT is a relatively aligned license, which
in essence differs from ALv2 in the patent clause (IIRC, however IANAL).

There is also a social aspect to expropriating external codebases; If the
authors explicitly wish for the codebase to be placed into PLC4X, then
AFAIU an ICLA is nice, but not required. If the original authors don't want
the fork, ASF has historically followed that even if it legally could fork
it. IF all the authors are onboard for the codebase to come to ASF, then
try to do a "Software Grant" and take it through the Incubator's process of
codebase donations, and TRY to get the authors to change the license to
ALv2.

>From experience, if they have a few hours of time available, most are happy
to do it. If they are strapped on time, someone can have a quick talk with
them, and do the actual work on their behalf. That is also often
appreciated.

// Niclas

On Wed, Aug 7, 2019 at 11:16 PM Christofer Dutz 
wrote:

> Hi Julian,
>
> It seems the files am have apache headers, but the pom says mit license.
> Perhaps Justin can help us with what's allowed and what's not.
>
> It would be cool to have it in a location we can update and release it on
> our own. Cause even if the maintainer is accepting PRs, we don't know how
> often he releases.
>
> We could put it alongside the raw socket stuff.
>
> It's only one contributor, so he could donate everything without too much
> effort.
>
> Chris
>
> Holen Sie sich Outlook für Android<https://aka.ms/ghei36>
>
> 
> From: Julian Feinauer 
> Sent: Wednesday, August 7, 2019 3:13:33 PM
> To: dev@plc4x.apache.org 
> Subject: Usage of Netty - JSerialcom-Bridge
>
> Hi all,
>
> as we use in our DF1 Code (and also fort he Modbus Code, I think) the
> library: https://github.com/Ziver/Netty-Transport-jSerialComm which is
> under netty license.
> But it quite outdated and only “maintained” by one guy.
> I contacted him asking if he accepts PRs and also suggested, that we
> probably move / replicate the code in our code in a tools module (or
> integrate it in the Serial-Netty Stuff somewhere).
>
> What do you think?
> The best way, if he agrees, would be to have him sign an ICLA and we could
> simply take the code as is and refactor it perhaps a bit and adapt it to
> newer versions.
>
> Otherwise, I think it will be hard to use this lib and we would need to
> come up with an alternative.
>
> Julian
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: Simpifying the profiles?

2019-10-15 Thread Niclas Hedhman
Has multiple repositories been considered? A project may request as many as
they want/need...

On Tue, Oct 15, 2019 at 4:07 PM Christofer Dutz 
wrote:

> Hi all,
>
> as I have heard complaints that the current way we handle profiles is too
> complicated, I would like to discuss alternatives with you all.
>
> Currently if you just run “./mvnw install” it will only build the
> protocols. This is probably not what the user wants.
>
> Right now we didn’t want to overwhelm someone just wanting to build Java,
> which will probably be the most common case to configure all the
> prerequisites for C++ and C#.
> So we introduced the “with-xyz” profiles. Now you only need to provide the
> tooling needed for the parts you want to build, which reduces the entry
> barrier (in my opinion)
> On the other hand we didn’t want people working on C++ and C# to have to
> run the Java test-suite before committing.
>
> But it seems that having to enable profiles already raises the barrier too
> high and people get confused instead of relieved. This was not planned and
> therefore we need to react.
>
> Yesterday I did a little brainstorming to what options I could think of …
> perhaps you have others or you have feedback to them. Your opinion would be
> highly appreciated:
>
>
>   1.  If no “with-xyz” profile is activated, a message is output which
> tells the user it should enable a profile (This should be very simple to
> implement)
>   2.  We make the “with-java” profile “enabled by default” (if no profile
> is enabled, this one is automatically enabled, making the naïve developer
> just trying “mvn package” scceed)
>   3.  We remove all profiles and ask people to go into “plc4j” to build
> the java part, into “sandbox” if they want to build the sandbox (We could
> add the suggestion to use “-am” to the build which will “also build” any
> outside modules needed by the current selection)
>
> Here my thoughts to the approaches:
>
>   1.  This shouldn’t have any negative side-effects (I personally would
> prefer this … we could even try make it “interactive” where the user can
> select the options he wants enabled and it generates a “command line” the
> user can use to build what he wants)
>   2.  The problem with enabled by default profiles is that they get
> disabled if a profile is explicitly selected. So if a user builds “mvn
> package” it would build java. But if he runs “mvn -Pwith-cpp package” it
> would only build C++ and no longer java … if you want java and C++ you
> would need to do “mvn -Pwith-java,with-cpp package” (Not that intuitive, I
> think … but an option)
>   3.  This will cause the “mvn package” type of persons to be flooded with
> a list of things to install and the build will take pretty long. As they
> will probably always have some prerequisite not installed and the build
> will not start with an explanation on why, we could use this opportunity to
> also point out that you don’t have to install all prerequisites if you only
> want to build part of the project. In this case too we would have to split
> the prerequisite check to the individual submodules or people will be left
> without guidance when building only “plc4cpp” for example … so we would
> have the big check in the root and multiple partial checks in the
> sub-directories.
>
>
> I personally would prefer the version 1), but let’s discuss this.
>
> Perhaps you have other ideas … I would be happy to hear and discuss them.
>
> Chris
>
>
>
>

-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: [REFACTORING] Self-Describing Driver Parameters

2019-10-23 Thread Niclas Hedhman
If I am not mistaken, the annotations in Camel are used in runtime as well,
and the additional description is a "small extra", compared to no
annotations with at the start.

That said; annotations were added with multiple purposes, and one explicit
such purpose was for documentation purposes, I think it is a positive idea,
but it could be a major undertaking in comparison.

Cheers
Niclas

On Wed, Oct 23, 2019, 21:06 Julian Feinauer 
wrote:

> Hi,
>
> as we plan to do a refactoring for the next release (0.6) I wanted to
> bring up an “older” Issue PLC4X-138.
> My suggestion is to do it somehow similar to what Apache Camel or Apache
> Maven do.
> Basically, they use Annotations in their Configuration POJOs to generate
> Documentation about all available configuration options, default values,
> etc.
>
> For Example for Camel, see
> https://github.com/Talend/apache-camel/blob/master/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
>
> A short Snippet:
> ```
> @UriEndpoint(firstVersion = "1.0.0", scheme = "timer", title = "Timer",
> syntax = "timer:timerName", consumerOnly = true, consumerClass =
> TimerConsumer.class, label = "core,scheduling")
>
> public class TimerEndpoint extends DefaultEndpoint implements
> MultipleConsumersSupport {
>
> @UriPath @Metadata(required = "true")
>
> private String timerName;
>
> @UriParam(defaultValue = "1000", description = "If greater than 0,
> generate periodic events every period milliseconds."
>
> + " You can also specify time values using units, such as 60s (60
> seconds), 5m30s (5 minutes and 30 seconds), and 1h (1 hour).")
>
> private long period = 1000;
>
> @UriParam(defaultValue = "1000", description = "Miliseconds before first
> event is triggered."
>
> + " You can also specify time values using units, such as 60s (60
> seconds), 5m30s (5 minutes and 30 seconds), and 1h (1 hour).")
>
> private long delay = 1000;
>
> @UriParam(defaultValue = "0")
>
> private long repeatCount;
>
> @UriParam
>
> private boolean fixedRate;
>
> @UriParam(defaultValue = "true", label = "advanced")
>
> private boolean daemon = true;
>
>
> ```
>
> So this would give us the possibility to generate custom UIs for all
> drivers and nice visualization (e.g. on the Homepage).
> See e.g. the (generated) Camel Homepage (for above Timer):
> https://camel.apache.org/components/latest/timer-component.html
>
> What are your thoughts?
>
> Julian
>


Re: PLC4X and OSGi

2019-10-13 Thread Niclas Hedhman
As a former OSGi-buff, I think I need to provide a little bit
guidance/translation here

What Julian is talking about is how bundles are constructed according to
OSGi, i.e. more stuff in META-INF/MANIFEST.MF, and there is tooling support
to ensure this is done correctly, such as a Maven plugin, Gradle plugin or
bnd/bndtools for Ant. How to package bundles is in the Core Specification.

What Cesar is talking about is that there is an additional Specification
(all supplementary specifications are known as the Compendium[1]) regarding
how hardware drivers should work in the OSGi framework. This is about being
able to create applications that are unaware of the implementations (such
as PLC4X in our case). The first diagram on
http://glcj.blogspot.com/2016/02/merlot-abstract-driver-model-24.html is
taken from the Compendium. Merlot is then Cesar's implementation of the
OSGi "Device Access Specification" for communication with external devices
(not sure the exact scope).

So, Julian is only talking about cases where "I want to use PLC4X in OSGi"
and that requires proper bundling. Cesar is talking about "I want to talk
to external devices via Device Access Specification" and PLC4X could be an
implementation (or part of one) for that. This would in reality require a
sub-project in PLC4X with additional OSGi dependencies and possibly
(depends on many things) some accommodation (typically classloader-related,
and might be needed for Julian's intentions as well) in the PLC4X core
implementation to make that possible.

Needless to say, Julian's suggestion is rather simple and IMHO should put
the metadata inside the regular jars. MOST Apache projects, Spring projects
and endless others, already do this, even though they have no OSGi focus at
all. Cesar's effort is non-trivial and requires a lot of OSGi-expertise,
possibly more than Karaf community is able to provide.

Further, OpenHAB might be (or already is) of interest to PLC4X. OpenHAB
runs on OSGi and it embraces the "implement to Spec" approach of OSGi. I
assume that it leverages the Device Access Specification, and not only do
those folks have plenty of experience with OSGi, they are very comfortable
in the PLC4X space as well, and have a strong community in Germany. I
suggest that a reach-out to them is initiated and see how they could help.
May they will package PLC4X for OSGi to be used on OpenHAB (I think they
use Karaf, but can't remember for sure) and this community won't need to
maintain the hard parts, only the bundlization.


Hope that Helps
Niclas


[1] Other specifications in the Compendium includes things like; JDBC, Http
servers, Configuration management, Declarative Services and much much more.

On Sun, Oct 13, 2019 at 8:11 PM Julian Feinauer <
j.feina...@pragmaticminds.de> wrote:

> Hi all,
>
> with the help of the Karaf Community and especially @Christian Schneider I
> was able to finalize a PR which makes PLC4X fully OSGi-compatible:
> https://github.com/apache/plc4x/pull/89
>
> This means that all jars are also valid (and hopefully correct) OSGi
> Bundles.
> Furthermore, I introduced a Karaf Feature fort he S7 driver (which I
> already tested manually and it works).
>
> Despite some pom additions I had to do a slight refactoring and rename
> several packages to avoid package-split situations.
> Thus, please review my PR carefully (although I consider all of those
> minor).
>
> Thanks!
> Julian
>
> PS.: I think we really should take this into 0.5 release
>
>
> Am 08.10.19, 15:26 schrieb "Christofer Dutz" :
>
> I agree ... as far as I understand it it's just some text in the
> MANIFEST that doesn't have impact on other class loading systems.
>
> We should check how we get this additional data in there however.
> There are multiple options and I don't quite know how good all of them are.
>
> Chris
>
>
> Am 08.10.19, 10:07 schrieb "Sebastian Rühl"
> :
>
> Hi Julian,
>
> We should put the osgi metadata directly into the modules as they
> „just“ enhance the manifest.
> Additional JARs would only increase the complexity.
>
> Sebastian
>
> > Am 07.10.2019 um 15:58 schrieb Julian Feinauer <
> j.feina...@pragmaticminds.de>:
> >
> > Hi all,
> >
> > as some of you may have notices from Twitter or Slack I am
> currently working on integrating PLC4X into OSGi and especially Karaf.
> > I get a lot of help from the Karaf guys and also Lukasz joined
> the effort to get this done, finally : )
> >
> > For the Drivers, there is one “central” question.
> > Do we want the Driver jars to also be OSGi-Bundles or do we
> prefer separate jars with a 1-1 relationship as OSGi bundles.
> > Other projects, like Netty do it all in one (
> https://netty.io/wiki/new-and-noteworthy-in-4.0.html).
> > In fact, the only difference is a “META-INF/MANIFEST.MF” file
> which is there additionally. So it hurts nobody but helps OSGi users.
>

Re: [DISCUSS] Guideline for "professional support" Mentioning on Homepage

2020-01-27 Thread Niclas Hedhman
My two cents; you could recommend that companies that has commercial
support to use a unique name on their offering/landing page that gets
picked up by search engines and let the general public know what that word
is...

When I personally am looking for this for project Foo, then "foo -site:
apache.org" is the starting point. And that could be smoother.


Cheers

On Mon, Jan 27, 2020, 16:28 Julian Feinauer 
wrote:

> Hes, but as I understand it you are already doing that, so this should
> yield result soon : )
>
> Am 27.01.20, 09:24 schrieb "Christofer Dutz" :
>
> Yeah ...
>
> not sure this is not too much ... we should in general have this
> checked if such a page would be in line with the ASF bylaws.
>
> Chris
>
> Am 27.01.20, 08:21 schrieb "Julian Feinauer" <
> j.feina...@pragmaticminds.de>:
>
> Hi,
>
> I think we should list the companies with a short outline like,
> e.g. postgres does it here:
> https://www.postgresql.org/support/professional_support/europe/
>
> For codecentric one could write (I see no problem):
> PLC4X was initially started as an internal project at codecentric
> and open soure to the ASF. Christofer Dutz, the initiatior of PLC4X helps
> in his daytime job clients with the implementation of Drivers and blab la
> blab la
>
> And for us we could / would write something similar:
> The beautiful, wise, intelligent and charismatic Julian and his
> blalbalblablalbal
>
> I think you get the point? : )
>
> Julian
>
> Am 27.01.20, 08:17 schrieb "Christofer Dutz" <
> christofer.d...@c-ware.de>:
>
> Hi Julian,
>
> I think having links to commercial support offerings is a
> pretty important thing for us to have.
> If we have to allow anyone be listed there (even if they don't
> contribute to the project) well that will be "the toad we have to swallow"
> (Don't know how to translate this German saying to English).
>
> Right now I see the industries worries of not being able to
> get commercial support as being one of the most problematic things ... that
> was why I put the "commercial support" thing on our landing page.
>
> Would it be possible to mark companies who employ committers
> of the project (but not which ones) with a "*" and an explanation?
>
> Chris
>
>
>
> Am 27.01.20, 08:10 schrieb "Julian Feinauer" <
> j.feina...@pragmaticminds.de>:
>
> Hey,
>
> @Christofer Dutz you can also a general discuss about
> whether or not we should do that.
> I am mostly concerned with clear rules, if we do it.
> But, in the end, its not granted, lets discuss it and if
> we cant get an agreement decide it.
>
> Julian
>
> Am 27.01.20, 06:55 schrieb "Christofer Dutz" <
> christofer.d...@c-ware.de>:
>
> Hi Justin,
>
> So in general it would be OK to have a list of links
> to companies plc4x support pages?
>
> I don't care about seeing the ties between persons and
> companies.
>
> Just not happy to have any company listed.
>
> Chris
> 
> Von: Justin Mclean 
> Gesendet: Montag, 27. Januar 2020 01:45
> An: dev@plc4x.apache.org 
> Betreff: Re: [DISCUSS] Guideline for "professional
> support" Mentioning on Homepage
>
> Hi,
>
> > as Lukas just opened up a discussion about
> mentioning commercial support on the (new) PLC4X Homepage.
> > One Example where this is done is Apache Druid (
> https://druid.apache.org/community/ see Getting Help).
>
> I dislike the Druid example as it shows who the
> committers are working for, that should not matter. Individuals contribute
> to Apache projects not companies. Having links to those companies (next to
> the committer name) when they may or may not be ASF sponsors is even worse.
>
> Re commercial supped listing them is OK as long as all
> that ask are listed and it not being seen as promoting or suggesting one
> over another. It must be vendor neutral.
>
> Thanks,
> Justin
>
>
>
>
>
>
>
>
>
>
>


Re: [DISCUSS] Guideline for "professional support" Mentioning on Homepage

2020-01-27 Thread Niclas Hedhman
1. On a page /commercial-support you explain the general principle that the
ASF is a vendor neutral place and favors are frowned upon.

2. On that page, recommend the user to instead use their favorite search
engine to look up (e.g) "plc4x_commercial_support" to find companies that
provide such.

3. People here would know, and can imply, that their own landing pages for
commercial support should contain that word for customers to find them.


HTH
Niclas



On Mon, Jan 27, 2020 at 6:21 PM Christofer Dutz 
wrote:

> Hi Niclas,
>
> have to admit that I didn't quite understand your suggestion.
>
> Chris
>
>
>
> Am 27.01.20, 10:01 schrieb "Niclas Hedhman" :
>
> My two cents; you could recommend that companies that has commercial
> support to use a unique name on their offering/landing page that gets
> picked up by search engines and let the general public know what that
> word
> is...
>
> When I personally am looking for this for project Foo, then "foo -site:
> apache.org" is the starting point. And that could be smoother.
>
>
> Cheers
>
> On Mon, Jan 27, 2020, 16:28 Julian Feinauer <
> j.feina...@pragmaticminds.de>
> wrote:
>
> > Hes, but as I understand it you are already doing that, so this
> should
> > yield result soon : )
> >
> > Am 27.01.20, 09:24 schrieb "Christofer Dutz" <
> christofer.d...@c-ware.de>:
> >
> > Yeah ...
> >
> > not sure this is not too much ... we should in general have this
> > checked if such a page would be in line with the ASF bylaws.
> >
> > Chris
> >
> > Am 27.01.20, 08:21 schrieb "Julian Feinauer" <
> > j.feina...@pragmaticminds.de>:
> >
> > Hi,
> >
> > I think we should list the companies with a short outline
> like,
> > e.g. postgres does it here:
> > https://www.postgresql.org/support/professional_support/europe/
> >
> > For codecentric one could write (I see no problem):
> > PLC4X was initially started as an internal project at
> codecentric
> > and open soure to the ASF. Christofer Dutz, the initiatior of PLC4X
> helps
> > in his daytime job clients with the implementation of Drivers and
> blab la
> > blab la
> >
> > And for us we could / would write something similar:
> > The beautiful, wise, intelligent and charismatic Julian and
> his
> > blalbalblablalbal
> >
> > I think you get the point? : )
> >
> > Julian
> >
> > Am 27.01.20, 08:17 schrieb "Christofer Dutz" <
> > christofer.d...@c-ware.de>:
> >
> > Hi Julian,
> >
> > I think having links to commercial support offerings is a
> > pretty important thing for us to have.
> > If we have to allow anyone be listed there (even if they
> don't
> > contribute to the project) well that will be "the toad we have to
> swallow"
> > (Don't know how to translate this German saying to English).
> >
> > Right now I see the industries worries of not being able
> to
> > get commercial support as being one of the most problematic things
> ... that
> > was why I put the "commercial support" thing on our landing page.
> >
> > Would it be possible to mark companies who employ
> committers
> > of the project (but not which ones) with a "*" and an explanation?
> >
> > Chris
> >
> >
> >
> > Am 27.01.20, 08:10 schrieb "Julian Feinauer" <
> > j.feina...@pragmaticminds.de>:
> >
> > Hey,
> >
> > @Christofer Dutz you can also a general discuss about
> > whether or not we should do that.
> > I am mostly concerned with clear rules, if we do it.
> > But, in the end, its not granted, lets discuss it
> and if
> > we cant get an agreement decide it.
> >
> > Julian
> >
> > Am 27.01.20, 06:55 schrieb "Christofer Dutz" <
> > christofer.d...@c-ware.de>:
> >
> > Hi Justin,
> >
> > S

Re: SPI Module - OSGi Bundle

2020-04-07 Thread Niclas Hedhman
actually, I just wanted to test the new
> TagData of the integration. This is the bundling in the pom, these imports
> had to be there before too
> > > >
> > > >  
> > > > org.apache.felix
> > > > maven-bundle-plugin
> > > > 4.2.1
> > > > true
> > > > 
> > > > 
> > > >
>  ${project.artifactId}
> > > >
>  ${project.version}
> > > > 
> > > >*;version=${project.version}
> > > > 
> > > > 
> > > > org.apache.plc4x.java.spi.transport,
> > > > org.apache.plc4x.java.s7.readwrite,
> > > > *
> > > > 
> > > > 
> > > > 
> > > > 
> > > >
> > > >
> > > > Etienne
> > > >
> > > > On 2020/04/03 08:17:45, Christian Schneider 
> wrote:
> > > >> The code in plc4x directly uses the class (not a String of the
> name). This
> > > >> is good. Normally such a class reference should work fine.
> > > >>
> > > >> Can you show your code as a complete example?
> > > >>
> > > >> Christian
> > > >>
> > > >>
> > > >> Am Fr., 3. Apr. 2020 um 09:58 Uhr schrieb Julian Feinauer <
> > > >> j.feina...@pragmaticminds.de>:
> > > >>
> > > >>> I am off with my knowledge.
> > > >>> You could ask the Karaf friends (#karaf in Slack). They are all
> OSGi
> > > >>> experts and very friendly and helpful.
> > > >>> Or perhaps Christian has an idea here?
> > > >>>
> > > >>> Best
> > > >>> Julian
> > > >>>
> > > >>> Am 03.04.20, 09:50 schrieb "Etienne Robinet"  >:
> > > >>>
> > > >>> Hi again,
> > > >>> I've been struggling with this issue for 2 days now... I still
> don't
> > > >>> get it why it can not find classes. here is the current problem:
> > > >>> https://i.imgur.com/LtZMdsu.png
> > > >>>
> > > >>> We can see that the classes are available and exported, I
> don't know
> > > >>> why the Camel Context can't find it. I even tried to add an
> Activator to my
> > > >>> bundle, and load these classes there and it works! But not in the
> > > >>> blueprint. If anyone had any idea on where the problem is...
> > > >>>
> > > >>> Etienne
> > > >>>
> > > >>> On 2020/04/01 01:31:15, Niclas Hedhman 
> wrote:
> > > >>> > It happens that OSGi classloading result in the wrong NCDFE
> and that
> > > >>> one of
> > > >>> > the classes "used" (i.e. return type, parameter, throws,
> extends,
> > > >>> > implements) in the reported class is not visible by the
> classloader.
> > > >>> And
> > > >>> > occasionally, it is a "diamond problem", i.e. that the
> Constraints
> > > >>> (IIRC,
> > > >>> > see chapter 3.8 in OSGi spec) can't be satisfied.
> > > >>> >
> > > >>> > Sorry that I don't have time to dig into the actual
> situation here,
> > > >>> but I
> > > >>> > thought I could share some of my past (dark) history ;-)
> > > >>> >
> > > >>> > Cheers
> > > >>> > Niclas
> > > >>> >
> > > >>> > On Wed, Apr 1, 2020 at 12:43 AM Christofer Dutz <
> > > >>> christofer.d...@c-ware.de>
> > > >>> > wrote:
> > > >>> >
> > > >>> > > Hi all,
> > > >>> > >
> > > >>> > > But If I search for uses of that class, it's only in the
> > > >>> > > org.apache.plc4x.java.spi.connection.NettyChannelFactory
> which is
> > > >>> in the
> > > >>> > 

Re: Big and littleendian fields in one mspec

2020-04-12 Thread Niclas Hedhman

For us who were around and shaping the protocols in the 1980s, and people
before us (and before standards like RS-232), a lot of the "specifications"
came out of "observation of implementation we managed to get to work",
rather than "implement this spec". A lot was due to extreme memory
constraints (in my case, multi-tasking operating system, serial protocol
187kbps, interpreted programming language with floating point ops and user
applications in 2kB RAM and 8kB EPROM) and a general lack of information,
like what other people were doing, sharing experiences and so on.

And there were many "innovative" ways to squeeze just a little bit extra
out of the hardware, resulting in "hard to understand" consequences. Bit
packing was a typical one, multiple functions packed into a single byte.
Look at page 14 in https://www.nxp.com/docs/en/data-sheet/80C31_80C32.pdf
and read up on "UART Enahanced Mode", and we used this, i.e. 9 bits, no
parity and clever use of address and mask to create a slave-to-slave direct
protocol, where the master's role was to signal which slave "owned" the
cable. Yeah, in that 8kB ROM limitation (I think protocol was about 1kB
ROM) and something like 150 bytes RAM for comm protocol.

Could you implement a compatible device to this with PLC4X and modern
hardware (i.e. no 8031/32 co-processor)? Possibly but bit-banging is needed
to support the 9bit data (+start and stop bits) and an awful lot of CPU
cycles on something that was automatic on one of the slowest long-lived
microcontroller ever.


My point was only to highlight that some of the strange things you see in
protocols today, have its roots in pre-standardization days. Today no one
would go down that route, because the hardware cost nothing now (8031  +
8kB EPROM + 2kB static RAM + battery backup => ~$50 in 1983's currency) and
longevity of software is more important.

Cheers
Niclas


On Sun, Apr 12, 2020 at 10:10 PM Christofer Dutz 
wrote:

> Hi Lukasz,
>
> I think it really gets tricky when using BE and having some byte-odd-sizes
> ... I remember in the Firmata protocol there were some bitmasks and then 10
> bit uint as BE ... not it really got tricky as the specs were written from
> a point of view: You read 16 bits BE and then the first6 bits mean XYZ
> instead of describing how the bits actually travel over the wire.
>
> Chris
>
>
>
> Am 11.04.20, 01:21 schrieb "Łukasz Dywicki" :
>
> I've made some progress with topic by modyfing mspec and allowing
> 'little endian' flag on fields. This moved me further to next issue -
> which is whole type encoded little endian.
>
> In ADS driver such type is State, which has 2 bytes and uses 8 bits for
> various flags.
> There are two cases which require different approach - reading and
> writing. So for reading we need to swap N bytes based on type length.
> For writing we need to alocate buffer for N bytes and swap them before
> writing.
>
> I am stuck now with freemaker templates and bit-io.
>
> Cheers,
> Łukasz
>
>
>
> On 10.04.2020 17:57, Łukasz Dywicki wrote:
> > I am doing some tests of ADS serialization.
> >
> > I've run into some troubles with payload which is generated with new
> > driver. I'm not sure if that's my fault or generated code.
> >
> > I did a verification of what Wireshark shows and how ads structures
> are
> > parsed. There is a gap I think. For example ams port number 1000
> > (0x1027) is read as 4135.
> >
> > Obviously I used wrong structures while implementing protocol logic
> in
> > first place, but now I am uncertain of how fields are encoded. How we
> > mark field as little endian when rest of payload is big endian? Do we
> > have `uint_le`?
> >
> > As far I remember route creation logic I was tracking last week used
> > combination of LE and BE.
> >
> > Best regards,
> > Łukasz
> >
>
>
>


Re: SPI Module - OSGi Bundle

2020-04-07 Thread Niclas Hedhman
t; org.apache.felix
> > > maven-bundle-plugin
> > > 4.2.1
> > > true
> > > 
> > > 
> > >
> >  ${project.artifactId}
> > >
> >  ${project.version}
> > > 
> > >*;version=${project.version}
> > > 
> > > 
> > > org.apache.plc4x.java.spi.transport,
> > > org.apache.plc4x.java.s7.readwrite,
> > > *
> > > 
> > > 
> > > 
> > > 
> > >
> > >
> > > Etienne
> > >
> > > On 2020/04/03 08:17:45, Christian Schneider 
> > wrote:
> > >> The code in plc4x directly uses the class (not a String of the name).
> > This
> > >> is good. Normally such a class reference should work fine.
> > >>
> > >> Can you show your code as a complete example?
> > >>
> > >> Christian
> > >>
> > >>
> > >> Am Fr., 3. Apr. 2020 um 09:58 Uhr schrieb Julian Feinauer <
> > >> j.feina...@pragmaticminds.de>:
> > >>
> > >>> I am off with my knowledge.
> > >>> You could ask the Karaf friends (#karaf in Slack). They are all OSGi
> > >>> experts and very friendly and helpful.
> > >>> Or perhaps Christian has an idea here?
> > >>>
> > >>> Best
> > >>> Julian
> > >>>
> > >>> Am 03.04.20, 09:50 schrieb "Etienne Robinet" :
> > >>>
> > >>> Hi again,
> > >>> I've been struggling with this issue for 2 days now... I still
> > don't
> > >>> get it why it can not find classes. here is the current problem:
> > >>> https://i.imgur.com/LtZMdsu.png
> > >>>
> > >>> We can see that the classes are available and exported, I don't
> > know
> > >>> why the Camel Context can't find it. I even tried to add an Activator
> > to my
> > >>> bundle, and load these classes there and it works! But not in the
> > >>> blueprint. If anyone had any idea on where the problem is...
> > >>>
> > >>> Etienne
> > >>>
> > >>> On 2020/04/01 01:31:15, Niclas Hedhman 
> wrote:
> > >>> > It happens that OSGi classloading result in the wrong NCDFE and
> > that
> > >>> one of
> > >>> > the classes "used" (i.e. return type, parameter, throws,
> extends,
> > >>> > implements) in the reported class is not visible by the
> > classloader.
> > >>> And
> > >>> > occasionally, it is a "diamond problem", i.e. that the
> > Constraints
> > >>> (IIRC,
> > >>> > see chapter 3.8 in OSGi spec) can't be satisfied.
> > >>> >
> > >>> > Sorry that I don't have time to dig into the actual situation
> > here,
> > >>> but I
> > >>> > thought I could share some of my past (dark) history ;-)
> > >>> >
> > >>> > Cheers
> > >>> > Niclas
> > >>> >
> > >>> > On Wed, Apr 1, 2020 at 12:43 AM Christofer Dutz <
> > >>> christofer.d...@c-ware.de>
> > >>> > wrote:
> > >>> >
> > >>> > > Hi all,
> > >>> > >
> > >>> > > But If I search for uses of that class, it's only in the
> > >>> > > org.apache.plc4x.java.spi.connection.NettyChannelFactory
> which
> > is
> > >>> in the
> > >>> > > SPI module.
> > >>> > >
> > >>> > > So I am not sure where this is accessed directly from the
> > outside.
> > >>> I know
> > >>> > > every driver would use the NettyChannelFactory, but that
> > shouldn't
> > >>> be an
> > >>> > > OSGi type problem as the SPI classes should be able to access
> > >>> their own
> > >>> > > classes.
> > >>> > >
> > >

Re: SPI Module - OSGi Bundle

2020-03-31 Thread Niclas Hedhman
It happens that OSGi classloading result in the wrong NCDFE and that one of
the classes "used" (i.e. return type, parameter, throws, extends,
implements) in the reported class is not visible by the classloader. And
occasionally, it is a "diamond problem", i.e. that the Constraints (IIRC,
see chapter 3.8 in OSGi spec) can't be satisfied.

Sorry that I don't have time to dig into the actual situation here, but I
thought I could share some of my past (dark) history ;-)

Cheers
Niclas

On Wed, Apr 1, 2020 at 12:43 AM Christofer Dutz 
wrote:

> Hi all,
>
> But If I search for uses of that class, it's only in the
> org.apache.plc4x.java.spi.connection.NettyChannelFactory which is in the
> SPI module.
>
> So I am not sure where this is accessed directly from the outside. I know
> every driver would use the NettyChannelFactory, but that shouldn't be an
> OSGi type problem as the SPI classes should be able to access their own
> classes.
>
> Chris
>
>
>
> Am 31.03.20, 16:07 schrieb "Etienne Robinet" <43...@etu.he2b.be>:
>
> Hi,
> From the log the class is called outside the SPI by the transport
>
> Etienne
>
> > Le 31 mars 2020 à 15:24, Julian Feinauer <
> j.feina...@pragmaticminds.de> a écrit :
> >
> > Hi,
> >
> > yes, if ist only needed internally its fine.But why does someone
> then get a Class Not Found Exception?
> > This is usually a hint to some class loader issue in OSGi which is
> related to exports/ imports.
> >
> > J
> >
> > Am 31.03.20, 15:23 schrieb "Christofer Dutz" <
> christofer.d...@c-ware.de>:
> >
> >As this package is only referenced from within SPI, couldn't we
> just exclude it from the package exports?
> >
> >Chris
> >
> >Am 31.03.20, 15:17 schrieb "Julian Feinauer" <
> j.feina...@pragmaticminds.de>:
> >
> >Hi,
> >
> >the issue is that if we export it, then we break Nettys OSGi
> integration as we get a split package situation (two bundles exporting the
> same package, which is forbidden in OSGi).
> >
> >So I see no easy solution (but had to do the same once as
> Netty is pretty... private).
> >
> >J
> >
> >Am 31.03.20, 15:15 schrieb "Christofer Dutz" <
> christofer.d...@c-ware.de>:
> >
> >Hi all,
> >
> >I just discussed this issue with Etienne and I thought it
> was important for all, so I asked him to bring it here.
> >
> >In my effort to get the EmbeddedChannel working as a full
> "transport" module, I had to override the Netty Bootstrap mechanism.
> >Unfortunately in order to do so, I need to call "init"
> from the derived class. Unfortunately this is package private in Netty so I
> had
> >To add it to the same package.
> >
> >Would it help to just not export these packages to OSGi?
> >
> >But I'm also open for alternatives (Please none involving
> mega-evil reflection hackery).
> >
> >
> >Chris
> >
> >Am 31.03.20, 15:10 schrieb "Etienne Robinet" <
> erobi...@apache.org>:
> >
> >Hi all,
> >I've been working on the Camel Component and decided
> to test it inside Karaf, but I noticed that I've got this error now:
> >https://i.imgur.com/kUZPwZ5.png
> >
> >Seems like this class is not exported by the bundle
> so it can not be found. Anyone has an idea on how we could solve this?
> >
> >Etienne
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>


Re: SPI Module - OSGi Bundle

2020-05-04 Thread Niclas Hedhman
   org.apache.felix
> > >>>>>maven-bundle-plugin
> > >>>>>4.2.1
> > >>>>>true
> > >>>>>
> > >>>>>
> > >>>>>
> > ${project.artifactId}
> > >>>>>
> > ${project.version}
> > >>>>>
> > >>>>>   *;version=${project.version}
> > >>>>>
> > >>>>>
> > >>>>>org.apache.plc4x.java.spi.transport,
> > >>>>>org.apache.plc4x.java.s7.readwrite,
> > >>>>>*
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> Etienne
> > >>>>>
> > >>>>> On 2020/04/03 08:17:45, Christian Schneider <
> > ch...@die-schneider.net> wrote:
> > >>>>>> The code in plc4x directly uses the class (not a String of the
> > name). This
> > >>>>>> is good. Normally such a class reference should work fine.
> > >>>>>>
> > >>>>>> Can you show your code as a complete example?
> > >>>>>>
> > >>>>>> Christian
> > >>>>>>
> > >>>>>>
> > >>>>>> Am Fr., 3. Apr. 2020 um 09:58 Uhr schrieb Julian Feinauer <
> > >>>>>> j.feina...@pragmaticminds.de>:
> > >>>>>>
> > >>>>>>> I am off with my knowledge.
> > >>>>>>> You could ask the Karaf friends (#karaf in Slack). They are
> > all OSGi
> > >>>>>>> experts and very friendly and helpful.
> > >>>>>>> Or perhaps Christian has an idea here?
> > >>>>>>>
> > >>>>>>> Best
> > >>>>>>> Julian
> > >>>>>>>
> > >>>>>>> Am 03.04.20, 09:50 schrieb "Etienne Robinet" <
> > erobi...@apache.org>:
> > >>>>>>>
> > >>>>>>>Hi again,
> > >>>>>>>I've been struggling with this issue for 2 days now... I
> > still don't
> > >>>>>>> get it why it can not find classes. here is the current
> > problem:
> > >>>>>>>https://i.imgur.com/LtZMdsu.png
> > >>>>>>>
> > >>>>>>>We can see that the classes are available and exported, I
> > don't know
> > >>>>>>> why the Camel Context can't find it. I even tried to add an
> > Activator to my
> > >>>>>>> bundle, and load these classes there and it works! But not in
> > the
> > >>>>>>> blueprint. If anyone had any idea on where the problem is...
> > >>>>>>>
> > >>>>>>>Etienne
> > >>>>>>>
> > >>>>>>>On 2020/04/01 01:31:15, Niclas Hedhman <
> nic...@hedhman.org>
> > wrote:
> > >>>>>>>> It happens that OSGi classloading result in the wrong NCDFE
> > and that
> > >>>>>>> one of
> > >>>>>>>> the classes "used" (i.e. return type, parameter, throws,
> > extends,
> > >>>>>>>> implements) in the reported class is not visible by the
> > classloader.
> > >>>>>>> And
> > >>>>>>>> occasionally, it is a "diamond problem", i.e. that the
> > Constraints
> > >>>>>>> (IIRC,
> > >>>>>>>> see chapter 3.8 in OSGi spec) can't be satisfied.
> > >>>>>>>>
> > >>>>>>>> Sorry that I don't have time to d

Re: [Introduction] Christofer Dutz

2020-05-05 Thread Niclas Hedhman
On Tue, May 5, 2020 at 7:23 PM Christofer Dutz 
wrote:

> Being an IT guy living near Frankfurt (Germany) there is almost no chance
> to not work for Banks and Insurance companies. So I guess I’ve been working
> for about 12 different Banks and Insurance companies in the last 15 years.
> I always like to compare working for a bank like asking Picasso to paint a
> portrait, but to have him wear a mental-institution restraining jacket and
> have him paint with a brush in his mouth.


I love the analogy! I was at a huge investment bank for 4 years, and
managed to "break free" of the straight-jacket, and only got "caught" when
the project was ready to launch and I was 1/8th of the budget and 1/4th of
the time allocated. My boss' boss' boss took notice, and screamed "shut
that down", about a week before going live. Can't have something like that
lowering his budget allocation. Got transferred internally to the Java
support team, mainly to be responsible for bringing open source into the
firm.


> It was that time that Industry 4.0 was everywhere … all the problems are
> easily addressable with open-source and a lot of the skills I have from the
> banking would have been a perfect match. So I had a look at what’s missing
> in this big picture and pretty quickly noticed the data-access problem is
> the biggest barrier and no solution being available or in sight.
>

Absolutely. What is now called IIoT is nothing new as a principle. The
first buildings I connected to the Internet happened in 1998. And way back
in 1986, I created one of the first PLC-to-PLC dial-up (both directions)
systems at Exomatic (now part of Regin AB). I didn't think much about it at
the time, it was a natural thing, except the modems were a pain, both due
to the incompatible AT commands, non-optimized default settings, and the
fact that they often stopped responding. BUT, I think that part of our
technology made a huge difference to gain customers.

Another huge passion of mine is melodic electronic music, so usually I
> travel around the Europe visiting different electronic music festivals.
>

Do you play/compose as well? One of my personal thing is Eurorack Modular
Synthesizers, but mainly construction. My son take care of the playing.


> I live in a town called Ober-Ramstadt together with my girlfriend Tanja,
> where we just moved into a house I inherited from my grandpa and which we
> renovated in 2 years of hard work … and still the work doesn’t end … so
> some-times I fall off the face of the earth for a few days cause I’m
> probably digging trenches for the foundation for some wall, or my
> rain-water system, or … or … or …. Guess the digging never stops.
>

He he he... My parents bought an ex-old-folks home in 1970, when it was
nearly impossible to borrow money, for $5000. Constant renovation continued
to ~1995, then slowed down to a project per year until ~2005, when my dad
got too old (80) for heavy duty work. So, I understand the challenge you
have in front of you ;-) ...


> Ok … so I hope this gives you a little impression on who I am and what
> drives me … it would make me happy to see some of you folks also introduce
> yourself. And I would even more love to have a beer with you (Or, as I’m a
> hessian … a big glass of apple wine) 
>

Really cool to hear. I'll pop by if I am in the neighborhood. I was
commuting to Wiesbaden in 2008 for a customer. 2 weeks at home, 4-6 weeks
in Wiesbaden, for about a year. It might happen again ;-)

Btw, my "home" is Malaysia and if anyone from this community happens to
pass through Kuala Lumpur, shout and we'll have a good meal and a beer.


// Niclas


Re: SPI Module - OSGi Bundle

2020-05-05 Thread Niclas Hedhman
ce for osgi
> specific logic. That is a standard dilema to address in how we want to
> treat osgi and non-osgi users. :-)
>
> Cheers!
> Łukasz
>
> On 05.05.2020 12:34, Julian Feinauer wrote:
> > Hi Etienne and Niclas,
> >
> > indeed we could orient (again) on how JDBC does that in OSGi.
> > They really focus on "late binding" so that you resolve the driver
> directly when you need it.
> > In theory, there is no such thing as a DriverManager in OSGi but only a
> PlcDriver with the capability ("plc4x-protocol": "s7") or something.
> >
> > I did it witht he driver maanger mostly fort he ease as first approach.
> >
> > Julian
> >
> > Am 05.05.20, 12:30 schrieb "Niclas Hedhman" :
> >
> > Also, just in case, a custom activator is ever required, it can be
> > overridden easily without breaking the over all design
> >
> > On Tue, May 5, 2020 at 6:27 PM Niclas Hedhman 
> wrote:
> >
> > > Yes, that's what I mean, because that is what you have inside the
> loop, so
> > > it should work.
> > >
> > > On Tue, May 5, 2020 at 11:50 AM Robinet, Etienne <
> 43...@etu.he2b.be>
> > > wrote:
> > >
> > >> Hi Niclas,
> > >> thanks for the feedback. So you mean to make the Activator in
> API/SPI
> > >> generic so every Driver would call it and declare the service
> itself?
> > >>
> > >> Le mar. 5 mai 2020 à 05:25, Niclas Hedhman 
> a écrit :
> > >>
> > >> > What you are doing is not particularly OSGi-y... The expected
> way to do
> > >> > this is to have each bundle register their PlcDriver or
> Transport to the
> > >> > OSGi service registry.
> > >> >
> > >> > That said, what you have done is otherwise fine, as you
> basically
> > >> trying to
> > >> > centralize the BundleActivators away from respective
> Driver/Transport.
> > >> And
> > >> > I assume you do so to limit code in the drivers/transports.
> > >> >
> > >> > Another way would be to make two generic BundleActivator in
> this bundle
> > >> and
> > >> > have each driver/transport just declare them in the manifest.
> That
> > >> would be
> > >> > a bit more conventional.
> > >> >
> > >> > // Niclas
> > >> >
> > >> > On Tue, May 5, 2020 at 11:06 AM Robinet, Etienne <
> 43...@etu.he2b.be>
> > >> > wrote:
> > >> >
> > >> > > Hi all,
> > >> > > With the change of Christofer this problem got solved.
> Nonetheless, I
> > >> > kept
> > >> > > the work I did (inspired by the work of Lukasz) to make an
> Activator
> > >> for
> > >> > > API (Driver Services) and SPI (Transport Services). I also
> tested it,
> > >> but
> > >> > > as I am pretty new to this, if anyone could just give me a
> feedback on
> > >> > the
> > >> > > code:
> > >> > >
> > >> > > API Activator:
> > >> > >
> > >> > >
> > >> >
> > >>
> https://github.com/apache/plc4x/blob/feature/osgi/plc4j/api/src/main/java/org/apache/plc4x/java/osgi/ApiActivator.java
> > >> > > SPI Activator:
> > >> > >
> > >> > >
> > >> >
> > >>
> https://github.com/apache/plc4x/blob/feature/osgi/plc4j/spi/src/main/java/org/apache/plc4x/java/osgi/SpiActivator.java
> > >> > >
> > >> > > If everything is alright, I could merge this today.
> > >> > >
> > >> > > Etienne
> > >> > >
> > >> > > Le mar. 7 avr. 2020 à 17:52, Christofer Dutz <
> > >> christofer.d...@c-ware.de>
> > >> > a
> > >> > > écrit :
> > >> > >
> > >> > > > Hi folks,
> > >> > > >
> > >> > > > I just pushed a change that might get rid of this error.
> > >> > > >
> > >> > > > I added the Plc4xBootstrap in an at

Re: SPI Module - OSGi Bundle

2020-05-05 Thread Niclas Hedhman
Also, just in case, a custom activator is ever required, it can be
overridden easily without breaking the over all design

On Tue, May 5, 2020 at 6:27 PM Niclas Hedhman  wrote:

> Yes, that's what I mean, because that is what you have inside the loop, so
> it should work.
>
> On Tue, May 5, 2020 at 11:50 AM Robinet, Etienne <43...@etu.he2b.be>
> wrote:
>
>> Hi Niclas,
>> thanks for the feedback. So you mean to make the Activator in API/SPI
>> generic so every Driver would call it and declare the service itself?
>>
>> Le mar. 5 mai 2020 à 05:25, Niclas Hedhman  a écrit :
>>
>> > What you are doing is not particularly OSGi-y... The expected way to do
>> > this is to have each bundle register their PlcDriver or Transport to the
>> > OSGi service registry.
>> >
>> > That said, what you have done is otherwise fine, as you basically
>> trying to
>> > centralize the BundleActivators away from respective Driver/Transport.
>> And
>> > I assume you do so to limit code in the drivers/transports.
>> >
>> > Another way would be to make two generic BundleActivator in this bundle
>> and
>> > have each driver/transport just declare them in the manifest. That
>> would be
>> > a bit more conventional.
>> >
>> > // Niclas
>> >
>> > On Tue, May 5, 2020 at 11:06 AM Robinet, Etienne <43...@etu.he2b.be>
>> > wrote:
>> >
>> > > Hi all,
>> > > With the change of Christofer this problem got solved. Nonetheless, I
>> > kept
>> > > the work I did (inspired by the work of Lukasz) to make an Activator
>> for
>> > > API (Driver Services) and SPI (Transport Services). I also tested it,
>> but
>> > > as I am pretty new to this, if anyone could just give me a feedback on
>> > the
>> > > code:
>> > >
>> > > API Activator:
>> > >
>> > >
>> >
>> https://github.com/apache/plc4x/blob/feature/osgi/plc4j/api/src/main/java/org/apache/plc4x/java/osgi/ApiActivator.java
>> > > SPI Activator:
>> > >
>> > >
>> >
>> https://github.com/apache/plc4x/blob/feature/osgi/plc4j/spi/src/main/java/org/apache/plc4x/java/osgi/SpiActivator.java
>> > >
>> > > If everything is alright, I could merge this today.
>> > >
>> > > Etienne
>> > >
>> > > Le mar. 7 avr. 2020 à 17:52, Christofer Dutz <
>> christofer.d...@c-ware.de>
>> > a
>> > > écrit :
>> > >
>> > > > Hi folks,
>> > > >
>> > > > I just pushed a change that might get rid of this error.
>> > > >
>> > > > I added the Plc4xBootstrap in an attempt to get the TestTransport
>> > > working.
>> > > > For some reasons the netty folks created the EmbeddedChannel
>> > differently
>> > > > than the rest.
>> > > > However as the TestTransport is the only one needing this change, I
>> > moved
>> > > > these classes to the test-transport module
>> > > > and extended NettyChannelFactory with a createBootstrap method
>> which is
>> > > > simply overridden in TestTransport.
>> > > >
>> > > > So please give everything a try if it now works as planned.
>> > > >
>> > > > Chris
>> > > >
>> > > >
>> > > >
>> > > > Am 07.04.20, 17:36 schrieb "Etienne Robinet" <43...@etu.he2b.be>:
>> > > >
>> > > > Hi all,
>> > > > I’ve checked the Manifest. If I put the Embed-Dependency to the
>> > > > plc4j-spi artifact  it does not find the Transport Service. And if I
>> > dont
>> > > > it does not find the Plc4xBootstrap.
>> > > >
>> > > > Etienne ROBINET
>> > > >
>> > > > > Le 7 avr. 2020 à 16:48, Łukasz Dywicki 
>> a
>> > > > écrit :
>> > > > >
>> > > > > I was updating my local checkout yesterday. Can't promise if I
>> > will
>> > > > be
>> > > > > able to help, but will give a try with 0.7 snapshot.
>> > > > >
>> > > > > Best,
>> > > > > Łukasz
>> > > > >
>> > > > >
>> > > > >> On 07.04.2020 15:39, Etienne Robinet wrote:
>> > &

Re: SPI Module - OSGi Bundle

2020-05-05 Thread Niclas Hedhman
Yes, that's what I mean, because that is what you have inside the loop, so
it should work.

On Tue, May 5, 2020 at 11:50 AM Robinet, Etienne <43...@etu.he2b.be> wrote:

> Hi Niclas,
> thanks for the feedback. So you mean to make the Activator in API/SPI
> generic so every Driver would call it and declare the service itself?
>
> Le mar. 5 mai 2020 à 05:25, Niclas Hedhman  a écrit :
>
> > What you are doing is not particularly OSGi-y... The expected way to do
> > this is to have each bundle register their PlcDriver or Transport to the
> > OSGi service registry.
> >
> > That said, what you have done is otherwise fine, as you basically trying
> to
> > centralize the BundleActivators away from respective Driver/Transport.
> And
> > I assume you do so to limit code in the drivers/transports.
> >
> > Another way would be to make two generic BundleActivator in this bundle
> and
> > have each driver/transport just declare them in the manifest. That would
> be
> > a bit more conventional.
> >
> > // Niclas
> >
> > On Tue, May 5, 2020 at 11:06 AM Robinet, Etienne <43...@etu.he2b.be>
> > wrote:
> >
> > > Hi all,
> > > With the change of Christofer this problem got solved. Nonetheless, I
> > kept
> > > the work I did (inspired by the work of Lukasz) to make an Activator
> for
> > > API (Driver Services) and SPI (Transport Services). I also tested it,
> but
> > > as I am pretty new to this, if anyone could just give me a feedback on
> > the
> > > code:
> > >
> > > API Activator:
> > >
> > >
> >
> https://github.com/apache/plc4x/blob/feature/osgi/plc4j/api/src/main/java/org/apache/plc4x/java/osgi/ApiActivator.java
> > > SPI Activator:
> > >
> > >
> >
> https://github.com/apache/plc4x/blob/feature/osgi/plc4j/spi/src/main/java/org/apache/plc4x/java/osgi/SpiActivator.java
> > >
> > > If everything is alright, I could merge this today.
> > >
> > > Etienne
> > >
> > > Le mar. 7 avr. 2020 à 17:52, Christofer Dutz <
> christofer.d...@c-ware.de>
> > a
> > > écrit :
> > >
> > > > Hi folks,
> > > >
> > > > I just pushed a change that might get rid of this error.
> > > >
> > > > I added the Plc4xBootstrap in an attempt to get the TestTransport
> > > working.
> > > > For some reasons the netty folks created the EmbeddedChannel
> > differently
> > > > than the rest.
> > > > However as the TestTransport is the only one needing this change, I
> > moved
> > > > these classes to the test-transport module
> > > > and extended NettyChannelFactory with a createBootstrap method which
> is
> > > > simply overridden in TestTransport.
> > > >
> > > > So please give everything a try if it now works as planned.
> > > >
> > > > Chris
> > > >
> > > >
> > > >
> > > > Am 07.04.20, 17:36 schrieb "Etienne Robinet" <43...@etu.he2b.be>:
> > > >
> > > > Hi all,
> > > > I’ve checked the Manifest. If I put the Embed-Dependency to the
> > > > plc4j-spi artifact  it does not find the Transport Service. And if I
> > dont
> > > > it does not find the Plc4xBootstrap.
> > > >
> > > > Etienne ROBINET
> > > >
> > > > > Le 7 avr. 2020 à 16:48, Łukasz Dywicki  a
> > > > écrit :
> > > > >
> > > > > I was updating my local checkout yesterday. Can't promise if I
> > will
> > > > be
> > > > > able to help, but will give a try with 0.7 snapshot.
> > > > >
> > > > > Best,
> > > > > Łukasz
> > > > >
> > > > >
> > > > >> On 07.04.2020 15:39, Etienne Robinet wrote:
> > > > >> Hi again,
> > > > >> I've been looking at this issue all day, and I am back to the
> > > > initial error:
> > > > >> https://i.imgur.com/LLfan8H.png
> > > > >>
> > > > >> The difference is I used and Activator for API and SPI to
> > register
> > > > the driver and transports Service, which are then loaded by the
> custom
> > > > blueprint. The error now is caused again because this class is not
> > > exported
> > > > (I think?) by the SPI, but is used by

Re: SPI Module - OSGi Bundle

2020-05-06 Thread Niclas Hedhman
My suggestion was;
1. Don't do the BundleTracker classes, and instead change to a bundle
activator for each.
2. Add the "Bundle-Activator: org.apache.plc4x.java.osgi.DriverActivator"
to the driver META/MANIFEST.MF
3. Do the equivalent for the Transports.

public class DriverActivator implements BundleActivator {

private ServiceRegistration reg;

@Override
public void start( BundleContext context ) throws Exception {
Hashtable props = new Hashtable<>();
props.put( OsgiDriverManager.PROTOCOL_CODE, driver.getProtocolCode() );
props.put( OsgiDriverManager.PROTOCOL_NAME, driver.getProtocolName() );
reg = context.registerService( PlcDriver.class, driver, props );
}

@Override
public void stop( BundleContext context ) {
context.unregisterService( reg );
}
}









On Wed, May 6, 2020 at 2:33 PM Etienne Robinet  wrote:

> Hi all,
> So concretely what changes should be done so that a Driver/Transport
> declares itself his service? Beside the changes in the manifest?
> Etienne
> On 2020/05/06 01:26:42, Niclas Hedhman  wrote:
> > Łukasz,
> >
> > the reason I say it is not very OSGi-y, is that the principle of OSGi is
> > that the bundle handles its own service registrations. In the case of
> JDBC
> > (I initiated that spec, and I am the founder of OPS4J as well as Pax
> > subproject, 2005), it needed to address the problem that JDBC drivers
> > existed and changing their build and/or manifests was decided to be "not
> > viable". The approach there is a work-around for legacy code, which I and
> > Stuart McCulloch basically invented. IIRC, this happened in 2007.
> >
> > I didn't suggest that bundles require Declarative Services. I suggested
> > that the "inside of the loop" in Etienne's code is put into an Activator,
> > the code residing in the API and SPI bundles respectively, and that each
> > driver/transport has a "Bundle-Activator: ." in the manifest
> > referencing respective activator. It is not more intrusive than the
> > Export-Package, Import-Package that will be required anyway.
> >
> > Advantages; It is more in the spirit of OSGi. But importantly, the
> > driver/transport is now an active bundle, rather than a library bundle,
> and
> > in theory the start/stop of a bundle could (there might be other reasons
> > why not) turn it on/off in runtime. If special needs pop up, maybe to
> > deploy for the OpenHAB project, it is possible to override the
> > driver/transport with hacking the API/SPI bundles.
> >
> > And I can't see any disadvantages other than "need to rework a bit of
> code".
> >
> > But I don't have skin in the game. Not in OSGi, not here, so take my
> > recommendations into consideration or throw them away. I just got the
> > impression that you didn't really get what I suggested.
> >
> >
> > // Niclas
> >
> >
> >
> > On Wed, May 6, 2020 at 4:57 AM Łukasz Dywicki 
> wrote:
> >
> > > Hey Etienne, that's awesome piece of work. I can test it! :-)
> > >
> > > I believe that's what Etienne code does it in a valid OSGi way. And I
> do
> > > believe not because he mentioned me by name, but due to below
> > > argumentation.
> > >
> > > Proposed code uses extender pattern to grab specific META-INF/services
> > > entries and register them in OSGi service registry. If you will take a
> > > look on following line:
> > >
> > >
> https://github.com/apache/plc4x/blob/feature/osgi/plc4j/api/src/main/java/org/apache/plc4x/java/osgi/ApiActivator.java#L63
> > > you will find that bundle is an jar which changes state to ACTIVE.
> > > Additionally that bundle classloader is used to find services and that
> > > bundle context is used to register services. In the end service which
> > > appears looks like one registered by driver/transport module.
> > >
> > > The main point for above implementation is basic - getting the standard
> > > PLC4X driver JAR working in OSGi without forcing it to knowing too much
> > > about OSGi. Driver needs to ship manifest with import/export statements
> > > and that's it. Additionally driver does not have to have a XML
> > > descriptor which registers service. Quite many third parties might be
> > > supplying drivers without any or with limited knowledge of OSGi.
> > > Do drivers have to be a service? Well, it they can still be a valid
> OSGi
> > > service, registered using any other way! OSGi aware driver manager uses
> > > OSGi services instead of static list own classloader to fi

Re: SPI Module - OSGi Bundle

2020-05-07 Thread Niclas Hedhman
Both approaches are independent of OSGi framework implementations, which is
part of the beauty of OSGi.

Lukasz puts more value on some dogmatic principle ("only interfaces in
API"), whereas I have forwarded how an OSGi bundle producer is expected to
provide it, and how an OSGi bundle consumer would expect to see it and the
added benefit that default behavior can be overridden. Lukasz uses my own
work-around (for JDBC drivers) to show me that is the way things are done.
It is not, it was a necessary hack for that time to get around the legacy
JDBC drivers out in the open, all of them without OSGi manifests.

As I said, I have no skin in the game. Only providing independent advice,
as a former OSGi expert and a keen interest in PLC4X.

// Niclas


On Thu, May 7, 2020 at 9:13 PM Christofer Dutz 
wrote:

> Hi folks,
>
> so if there is an option that doesn't tie our API and Drivers to a
> specific OSGi framework, I would prefer that.
>
> Chris
>
> Am 07.05.20, 12:35 schrieb "Julian Feinauer" <
> j.feina...@pragmaticminds.de>:
>
> I would say that there are arguments for both cases (as ist often with
> OSGi, IMHO).
> So I see them not as right or wrong but as to different styles or
> approaches that I woudl leave up to you to decide.
>
> IMHO
> Julian
>
> Am 07.05.20, 10:07 schrieb "Robinet, Etienne" <43...@etu.he2b.be>:
>
> Hi guys,
> As I am really not an expert, which approach should we use?
>
> Etienne
>
> Le mer. 6 mai 2020 à 15:57, Łukasz Dywicki 
> a écrit :
>
> > Hey Niclas,
> > While this code seems straight I don't think it is needed, and
> valid in
> > our case.
> > Main benefit of extender and extender based patterns is
> centralized
> > processing of drivers.
> > I am keen to keep only interfaces in the API packages and
> bundles and
> > move active parts of code (such base classes) to another place.
> It is
> > necessary to avoid creation of implementation dependency. And
> that's
> > what is in fact, promoted by shared activator class.
> >
> > Best,
> > Łukasz
> >
> >
> > On 06.05.2020 13:47, Niclas Hedhman wrote:
> > > My suggestion was;
> > > 1. Don't do the BundleTracker classes, and instead change to a
> bundle
> > > activator for each.
> > > 2. Add the "Bundle-Activator:
> org.apache.plc4x.java.osgi.DriverActivator"
> > > to the driver META/MANIFEST.MF
> > > 3. Do the equivalent for the Transports.
> > >
> > > public class DriverActivator implements BundleActivator {
> > >
> > > private ServiceRegistration reg;
> > >
> > > @Override
> > > public void start( BundleContext context ) throws
> Exception {
> > > Hashtable props = new Hashtable<>();
> > > props.put( OsgiDriverManager.PROTOCOL_CODE,
> > driver.getProtocolCode() );
> > > props.put( OsgiDriverManager.PROTOCOL_NAME,
> > driver.getProtocolName() );
> > > reg = context.registerService( PlcDriver.class,
> driver, props );
> > > }
> > >
> > > @Override
> > > public void stop( BundleContext context ) {
> > > context.unregisterService( reg );
> > > }
> > > }
>     > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Wed, May 6, 2020 at 2:33 PM Etienne Robinet <
> erobi...@apache.org>
> > wrote:
> > >
> > >> Hi all,
> > >> So concretely what changes should be done so that a
> Driver/Transport
> > >> declares itself his service? Beside the changes in the
> manifest?
> > >> Etienne
> > >> On 2020/05/06 01:26:42, Niclas Hedhman 
> wrote:
> > >>> Łukasz,
> > >>>
> > >>> the reason I say it is not very OSGi-y, is that the
> principle of OSGi
> > is
> > >>> that the bundle handles its own service registrations. In
> the case of
> > >> JDBC
> > >&g

Re: SPI Module - OSGi Bundle

2020-05-08 Thread Niclas Hedhman
As mentioned elsewhere, the generic activators could go in a separate
bundle for OSGi use only. That applies to both this approach and Lukasz'
one.

// Niclas

On Fri, May 8, 2020 at 2:08 PM Christofer Dutz 
wrote:

> Hi Niclas,
>
> If your suggested path doesn't limit the framework decisions a user has,
> then I have no objections.
>
> Indiens I am not that deep into osgi to have a well founded opinion.
>
> The api will probably never be a pure api module as it contains the driver
> manager, which I wouldn't want to put into a separate module.
>
> Chris
> ________
> Von: Niclas Hedhman 
> Gesendet: Freitag, 8. Mai 2020 05:12
> An: dev@plc4x.apache.org 
> Betreff: Re: SPI Module - OSGi Bundle
>
> Both approaches are independent of OSGi framework implementations, which is
> part of the beauty of OSGi.
>
> Lukasz puts more value on some dogmatic principle ("only interfaces in
> API"), whereas I have forwarded how an OSGi bundle producer is expected to
> provide it, and how an OSGi bundle consumer would expect to see it and the
> added benefit that default behavior can be overridden. Lukasz uses my own
> work-around (for JDBC drivers) to show me that is the way things are done.
> It is not, it was a necessary hack for that time to get around the legacy
> JDBC drivers out in the open, all of them without OSGi manifests.
>
> As I said, I have no skin in the game. Only providing independent advice,
> as a former OSGi expert and a keen interest in PLC4X.
>
> // Niclas
>
>
> On Thu, May 7, 2020 at 9:13 PM Christofer Dutz 
> wrote:
>
> > Hi folks,
> >
> > so if there is an option that doesn't tie our API and Drivers to a
> > specific OSGi framework, I would prefer that.
> >
> > Chris
> >
> > Am 07.05.20, 12:35 schrieb "Julian Feinauer" <
> > j.feina...@pragmaticminds.de>:
> >
> > I would say that there are arguments for both cases (as ist often
> with
> > OSGi, IMHO).
> > So I see them not as right or wrong but as to different styles or
> > approaches that I woudl leave up to you to decide.
> >
> > IMHO
> > Julian
> >
> > Am 07.05.20, 10:07 schrieb "Robinet, Etienne" <43...@etu.he2b.be>:
> >
> > Hi guys,
> > As I am really not an expert, which approach should we use?
> >
> > Etienne
> >
> > Le mer. 6 mai 2020 à 15:57, Łukasz Dywicki 
> > a écrit :
> >
> > > Hey Niclas,
> > > While this code seems straight I don't think it is needed, and
> > valid in
> > > our case.
> > > Main benefit of extender and extender based patterns is
> > centralized
> > > processing of drivers.
> > > I am keen to keep only interfaces in the API packages and
> > bundles and
> > > move active parts of code (such base classes) to another place.
> > It is
> > > necessary to avoid creation of implementation dependency. And
> > that's
> > > what is in fact, promoted by shared activator class.
> > >
> > > Best,
> > > Łukasz
> > >
> > >
> > > On 06.05.2020 13:47, Niclas Hedhman wrote:
> > > > My suggestion was;
> > > > 1. Don't do the BundleTracker classes, and instead change to
> a
> > bundle
> > > > activator for each.
> > > > 2. Add the "Bundle-Activator:
> > org.apache.plc4x.java.osgi.DriverActivator"
> > > > to the driver META/MANIFEST.MF
> > > > 3. Do the equivalent for the Transports.
> > > >
> > > > public class DriverActivator implements BundleActivator {
> > > >
> > > > private ServiceRegistration reg;
> > > >
> > > > @Override
> > > > public void start( BundleContext context ) throws
> > Exception {
> > > > Hashtable props = new Hashtable<>();
> > > > props.put( OsgiDriverManager.PROTOCOL_CODE,
> > > driver.getProtocolCode() );
> > > > props.put( OsgiDriverManager.PROTOCOL_NAME,
> > > driver.getProtocolName() );
> > > > reg = context.registerService( PlcDriver.class,
> > driver, props );
> > > > }
> > > >
> > > > @Override
> >  

Re: SPI Module - OSGi Bundle

2020-05-08 Thread Niclas Hedhman
Yes, that is what I suggest

On Fri, May 8, 2020, 16:19 Robinet, Etienne <43...@etu.he2b.be> wrote:

> Hello,
> so if I understand correctly, I should create a new module for the OSGi
> bundle, containing generic Activators that would be mentioned in the
> Driver/Transport MANIFEST?
> Etienne
>
> Le ven. 8 mai 2020 à 09:55, Niclas Hedhman  a écrit :
>
> > As mentioned elsewhere, the generic activators could go in a separate
> > bundle for OSGi use only. That applies to both this approach and Lukasz'
> > one.
> >
> > // Niclas
> >
> > On Fri, May 8, 2020 at 2:08 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> > wrote:
> >
> > > Hi Niclas,
> > >
> > > If your suggested path doesn't limit the framework decisions a user
> has,
> > > then I have no objections.
> > >
> > > Indiens I am not that deep into osgi to have a well founded opinion.
> > >
> > > The api will probably never be a pure api module as it contains the
> > driver
> > > manager, which I wouldn't want to put into a separate module.
> > >
> > > Chris
> > > 
> > > Von: Niclas Hedhman 
> > > Gesendet: Freitag, 8. Mai 2020 05:12
> > > An: dev@plc4x.apache.org 
> > > Betreff: Re: SPI Module - OSGi Bundle
> > >
> > > Both approaches are independent of OSGi framework implementations,
> which
> > is
> > > part of the beauty of OSGi.
> > >
> > > Lukasz puts more value on some dogmatic principle ("only interfaces in
> > > API"), whereas I have forwarded how an OSGi bundle producer is expected
> > to
> > > provide it, and how an OSGi bundle consumer would expect to see it and
> > the
> > > added benefit that default behavior can be overridden. Lukasz uses my
> own
> > > work-around (for JDBC drivers) to show me that is the way things are
> > done.
> > > It is not, it was a necessary hack for that time to get around the
> legacy
> > > JDBC drivers out in the open, all of them without OSGi manifests.
> > >
> > > As I said, I have no skin in the game. Only providing independent
> advice,
> > > as a former OSGi expert and a keen interest in PLC4X.
> > >
> > > // Niclas
> > >
> > >
> > > On Thu, May 7, 2020 at 9:13 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > > wrote:
> > >
> > > > Hi folks,
> > > >
> > > > so if there is an option that doesn't tie our API and Drivers to a
> > > > specific OSGi framework, I would prefer that.
> > > >
> > > > Chris
> > > >
> > > > Am 07.05.20, 12:35 schrieb "Julian Feinauer" <
> > > > j.feina...@pragmaticminds.de>:
> > > >
> > > > I would say that there are arguments for both cases (as ist often
> > > with
> > > > OSGi, IMHO).
> > > > So I see them not as right or wrong but as to different styles or
> > > > approaches that I woudl leave up to you to decide.
> > > >
> > > > IMHO
> > > > Julian
> > > >
> > > > Am 07.05.20, 10:07 schrieb "Robinet, Etienne" <43...@etu.he2b.be
> >:
> > > >
> > > > Hi guys,
> > > > As I am really not an expert, which approach should we use?
> > > >
> > > > Etienne
> > > >
> > > > Le mer. 6 mai 2020 à 15:57, Łukasz Dywicki <
> > l...@code-house.org>
> > > > a écrit :
> > > >
> > > > > Hey Niclas,
> > > > > While this code seems straight I don't think it is needed,
> > and
> > > > valid in
> > > > > our case.
> > > > > Main benefit of extender and extender based patterns is
> > > > centralized
> > > > > processing of drivers.
> > > > > I am keen to keep only interfaces in the API packages and
> > > > bundles and
> > > > > move active parts of code (such base classes) to another
> > place.
> > > > It is
> > > > > necessary to avoid creation of implementation dependency.
> And
> > > > that's
> > > > > what is in fact, promoted by shared activator class.
> > > > >
> > > > > Best,
> > > > 

Re: Serial port Connection

2020-06-29 Thread Niclas Hedhman
Ok, let's dissect this...

1. There are many devices connected to a serial ModBus port.

2. ModBus (and every other serial protocol I have dealt with) are not
"connection" oriented, but packets, most of the time very small. The
"connection" metaphor in PLC4X for non-TCP comms is actually quite poor.[1]

3. All serial protocols (that I worked with) have at least the destination
present in the protocol packet itself. When some of these serial protocols
were "wrapped" for modern TCP/IP communications, an ambiguity surfaced. And
in case of ModBus, the device address was simply defaulted to 1 (although I
think some gateways can handle many, and perhaps some TCP devices will map
out more than one ModbUs device, but I have no experience in that)


So, as things are right now, and if I didn't misunderstood something
(totally possible), is that one is required to "open->->close" the
PLC4X connection for each device that I want to scan/read, as I think the
device address (1 byte in case of ModBus) is part of the connection string.
The biggest system I have ever been involved with was just under 1000 PLCs
(granted, not modbus) with 30,000 data points readable in total. It feels
"s wrong" to have "open->send->receive->close" operation for all of
those, AND that the timing on that particular system was that for optimal
performance, exactly 1 byte of delay (related to half-duplex modem
direction switching) between receiving the last byte of previous packet
before the first byte of the new packet. Without the "Serial Port"
abstraction, with a queue of requests to send, such timing is not trivial.

What I think has "gone wrong" here is that the "serial port" is an
interface, pretty much like "eth0" and should be handled "further down" but
since the operating system has no support for it, it should have been in
PLC4X's architecture. I also think that the "connection" metaphor is poor,
and a "packet" metaphor would have been much better throughout PLC4X
regardless whether it is TCP/IP, UDP or serial. The actual TCP connection
when needed should be handled under the hood, rather invisibly to the user.
As I said before, I understand that this is not something that can be
changed, just like that... Only expressing how I think it should have been
done.

I will try to work with what we have, and dig into the details on the
serial port side, as that's where I have plenty of experience and I get the
impression that it isn't the strength of the community. I am sure you will
hear a lot from me going forward, as I have decided to put PLC4X into my
commercial product, replacing the existing j2mod.


Niclas

[1] It is quite funny that the serial port is natively a stream, and we map
packets onto it. TCP/IP is natively packets, which is then made into a
stream, which we then map packets onto the stream. Ideally, UDP is fit for
purpose for PLC protocols, but for some unknown reason few are.




On Mon, Jun 29, 2020 at 4:00 PM Christofer Dutz 
wrote:

> Hi all,
>
> sorry for joining in the party late ... but hopefully not too late.
>
> Regarding making the serial port part of the connection string ... I have
> to admit that right now I couldn't imagine how to not have it in there and
> not over-complicate things for the users. Yes, if you create a connection
> this will have exclusive handle to the port, but this is actually an
> important thing to have. In contrast to network devices that can handle
> multiple connections in parallel ... a serial port is ... well ... serial.
> Havin asynchronous access to one serial port from multiple areas in an
> application sound like a bad Idea.
>
> However you could always use the connection pool ... in this case the pool
> would have one connection open and could share this (serially) with
> multiple parts of an application. Here a part would request the connection,
> do its work and then give the connection back to the pool where another
> part of the application could use it. This way I think we have the ideal
> tradeoff between sharing a connection and not having to be concerned about
> breaking the serial operation of the serial-port communication.
>
> And yes: We could use some documentation on the connection pool ... and
> the scraper ;-/
>
> Perhaps I'll whip up a little documentation on the connection-pool as I
> just recently had to find out how to use it myself ;-)
>
> Chris
>
>
> Am 25.06.20, 11:41 schrieb "Julian Feinauer" <
> j.feina...@pragmaticminds.de>:
>
> Hey,
>
> yes, its in the module scraper or plc-scraper.
> Its easily configurable by yaml, json or programmatically.
>
> Julian
>
> Am 25.06.20, 10:30 schrieb "Niclas Hedhman" :
>
> Thanks
>

Re: Serial port Connection

2020-06-30 Thread Niclas Hedhman
On Tue, Jun 30, 2020 at 2:31 PM Christofer Dutz 
wrote:

> But can we assume that only one protocol is handled over one serial
> interface? So not multiple Modbus devices sharing with multiple S5 devices
> ...
>

So, I have never seen anyone trying multiple protocols on the same port, so
that is a safe assumption. Even if I think there are devices that can
auto-sense Modbus and Bacnet, I doubt anyone will ever want to do both.



> Because in this case I guess we could refactor things a bit.
>

And I totally agree that as little changes as possible should be attempted,
so I won't suggest a rewrite, don't worry ;-)

Perhaps to have an optional device-address on the connection level which
> will act as a default and to extend or provide a second set of addresses,
> that have the device-address within. So you could either use the
> device-address together with the smaller field addresses (Mainly for TCP
> connections) and these would inherit the default device-address or you
> could use the bigger ones where you provide the device-address for every
> field.
>

Not sure what you mean here. ModBus/RTU has a one byte Address and a
Checksum, and those are dropped in Modbus/TCP and that relies on the
delivery/checksum of TCP/IP.


> I wouldn’t want to change the naming however ... you could consider in an
> extended serial modbus scenario (If we changed the serial part the way you
> proposed), that the connection is from the software to the port ...Which
> would be true. And most of the other drivers in PLC4X actually do more have
> a Connection-oriented communication form. I guess this is due to the fact
> that we concentrated on the SCADA-Level protocols first and now are
> gradually stepping deeper into the fieldbus area.
> I think only the EIP protocol is also somewhat connection-less, but S7,
> OPC UA, AMS/ADS, ... definitely are.
>

Interesting. I have very little experience "higher up" and perhaps there
are enough reasons to make abstractions different for stateless (or packet)
protocol vs those that are stateful. The compromise now is that stateless
pretends to be stateful, and a cycle of "open->close" takes place, very
much similar to HTTP/1.0 being stateless over the stateful TCP. I am not
100% confident what is the best way forward, so I'll come back to that
later. I think in the short term, I can survive because my current need is
very small (reading 5-10 values from each of 3-5 devices) and it is
hourly-relevant data.
In the process, I will try to formulate ideas for changes...

I know that serial comms are slowly dying out, but the amount of stuff
already out there and lifespans of decades, it will take a while before it
is all gone.

// Niclas


Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-14 Thread Niclas Hedhman
What is ModbusPAL?

The 1-offset in Modbus has caused a lot of confusion over the years.

On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz 
wrote:

> Sorry for the noise ...
>
> this was a false positive ... the driver was doing things correctly.
> It seems the ModbusPAL was just off by one ;-)
>
> Chris
>
>
>
> Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" :
>
> Christofer Dutz created PLC4X-214:
> -
>
>  Summary: [Modbus] Holding register addresses have an
> offset of 1 (Not reading the correct address)
>  Key: PLC4X-214
>  URL: https://issues.apache.org/jira/browse/PLC4X-214
>  Project: Apache PLC4X
>   Issue Type: Bug
>   Components: Driver-Modbus
> Affects Versions: 0.7.0
> Reporter: Christofer Dutz
> Assignee: Christofer Dutz
>  Fix For: 0.8.0
>
>
> If I set holding the following holding registers to:
>
> 1000: 41
> 1001: 42
> 1002: 43
>
> And then read: holding-register:1001 ... I get the value 43 returned.
>
>
>
> --
> This message was sent by Atlassian Jira
> (v8.3.4#803005)
>
>


Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Niclas Hedhman
The issue with 1-offset is that the "Register Number" found in
documentation is at an "Address" one position less. So Reg 41 has Address
40. Som libraries expect Register Numbers and some expect Register Address.
And every so often, one mixes that up.

On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz 
wrote:

> 
>
> While looking for more Infos I found out I once wrote a tutorial page for
> PLC4X __
>
> https://plc4x.apache.org/users/plc4j/virtual-modbus.html
>
> I so totally hate searching the web and getting my answers answered by
> myself.
>
> Chris
>
> Am 15.07.20, 08:31 schrieb "Christofer Dutz" :
>
> Hi Niclas,
>
> when preparing a workshop for the Building IoT we were looking for
> something where you could simulate a Modbus Slave.
> Most of these were Windows only solutions, so ModbusPAL was one of the
> very few solutions that were pure-java.
>
> Don't quite understand what the thing with the offset is however ...
> should be easy to fix ... I mean if I say address 42 in PLC4X, Wireshark
> says 42, but in Modbus Pal I think it has to be 43 ... don't quite get it.
>
> Chris
>
>
>
> Am 15.07.20, 03:54 schrieb "Niclas Hedhman" :
>
> What is ModbusPAL?
>
> The 1-offset in Modbus has caused a lot of confusion over the
> years.
>
> On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Sorry for the noise ...
> >
> > this was a false positive ... the driver was doing things
> correctly.
> > It seems the ModbusPAL was just off by one ;-)
> >
> > Chris
> >
> >
> >
> > Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" <
> j...@apache.org>:
> >
> > Christofer Dutz created PLC4X-214:
> > -
> >
> >  Summary: [Modbus] Holding register addresses
> have an
> > offset of 1 (Not reading the correct address)
> >  Key: PLC4X-214
> >  URL:
> https://issues.apache.org/jira/browse/PLC4X-214
> >  Project: Apache PLC4X
> >   Issue Type: Bug
> >   Components: Driver-Modbus
> > Affects Versions: 0.7.0
> > Reporter: Christofer Dutz
> > Assignee: Christofer Dutz
> >  Fix For: 0.8.0
> >
> >
> > If I set holding the following holding registers to:
> >
> > 1000: 41
> > 1001: 42
> > 1002: 43
> >
> > And then read: holding-register:1001 ... I get the value 43
> returned.
> >
> >
> >
> > --
> > This message was sent by Atlassian Jira
> > (v8.3.4#803005)
> >
> >
>
>
>


Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Niclas Hedhman
Personall, I prefer that Register Numbers are used in APIs and that the
address is only seen if you analyze the over-the-wire format, but maybe
that is just me. A big reason for this is that any interface presented to
an operator would need to use RegNumbers, as most (possibly all)
documentation of equipment has RegNumbers and some are lacking the
addresses. It is also common that the register type is part of the Register
Number, such as 10012, where the first 1 indicates "coil" (IIRC). and
holding registers are in 4. Ideally(!), this is also handled by the
register/address parser.

Niclas

On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz 
wrote:

> Hmm .. so are we doing it correctly?
>
> I mean Wireshark isn't the ideal reference here as I have several valid
> packets in the KNX space, where WireShark just says "corrupt package".
>
> So if you enter an "holding-register:42" address it tries to read the
> register number 43 in ModbusPAL.
>
> I guess as we are reading an "address" we are correct and probably as
> ModusPAL says register number, that might be correct too?
>
> Chris
>
>
> Am 15.07.20, 10:54 schrieb "Niclas Hedhman" :
>
> The issue with 1-offset is that the "Register Number" found in
> documentation is at an "Address" one position less. So Reg 41 has
> Address
> 40. Som libraries expect Register Numbers and some expect Register
> Address.
> And every so often, one mixes that up.
>
> On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > 
> >
> > While looking for more Infos I found out I once wrote a tutorial
> page for
> > PLC4X __
> >
> > https://plc4x.apache.org/users/plc4j/virtual-modbus.html
> >
> > I so totally hate searching the web and getting my answers answered
> by
> > myself.
> >
> > Chris
> >
> > Am 15.07.20, 08:31 schrieb "Christofer Dutz" <
> christofer.d...@c-ware.de>:
> >
> > Hi Niclas,
> >
> > when preparing a workshop for the Building IoT we were looking
> for
> > something where you could simulate a Modbus Slave.
> > Most of these were Windows only solutions, so ModbusPAL was one
> of the
> > very few solutions that were pure-java.
> >
> > Don't quite understand what the thing with the offset is however
> ...
> > should be easy to fix ... I mean if I say address 42 in PLC4X,
> Wireshark
> > says 42, but in Modbus Pal I think it has to be 43 ... don't quite
> get it.
> >
> > Chris
> >
> >
> >
> > Am 15.07.20, 03:54 schrieb "Niclas Hedhman"  >:
> >
> > What is ModbusPAL?
> >
> > The 1-offset in Modbus has caused a lot of confusion over the
> > years.
> >
> > On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > Sorry for the noise ...
> > >
> > > this was a false positive ... the driver was doing things
> > correctly.
> > > It seems the ModbusPAL was just off by one ;-)
> > >
> > > Chris
> > >
> > >
> > >
> > > Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" <
> > j...@apache.org>:
> > >
> > > Christofer Dutz created PLC4X-214:
> > > -
> > >
> > >  Summary: [Modbus] Holding register
> addresses
> > have an
> > > offset of 1 (Not reading the correct address)
> > >  Key: PLC4X-214
> > >  URL:
> > https://issues.apache.org/jira/browse/PLC4X-214
> > >  Project: Apache PLC4X
> > >   Issue Type: Bug
> > >   Components: Driver-Modbus
> > > Affects Versions: 0.7.0
> > > Reporter: Christofer Dutz
> > > Assignee: Christofer Dutz
> > >  Fix For: 0.8.0
> > >
> > >
> > > If I set holding the following holding registers to:
> > >
> > > 1000: 41
> > > 1001: 42
> > > 1002: 43
> > >
> > > And then read: holding-register:1001 ... I get the
> value 43
> > returned.
> > >
> > >
> > >
> > > --
> > > This message was sent by Atlassian Jira
> > > (v8.3.4#803005)
> > >
> > >
> >
> >
> >
>
>


Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Niclas Hedhman
It is a common format in equipment documentation. I am currently working
with an electric meter. See screenshot from its manual;
https://ipfs.subutai.io/ipfs/QmPsra6ExrkSX9GCYWgHa6CTfJbBnddLVXJ3NmJjmAYrAk

At protocol level, there are no such "high numbers", just that the industry
got used to write "4" instead "holding register". It is a "people thing",
not a technical one.

HTH
Niclas

On Wed, Jul 15, 2020 at 6:11 PM Christofer Dutz 
wrote:

> Hmmm ...
>
> Regarding: 10012 being a coil and 4 a register.
>
> Well the coils and registers are completely different things ... They are
> accessed via completely different requests.
> That might be some sort of convenience convention, but I wouldn't call
> that a standard (I've actually never seen it before)
> Would you then just subtract 4 from every register or would you just
> configure registers starting with numbers 4?
>
> What do the others think? The address format does reference registers ...
> should we be doing the translation?
>
> I guess that the general use-case would be that someone has a look at his
> Modbus config and says that he wants "Register X"
> and not "The Register Y references" (which seems to be one less) ... I
> might even swing my vote in favor to using register numbers instead of
> addresses.
>
> But then I ask myself: How can I address register 0 in ModbusPal ... that
> would require an address that's impossible to send.
>
> Chris
>
>
> Am 15.07.20, 11:51 schrieb "Niclas Hedhman" :
>
> Personall, I prefer that Register Numbers are used in APIs and that the
> address is only seen if you analyze the over-the-wire format, but maybe
> that is just me. A big reason for this is that any interface presented
> to
> an operator would need to use RegNumbers, as most (possibly all)
> documentation of equipment has RegNumbers and some are lacking the
> addresses. It is also common that the register type is part of the
> Register
> Number, such as 10012, where the first 1 indicates "coil" (IIRC). and
> holding registers are in 4. Ideally(!), this is also handled by the
> register/address parser.
>
> Niclas
>
> On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Hmm .. so are we doing it correctly?
> >
> > I mean Wireshark isn't the ideal reference here as I have several
> valid
> > packets in the KNX space, where WireShark just says "corrupt
> package".
> >
> > So if you enter an "holding-register:42" address it tries to read the
> > register number 43 in ModbusPAL.
> >
> > I guess as we are reading an "address" we are correct and probably as
> > ModusPAL says register number, that might be correct too?
> >
> > Chris
> >
> >
> > Am 15.07.20, 10:54 schrieb "Niclas Hedhman" :
> >
> > The issue with 1-offset is that the "Register Number" found in
> > documentation is at an "Address" one position less. So Reg 41 has
> > Address
> > 40. Som libraries expect Register Numbers and some expect
> Register
> > Address.
> > And every so often, one mixes that up.
> >
> > On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > 
> > >
> > > While looking for more Infos I found out I once wrote a
> tutorial
> > page for
> > > PLC4X __
> > >
> > > https://plc4x.apache.org/users/plc4j/virtual-modbus.html
> > >
> > > I so totally hate searching the web and getting my answers
> answered
> > by
> > > myself.
> > >
> > > Chris
> > >
> > > Am 15.07.20, 08:31 schrieb "Christofer Dutz" <
> > christofer.d...@c-ware.de>:
> > >
> > > Hi Niclas,
> > >
> > > when preparing a workshop for the Building IoT we were
> looking
> > for
> > > something where you could simulate a Modbus Slave.
> > > Most of these were Windows only solutions, so ModbusPAL
> was one
> > of the
> > > very few solutions that were pure-java.
> > >
> > > Don't quite understand what the th

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Niclas Hedhman
Let me try again; There is no 3 addresses in the products. It is a
notation written with text, by people. the first written digit convey the
type. That's it.

Long time ago, back when the Modbus came to life it was simply a memory
area that one could read and possibly write. And then documentation
specified what was in each bit/byte/word. And with such approach, it is
probably possible to implement Modbus in less than 100 bytes of very
expensive (E)PROM back then. Not until later was there address validity
checks and what not.

FTR; It is completely beyond me how Modbus became as popular as it has, and
that this happened decades after it was introduced on the market. When I
was part of a startup and we were developing a serial protocol in
1984/1985, we knew of Modbus and thought it was a really poor protocol
(couldn't even do floating point numbers). I don't like it, but just about
every electric thing can be purchased with Modbus option...

Cheers
Niclas

On Wed, Jul 15, 2020 at 9:39 PM Christofer Dutz 
wrote:

> Hi Niclas,
>
> Protocol-wise the numbers could be up to 65535 as they use an unsigned 16
> bit integer as an address.
>
> I guess what would be interesting, would be what address is going over the
> wire for "30001" for example.
> Also as a register is always a 16 bit value, the increments by two sort of
> puzzle me.
>
> I think Modbus is an extremely simple protocol but we need to get a
> feeling for it's usages.
>
> It does seem as if the industry tends to wrap some aspects in software
> bubble-wrap ... we gotta find out what's below.
>
> Chris
>
>
> Am 15.07.20, 15:23 schrieb "Niclas Hedhman" :
>
> It is a common format in equipment documentation. I am currently
> working
> with an electric meter. See screenshot from its manual;
>
> https://ipfs.subutai.io/ipfs/QmPsra6ExrkSX9GCYWgHa6CTfJbBnddLVXJ3NmJjmAYrAk
>
> At protocol level, there are no such "high numbers", just that the
> industry
> got used to write "4" instead "holding register". It is a "people
> thing",
> not a technical one.
>
> HTH
> Niclas
>
> On Wed, Jul 15, 2020 at 6:11 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Hmmm ...
> >
> > Regarding: 10012 being a coil and 4 a register.
> >
> > Well the coils and registers are completely different things ...
> They are
> > accessed via completely different requests.
> > That might be some sort of convenience convention, but I wouldn't
> call
> > that a standard (I've actually never seen it before)
> > Would you then just subtract 4 from every register or would you
> just
> > configure registers starting with numbers 4?
> >
> > What do the others think? The address format does reference
> registers ...
> > should we be doing the translation?
> >
> > I guess that the general use-case would be that someone has a look
> at his
> > Modbus config and says that he wants "Register X"
> > and not "The Register Y references" (which seems to be one less) ...
> I
>     > might even swing my vote in favor to using register numbers instead
> of
> > addresses.
> >
> > But then I ask myself: How can I address register 0 in ModbusPal ...
> that
> > would require an address that's impossible to send.
> >
> > Chris
> >
> >
> > Am 15.07.20, 11:51 schrieb "Niclas Hedhman" :
> >
> > Personall, I prefer that Register Numbers are used in APIs and
> that the
> > address is only seen if you analyze the over-the-wire format,
> but maybe
> > that is just me. A big reason for this is that any interface
> presented
> > to
> > an operator would need to use RegNumbers, as most (possibly all)
> > documentation of equipment has RegNumbers and some are lacking
> the
> > addresses. It is also common that the register type is part of
> the
> > Register
> > Number, such as 10012, where the first 1 indicates "coil"
> (IIRC). and
> > holding registers are in 4. Ideally(!), this is also handled
> by the
> > register/address parser.
> >
> > Niclas
> >
> > On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > Hmm .. so are we doing it correctly?
> > >
> > > I mean Wireshark isn't t

Serial port Connection

2020-06-24 Thread Niclas Hedhman
Hi,
IIUIC, the connection string for Serial Modbus would be something like;

 modbus:serial:/dev/ttyS0?unit-identifier=7

assuming I want to communicate with device with address 7.

That would mean that I have one connection per device I talk to over a
single serial port. Is that correct? (Personally, I would not made the
device part of the connection abstraction, but realize that it is a bit
late for that)

Are there any issues here, regarding which connection has access to the
port, or do I need to open and close the connection on each set of messages?

Couldn't find info about this in the documentation.


The serial port page is missing information on the configuration (data,
parity, stop,...). The source code doesn't have the @ConfigurationParameter
annotations, so will they still work or do I need to add that
programmatically somehow?


Cheers
Niclas


Re: Serial port Connection

2020-06-25 Thread Niclas Hedhman
Thanks

Another question; is there any "loop" system that just continuously reads
until I tell it to stop?

On Thu, Jun 25, 2020, 15:16 Julian Feinauer 
wrote:

> Hi Nic,
>
> I have to dig in a bit later to give you good answers but AFAIR the
> connection can be left open and configuration should be as you wrote it.
> I also did some tests with it but that was some months ago...
>
> Hope to have some more information later.
>
> Julian
>
> Am 25.06.20, 05:58 schrieb "Niclas Hedhman" :
>
> Hi,
> IIUIC, the connection string for Serial Modbus would be something like;
>
>  modbus:serial:/dev/ttyS0?unit-identifier=7
>
> assuming I want to communicate with device with address 7.
>
> That would mean that I have one connection per device I talk to over a
> single serial port. Is that correct? (Personally, I would not made the
> device part of the connection abstraction, but realize that it is a bit
> late for that)
>
> Are there any issues here, regarding which connection has access to the
> port, or do I need to open and close the connection on each set of
> messages?
>
> Couldn't find info about this in the documentation.
>
>
> The serial port page is missing information on the configuration (data,
> parity, stop,...). The source code doesn't have the
> @ConfigurationParameter
> annotations, so will they still work or do I need to add that
> programmatically somehow?
>
>
> Cheers
> Niclas
>
>


Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-16 Thread Niclas Hedhman
To make things worse, there is equipment on the market with both 32-bit
numbers as well IEEE floats.

And many clients are incapable of doing something meaningful with those...


And then there is equipment that uses one register to indicate the
magnitude of one or more other registers, say 1="divide by 1", 2="divide by
10"...



Niclas

On Thu, Jul 16, 2020, 14:28 Christofer Dutz 
wrote:

> Hi Ben and Otto,
>
> First off all, thank you Ben for that very detailed explanation. It does
> seem as if we should extend the parser to support the different numeric
> variants. I don't see any problems in supporting both the hex-like one as
> well as the pure numeric one.
>
> I think we have 6 separate memory areas. Do you have a mapping, That I
> could use? I mean which first digit represents which memory area?
>
> @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> (registers)... Haven't seen a somewhat standard way to encode anything else.
>
> Chris
> 
> Von: Otto Fowler 
> Gesendet: Donnerstag, 16. Juli 2020 06:41
> An: dev@plc4x.apache.org 
> Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> addresses have an offset of 1 (Not reading the correct address)
>
> Don’t forget embedded protocols are possible,
> different devices format floats differently
> some devices don’t want persistent connections
> etc etc
>
> On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com) wrote:
>
> Hi,
>
> Answering some of the questions:-
> *I guess what would be interesting, would be what address is going over the
> wire for "30001" for example.*
> The address that gets sent over the wire is the address starting from 0 i.e
> 31 would be address 0. I didn't know that.
>
> *Also as a register is always a 16 bit value, the increments by two sort of
> puzzle me.*
> The Modbus registers are numbered 31 thru to 365536 (or whatever the
> highest is for the device), they are 16 bit registers they don't increment
> by 2. If you were mapping 32-bit data types to the registers then of course
> you would increment by two but I don't know of any other situation or
> device that increments the addresses by 2.
>
>
> *Long time ago, back when the Modbus came to life it was simply a
> memory area*
> I do vaguely remember working on a device that didn't differentiate between
> the memory areas and would just use the address when reading and writing,
> the leading digit would just specify data type. 01 would be a bit in
> 41.
>
>
> *so would you suggest we leave things the way they are or should we change
> something?*
> I would, it is the most commonly used. I think I have also seen the format
> 0x1, 4x1 being used but is less common.
>
> *I guess we might think about adding different address parser flavors in
> the future. So we could use the current one per default, but we could add a
> Schneider Field parser that helps convert %MW1 to our
> holding-register:401 ... or whatever the scematics are.*
> You would want to be careful doing this because a lot of the times the
> mapping between Modbus Registers and the internal addresses is
> configurable. Newer Schnieder PLCs I think have an option to start the
> numbering at %MW0 , Rockwell Micrologix PLCs have a configurable mapping
> table so you can select the data table the Modbus addresses get mapped to.
>
> Some other things that might not have come up,
> There is also an extended memory (Leading digit 6) area on some devices.
> Schneider Quantum controllers I know use this.
>
> There are a lot of devices that support Modbus, but the quality of some of
> the implementations can be very poor. I wouldn't be relying on some of the
> non-essential fields (Transaction Ids, Lengths) as they can sometimes not
> be populated.
>
> I also wouldn't assume that every device supports all the function codes.
> Some devices (Honeywell C200/C300) allow you to select which function codes
> you want to use for each device to try and work around this.
>
> For Modbus TCP, some servers won't allow more than a certain number of
> connections at any one time. Sometimes this number is 1. It can be very
> annoying to troubleshoot.
>
> Kind Regards
>
> Ben
>
>
>
>
>
> On Wed, Jul 15, 2020 at 9:53 AM Niclas Hedhman  wrote:
>
> > Let me try again; There is no 3 addresses in the products. It is a
> > notation written with text, by people. the first written digit convey the
> > type. That's it.
> >
> > Long time ago, back when the Modbus came to life it was simply a
> memory
> > area that one could read and possibly write. And then documentation
> > specifie

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-16 Thread Niclas Hedhman
For floats, I have only seen IEEE format. But can't rule out other.

On Thu, Jul 16, 2020, 14:57 Christofer Dutz 
wrote:

> Guess it should be possible for plc4x to interpret INT as two shorts long
> as four... In that case it could probably also handle half precision floats
> (16 bit), full floats and double, if the encoding is somewhat standard
> (which I assume it's not)
>
> Chris
> ________
> Von: Niclas Hedhman 
> Gesendet: Donnerstag, 16. Juli 2020 08:33
> An: dev@plc4x.apache.org 
> Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> addresses have an offset of 1 (Not reading the correct address)
>
> To make things worse, there is equipment on the market with both 32-bit
> numbers as well IEEE floats.
>
> And many clients are incapable of doing something meaningful with those...
>
>
> And then there is equipment that uses one register to indicate the
> magnitude of one or more other registers, say 1="divide by 1", 2="divide by
> 10"...
>
>
>
> Niclas
>
> On Thu, Jul 16, 2020, 14:28 Christofer Dutz 
> wrote:
>
> > Hi Ben and Otto,
> >
> > First off all, thank you Ben for that very detailed explanation. It does
> > seem as if we should extend the parser to support the different numeric
> > variants. I don't see any problems in supporting both the hex-like one as
> > well as the pure numeric one.
> >
> > I think we have 6 separate memory areas. Do you have a mapping, That I
> > could use? I mean which first digit represents which memory area?
> >
> > @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> > (registers)... Haven't seen a somewhat standard way to encode anything
> else.
> >
> > Chris
> > 
> > Von: Otto Fowler 
> > Gesendet: Donnerstag, 16. Juli 2020 06:41
> > An: dev@plc4x.apache.org 
> > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> > addresses have an offset of 1 (Not reading the correct address)
> >
> > Don’t forget embedded protocols are possible,
> > different devices format floats differently
> > some devices don’t want persistent connections
> > etc etc
> >
> > On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com)
> wrote:
> >
> > Hi,
> >
> > Answering some of the questions:-
> > *I guess what would be interesting, would be what address is going over
> the
> > wire for "30001" for example.*
> > The address that gets sent over the wire is the address starting from 0
> i.e
> > 31 would be address 0. I didn't know that.
> >
> > *Also as a register is always a 16 bit value, the increments by two sort
> of
> > puzzle me.*
> > The Modbus registers are numbered 31 thru to 365536 (or whatever the
> > highest is for the device), they are 16 bit registers they don't
> increment
> > by 2. If you were mapping 32-bit data types to the registers then of
> course
> > you would increment by two but I don't know of any other situation or
> > device that increments the addresses by 2.
> >
> >
> > *Long time ago, back when the Modbus came to life it was simply a
> > memory area*
> > I do vaguely remember working on a device that didn't differentiate
> between
> > the memory areas and would just use the address when reading and writing,
> > the leading digit would just specify data type. 01 would be a bit in
> > 41.
> >
> >
> > *so would you suggest we leave things the way they are or should we
> change
> > something?*
> > I would, it is the most commonly used. I think I have also seen the
> format
> > 0x1, 4x1 being used but is less common.
> >
> > *I guess we might think about adding different address parser flavors in
> > the future. So we could use the current one per default, but we could
> add a
> > Schneider Field parser that helps convert %MW1 to our
> > holding-register:401 ... or whatever the scematics are.*
> > You would want to be careful doing this because a lot of the times the
> > mapping between Modbus Registers and the internal addresses is
> > configurable. Newer Schnieder PLCs I think have an option to start the
> > numbering at %MW0 , Rockwell Micrologix PLCs have a configurable mapping
> > table so you can select the data table the Modbus addresses get mapped
> to.
> >
> > Some other things that might not have come up,
> > There is also an extended memory (Leading digit 6) area on some devices.
> > Schneider Quantum controllers I know use this.
> >

[jira] [Created] (PLC4X-205) Incorrect shutdown sequence on error

2020-06-24 Thread Niclas Hedhman (Jira)
Niclas Hedhman created PLC4X-205:


 Summary: Incorrect shutdown sequence on error
 Key: PLC4X-205
 URL: https://issues.apache.org/jira/browse/PLC4X-205
 Project: Apache PLC4X
  Issue Type: Bug
  Components: Core
Reporter: Niclas Hedhman



In the testcase below, there is a permission problem and I think because of 
that the closing of channel and buffers are out of order/state.


[code]
11:59:51.855 [pool-1-thread-1] WARN  i.n.c.AbstractChannelHandlerContext - 
Failed to mark a promise as failure because it has succeeded already: 
DefaultChannelPromise@63ab80ee(success)
java.lang.IllegalStateException: close() must be invoked after the channel is 
closed.
at 
io.netty.channel.ChannelOutboundBuffer.close(ChannelOutboundBuffer.java:683)
at 
io.netty.channel.ChannelOutboundBuffer.close(ChannelOutboundBuffer.java:711)
at 
io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:741)
at 
io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:607)
at 
io.netty.channel.DefaultChannelPipeline$HeadContext.close(DefaultChannelPipeline.java:1352)
at 
io.netty.channel.AbstractChannelHandlerContext.invokeClose(AbstractChannelHandlerContext.java:622)
at 
io.netty.channel.AbstractChannelHandlerContext.close(AbstractChannelHandlerContext.java:606)
at 
io.netty.channel.AbstractChannelHandlerContext.close(AbstractChannelHandlerContext.java:472)
at 
io.netty.channel.DefaultChannelPipeline.close(DefaultChannelPipeline.java:957)
at io.netty.channel.AbstractChannel.close(AbstractChannel.java:232)
at 
io.netty.channel.ChannelFutureListener$2.operationComplete(ChannelFutureListener.java:56)
at 
io.netty.channel.ChannelFutureListener$2.operationComplete(ChannelFutureListener.java:52)
at 
io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
at 
io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:551)
at 
io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
at 
io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:183)
at 
io.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:95)
at io.netty.bootstrap.Bootstrap$3.run(Bootstrap.java:248)
at 
io.netty.channel.ThreadPerChannelEventLoop.run(ThreadPerChannelEventLoop.java:69)
at 
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Thread.java:748)
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.26 s 
<<< FAILURE! - in 
org.apache.plc4x.java.utils.rawsockets.netty.RawSocketChannelTest
[ERROR] doConnect  Time elapsed: 2.478 s  <<< ERROR!
org.pcap4j.core.PcapNativeException: lo: You don't have permission to capture 
on that device (socket: Operation not permitted)
[code]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)