Programming for experts
P.
108 of 349
Playing
Useful
Encoding at C14
Windows, OSX or Linux
After the preset time the recoding will restart in code-part 3. The first stored values are overwritten ,
the old values are preserved, which can disturb. Therefore in the above code-part 4 a possibly
existing timestamp out of a previous recording is deleted.
Playing of a recording
The playing of a recording is relatively simple. For this purpose there are only the group address and
the raw data is “loaded” (strings) and these are written to the bus. In this case the timer from code-
part 3 has to be restarted. The present countdown time on
Timer
is compared with the timestamp in
Timestamp
and initialize a letter when falling below of the time:
Code-part 5
if Sim_Play and Timer<convert(stringcast(TimeStamp,1u32,Position),0u64) then {
SimGA_Out=stringcast(Recorder,0u16,Position);
SimGA_Len=stringcast(Recorder,0,P2u16);
SimGA_Val=stringcast(Data,0u32,Position);
if SimGA_Len==1 then write(address(SimGA_Out),convert(SimGA_Val,EIN)) endif;
if SimGA_Len==2 then write(address(SimGA_Out),convert(SimGA_Val,0)) endif;
if SimGA_Len==3 then write(address(SimGA_Out),convert(SimGA_Val,0u16)) endif;
if SimGA_Len==4 then write(address(SimGA_Out),SimGA_Val) endif;
Position=P4u16;
} endif
The data types due to the use of the raw data need not be observed. Only the length of telegrams is
to be evaluated so that they correspond to those of the recording.
The macro-library EnertexPresence.lib is realised in this manner.
In the library the recording will be broken down into smaller day intervals and assembled later when
playing. The recording then starts each to the next day interval.
The KNX
TM
standard requires that devices with 14-byte messages („c14“ types) have to implement
only the ASCII code. This is allowed in an extension optional ISO8859-1, which itself exists only from
1-byte character (comp.
http://de.wikipedia.org/wiki/ISO_8859-1
).
The specification of the string in the Enertex® EibStudio follows the coding of the operating system,
so that e.g. Windows XP, German version, the ° character (MASCULINE ORDINAL INDICATOR) is
handed over as a one-byte 0xBA to the parser.
If you work under OSX, 10.6.8, with the Enertex® EibStudio, so is the system encoding UTF-8. In
this case the ° character is a 2-bytes character (0xC2BA) and the EibParser throws out an error
message that this is not allowed.
Accordingly the EibParser compiled in the WinXP version of Enertex® EibStudio
st=$10 °C$c14
without problems, but not on OSX. In the first case the °-character it is a permissible 1-byte
character, in the second case an impermissible 2-bytes character. The offset 0xC2 is not constant:
e.g. “ä” appears in 8859-15 the 8-bit value 0xE4 on the other hand in UTF-8 the 16-bit value 0xc3a4.
In general it can be stated: Windows-XP and Win7 users (in the German version) can use that °-
character and Umlauts easily, OSX or Linux user not respectively is here crucial coding system for
the application.
Will you still use an extended ASCII set of IS8859-15, must be used for UTF-8 systems with the
following construct.
string=convert(encode($Hällo °C$,$utf-8$c14,$iso8859-15$c14),$$c14)
The problem of encoding occurs only in the use of special characters in the c14 string, because this
has to be represented as a 1-byte ASCII. All other strings (cX with X from 1 to 65534) are
automatically converted from Enertex® EibStudio into UTF-8 encoding and platform independent.
Therefore the instruction time is not platform independent e.g. would certainly lead under Windows
XP at an invalid character on the bus.
To create a code for c14 strings platform independent, must therefore be resorted to the compiler
directive #ifdef and the predefined constants OSX, WIN and LINUX:
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]