Programming - First steps
P.
65 of 349
You must have an e-mail account
with a provider.
Setup via dialog ...
... or by hand
Configuration of mail
$ $ : Character string with up to
1400 characters
sendudp
readudp
split: Splitting of 1400-Strings
find: Looking in 1400-Strings
size: Size of 1400-Strings
sendmail
Figure 25: E-mail configuration
After the “OK“, the entered data will appear in the user program as indicated in Figure 26 and can
also be edited directly.
Figure 26: E-Mail Setup
Now, the rest is fairly quickly done - you are already very familiar with the syntax of the Enertex
®
EibPC. What do you only need to know: What are the functions to the UDP and mail delivery? How
do you handle and define larger character strings (more than 14 characters)?
Initially, the program, then the explanations:
[MailConf]
// E-mail configuration
[email protected]
smtp.gmx.de
[email protected]
Supermollycoddle
1
[EibPC]
// Init: Saving of Title
Title=$ $
if delay(systemstart(),10000u64) then write ('1/0/0'b01,EIN) endif
if ('1/0/0'b01) then write('1/0/1'b01, EIN); Title=$ $;TitleNr=0 endif
// Transmission of Start Music
if delay('1/0/1'b01,4000u64) then sendudp(3807u16,192.168.22.25,$ Start Music$) endif
// Strings for processing
StringPlayer= $ $
KNXTitle=$ $c14
TitleNr=0
Port=0u16;IP=0u32
Pattern=$Play Music: $
// Receive of title
if event(readudp(Port,IP,StringPlayer)) then
\\
KNXTitle= convert(split(StringPlayer,find(StringPlayer,Pattern,0u16)+size(Pattern) ,END),KNXTitle); \\
write('1/1/1'c14,KNXTitle);
\\
Title=Title+split(StringPlayer,find(StringPlayer,$Play Music: $,0u16),END); \\
TitleNr= 1 endif
if TitleNr==10 then sendmail([email protected]$, $A Hello from EIBPC$,Title);
\\
sendudp(3807u16,192.168.22.21,$ Stop Music$);
\\
TitleNr=11 endif
if delay(TitleNr==11, 5000u64) then write('1/0/1'b01, OFF) endif
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]