149 lines
3.4 KiB
Protocol Buffer
149 lines
3.4 KiB
Protocol Buffer
##########################################################################
|
|
# This is an example and debug protocol file for StreamDevice.
|
|
#
|
|
# (C) 2010 Dirk Zimoch (dirk.zimoch@psi.ch)
|
|
#
|
|
# This file is part of StreamDevice.
|
|
#
|
|
# StreamDevice is free software: You can redistribute it and/or modify
|
|
# it under the terms of the GNU Lesser General Public License as published
|
|
# by the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# StreamDevice is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Lesser General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public License
|
|
# along with StreamDevice. If not, see https://www.gnu.org/licenses/.
|
|
#########################################################################/
|
|
|
|
# example stream protocol file
|
|
|
|
Terminator = CR LF;
|
|
ReplyTimeout = 10000; # 10 sec is very long, for keyboard input
|
|
ReadTimeout = 1000; # also long for keyboard input
|
|
|
|
binary {
|
|
out "%B\x00\xff";
|
|
}
|
|
|
|
# note the field access
|
|
ai {
|
|
out "%(NAME)s [int] ? ";
|
|
in "%i"; # read to RVAL and convert
|
|
}
|
|
|
|
set-ao {
|
|
out '%(NAME)s = %f %(EGU)s [0x%04x]';
|
|
}
|
|
|
|
li {
|
|
out "%(NAME)s [int] ? ";
|
|
in "%i";
|
|
}
|
|
|
|
lo {
|
|
out '%(NAME)s = %i = %#x = %b(bin) = %D(BCD)';
|
|
}
|
|
|
|
bi {
|
|
out "%(NAME)s [0 or 1] ? ";
|
|
in "%i";
|
|
}
|
|
|
|
# using variables
|
|
s0 = false;
|
|
s1 = true;
|
|
bo {
|
|
out '%(NAME)s = %i = %{\${s0}|\${s1}} = "%s"';
|
|
}
|
|
|
|
enums
|
|
{
|
|
out "%{choice0|choice1|choice2} %d %s";
|
|
}
|
|
|
|
checksum {
|
|
out "%s%<sum> sum";
|
|
out "%s%<nsum> nsum";
|
|
out "%s%<-sum> -sum";
|
|
out "%s%<notsum> notsum";
|
|
out "%s%<~sum> ~sum";
|
|
out "%s%<xor> xor";
|
|
out "%s%<crc8> crc8";
|
|
out "%s%<ccitt8> ccitt8";
|
|
out "%s%<sum16> sum16";
|
|
out "%s%<crc16> crc16";
|
|
out "%s%<crc16r> crc16r";
|
|
out "%s%<ccitt16> ccitt16";
|
|
out "%s%<ccitt16a> ccitt16 with augment";
|
|
out "%s%<sum32> sum32";
|
|
out "%s%<crc32> crc32";
|
|
out "%s%<crc32r> crcr32";
|
|
out "%s%<jamcrc> jamcrc";
|
|
out "%s%<adler32> adler32";
|
|
|
|
out "%s%0<sum> sum (ASCII)";
|
|
out "%s%0<nsum> nsum (ASCII)";
|
|
out "%s%0<-sum> -sum (ASCII)";
|
|
out "%s%0<notsum> notsum (ASCII)";
|
|
out "%s%0<~sum> ~sum (ASCII)";
|
|
out "%s%0<xor> xor (ASCII)";
|
|
out "%s%0<crc8> crc8 (ASCII)";
|
|
out "%s%0<ccitt8> ccitt8 (ASCII)";
|
|
out "%s%0<sum16> sum16 (ASCII)";
|
|
out "%s%0<crc16> crc16 (ASCII)";
|
|
out "%s%0<crc16r> crc16r (ASCII)";
|
|
out "%s%0<ccitt16> ccitt16 (ASCII)";
|
|
out "%s%0<ccitt16a> ccitt16 with augment (ASCII)";
|
|
out "%s%0<sum32> sum32 (ASCII)";
|
|
out "%s%0<crc32> crc32 (ASCII)";
|
|
out "%s%0<crc32r> crcr32 (ASCII)";
|
|
out "%s%0<jamcrc> jamcrc (ASCII)";
|
|
out "%s%0<adler32> adler32 (ASCII)";
|
|
out "%s%0<hexsum8> hexsum8 (ASCII)";
|
|
}
|
|
|
|
command {
|
|
out "%s";
|
|
}
|
|
|
|
info {
|
|
out "%s";
|
|
in "%39c";
|
|
}
|
|
|
|
read {
|
|
in "%39c";
|
|
}
|
|
|
|
spy {
|
|
extraInput=ignore;
|
|
PollPeriod = 10;
|
|
in "%39c";
|
|
}
|
|
|
|
# accessing fields
|
|
calcout {
|
|
out "OVAL=%f A=%(A)f B=%(B)f C=%(C)f";
|
|
}
|
|
|
|
scalcout {
|
|
out "OVAL=%f SOV=%s A=%(A)f B=%(B)f AA=%(AA)s";
|
|
}
|
|
|
|
# output an array of strings
|
|
string_wave_out {
|
|
separator = ", ";
|
|
out "waveform %(NAME)s = (%s)";
|
|
}
|
|
|
|
char_wave_in {
|
|
outterminator = "";
|
|
out CR LF "Enter String: ";
|
|
in "%1000c";
|
|
out 'Got: "%s"' CR LF;
|
|
}
|