Rev 23 | Rev 25 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*
* Copyright (C) 2015 by Andreas Theofilu <andreas@theosys.at>
*
* All rights reserved. No warranty, explicit or implicit, provided.
*
* NOTICE: All information contained herein is, and remains
* the property of Andreas Theofilu and his suppliers, if any.
* The intellectual and technical concepts contained
* herein are proprietary to Andreas Theofilu and its suppliers and
* may be covered by European and Foreign Patents, patents in process,
* and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Andreas Theofilu.
*/
PROGRAM_NAME='main'
DEFINE_DEVICE
dvMDB 0:4:0; // Network device
// Panels
dvTP1 10001:1:0;
dvTP2 10002:1:0;
dvTP3 10003:1:0;
dvTP4 10004:1:0;
dvTP5 10005:1:0;
dvTP6 10006:1:0;
dvTP1_mdb 10001:2:0;
dvTP2_mdb 10002:2:0;
dvTP3_mdb 10003:2:0;
dvTP4_mdb 10004:2:0;
dvTP5_mdb 10005:2:0;
dvTP6_mdb 10006:2:0;
// Virtual devices
vdvMDB 33000:1:0; // Virtual device for communicating
DEFINE_VARIABLE
char sIP[] = '10.10.10.128';
integer nPort = 11003;
dev dvTPs[] = { dvTP1, dvTP2, dvTP3, dvTP4, dvTP5, dvTP6 };
dev dvTPs_mdb[] = { dvTP1_mdb, dvTP2_mdb, dvTP3_mdb, dvTP4_mdb, dvTP5_mdb, dvTP6_mdb };
define_module 'MDB_Comm' MDBC(dvMDB, vdvMDB, sIP, nPort);
define_module 'MDB_UI' MDBU(dvTPs, vdvMDB);
define_event
data_event[dvTPs]
{
string:
{
stack_var integer pan;
pan = get_last(dvTPs);
if (find_string(DATA.TEXT, 'KEYP-', 1))
{
remove_string(DATA.TEXT, 'KEYP-', 1);
send_string vdvMDB,"'KEYPAD:',itoa(pan),':',DATA.TEXT,';'";
}
if (find_string(DATA.TEXT, 'KEYB-', 1))
{
remove_string(DATA.TEXT, 'KEYB-', 1);
send_string vdvMDB,"'KEYBOARD:',itoa(pan),':',DATA.TEXT,';'";
}
}
}