Re: [DISCUSS] Add some sort of RAW datatype?

2021-10-30 Thread Cesar Garcia
Hi everyone,

Hello,

Excellent, definitely help for type conversion.

Kind regards,

El sáb, 30 oct 2021 a las 9:23, Christofer Dutz ()
escribió:

> Hi all,
>
> We recently added the mspec simple type "byte" in order to work with
> byte-data without having to care about, if this is a signed byte (like in
> Java) or an unsigned byte (like everywhere else) ... being able to work
> with byte[] makes a lot of things a lot easier.
>
> Now I thought: What if our users want to do the same? If they use a
> BYTE-array something pretty unfortunate happens, as each byte is split up
> into 8 bit/BOOL. Unfortunately we currently don't have the same option to
> pass along bytes to the users application. So I thought: How about we add a
> type "RAW" (As byte is already defined otherwiese) and this simpy returns a
> "byte" or "byte[]" in case of reading an array of values?
>
> Chris
>
>

-- 
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*

*Cel: +58 414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automat...@siemens.com
*


Need to change the way we reference subtypes directly

2021-10-30 Thread Christofer Dutz
Hi all,

part of the new additions for mspec are the ability to reference discriminated 
subtypes directly.
However I think with this we opened pandora's box ;-)

We even noticed that it was already possible to reference sub-types as Ben was 
using it in his new OPC-UA driver.
The problem however is, that this only works if the parent type doesn't have 
any fields at all.
For BacNet however this doesn't apply. So to be correct, we need to not call 
"MyCoolSubtypeIO.staticParse", but we must call 
"MyCoolParentTypeIO.staticParse" and pass along the information needed to make 
it choose the "MyCoolSubtype" type.
So in general when referencing subtypes, we need to pass the arguments we would 
also need to pass along as if we were using the parent type. Mspec then 
automatically generates a type-cast in the end.

MyCoolSubtype coolValue = (MyCoolSubtype) 
MyCoolParentTypeIO.staticParse(readBuffer, someValue, someOtherValue);


For this to work in PLC4X in it's current state, the opc-ua mspec generation 
would need a minor tweak to change this:

['"15619"' PubSubConnectionDataType
[simple PascalString 'name']
[reserved uint 7 '0x00']
[simple bit 'enabled']
[simple Variant 'publisherId']
[simple PascalString 'transportProfileUri']
[simple ExtensionObject('true') 'address']
[simple int 32 'noOfConnectionProperties']

[array ExtensionObjectDefinition('"14535"') 'connectionProperties' count 
'noOfConnectionProperties']
[simple ExtensionObject('true') 'transportSettings']
[simple int 32 'noOfWriterGroups']
[array PubSubGroupDataType  'writerGroups' count 'noOfWriterGroups']
[simple int 32 'noOfReaderGroups']
[array PubSubGroupDataType  'readerGroups' count 'noOfReaderGroups']

]


To something like this:

['"15619"' PubSubConnectionDataType
[simple PascalString 'name']
[reserved uint 7 '0x00']
[simple bit 'enabled']
[simple Variant 'publisherId']
[simple PascalString 'transportProfileUri']
[simple ExtensionObject('true') 'address']
[simple int 32 'noOfConnectionProperties']

[array ExtensionObjectDefinition('"14535"') 'connectionProperties' count 
'noOfConnectionProperties']
[simple ExtensionObject('true') 'transportSettings']
[simple int 32 'noOfWriterGroups']
[array PubSubGroupDataType('"15611"')  'writerGroups' count 
'noOfWriterGroups']
[simple int 32 'noOfReaderGroups']
[array PubSubGroupDataType('"15611"')  'readerGroups' count 
'noOfReaderGroups']

]

Chris


[DISCUSS] Add some sort of RAW datatype?

2021-10-30 Thread Christofer Dutz
Hi all,

We recently added the mspec simple type "byte" in order to work with byte-data 
without having to care about, if this is a signed byte (like in Java) or an 
unsigned byte (like everywhere else) ... being able to work with byte[] makes a 
lot of things a lot easier.

Now I thought: What if our users want to do the same? If they use a BYTE-array 
something pretty unfortunate happens, as each byte is split up into 8 bit/BOOL. 
Unfortunately we currently don't have the same option to pass along bytes to 
the users application. So I thought: How about we add a type "RAW" (As byte is 
already defined otherwiese) and this simpy returns a "byte" or "byte[]" in case 
of reading an array of values?

Chris