Commit 830b1a4f authored by Pavel Vainerman's avatar Pavel Vainerman

inital commit

parents
Pavel Vainerman <pv@etersoft.ru>
Vitaly Lipatov <lav@etersoft.ru>
Anton Korbin <ahtoh@etersoft.ru>
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
############################################################################
# This file is part of the UniSet library #
############################################################################
SUBDIRS = UniSetTypes Processes Services
include $(top_builddir)/conf/common.mk
############################################################################
# This file is part of the UniSet library #
############################################################################
# CC- HH-
CCDIR=$(top_builddir)/src/Processes
HHDIR=$(top_builddir)/include
# IDL
IDLFILES=IOController_i.idl
#UniSetObserver_i.idl
include $(top_builddir)/conf/idl.mk
idl_include_HEADERS = *.idl
idl_includedir = $(datadir)/idl/@PACKAGE@/Processes
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2005/01/28 20:27:06 $
* \version $Id: UniSetObserver_i.idl,v 1.4 2005/01/28 20:27:06 vitlav Exp $
*/
// --------------------------------------------------------------------------
#ifndef UniSetObserver_i_IDL_
#define UniSetObserver_i_IDL_
// --------------------------------------------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
// --------------------------------------------------------------------------------------------------------------
/*!
* \interface UniSetObserver_i
* \brief ""
*/
interface UniSetObserver_i
{
//
exception NameNotFound
{
string err;
};
void attach( in UniSetTypes::ObjectId id, in UniSetTypes::ObjectId fromid ) raises(NameNotFound);
void detach( in UniSetTypes::ObjectId id, in UniSetTypes::ObjectId fromid ) raises(NameNotFound);
};
// --------------------------------------------------------------------------------------------------------------
#endif
\ No newline at end of file
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2005/11/01 21:44:53 $
* \version $Id: DBServer_i.idl,v 1.5 2005/11/01 21:44:53 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef DBServer_i_IDL_
#define DBServer_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
#include "../UniSetTypes/UniSetObject_i.idl"
// --------------------------------------------------------------------------
/*!
* \interface DBServer_i
* \brief
*/
interface DBServer_i: UniSetObject_i
{
//
exception DBError
{
string errmsg;
};
void query(in string query) raises(DBError);
string hostname();
string dbname();
};
#endif
\ No newline at end of file
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2005/01/28 20:27:06 $
* \version $Id: InfoServer_i.idl,v 1.4 2005/01/28 20:27:06 vitlav Exp $
*/
// --------------------------------------------------------------------------
#ifndef InfoServer_i_IDL_
#define InfoServer_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
#include "../UniSetTypes/UniSetObject_i.idl"
// --------------------------------------------------------------------------
/*!
* \interface InfoServer_i
* \brief
*/
interface InfoServer_i: UniSetObject_i
{
//
exception MsgNotFound
{
UniSetTypes::MessageCode bad_code;
};
//
exception MsgBadRange
{
};
/*! */
void ackMessage(in UniSetTypes::MessageCode mid, in UniSetTypes::ConsumerInfo ci,
in UniversalIO::UIOCommand cmd, in boolean acknotify ) raises(MsgNotFound);
/*! */
void ackMessageRange(in UniSetTypes::MessageCode from, in UniSetTypes::MessageCode to,
in UniSetTypes::ConsumerInfo ci,
in UniversalIO::UIOCommand cmd, in boolean acknotify ) raises(MsgNotFound,MsgBadRange);
};
// --------------------------------------------------------------------------
#endif
############################################################################
# This file is part of the UniSet library #
############################################################################
# CC- HH-
CCDIR=$(top_builddir)/src/Services
HHDIR=$(top_builddir)/include
# IDL
IDLFILES=TimerService_i.idl InfoServer_i.idl
include $(top_builddir)/conf/idl.mk
idl_include_HEADERS = *.idl
idl_includedir = $(datadir)/idl/@PACKAGE@/Services
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2005/01/28 20:27:06 $
* \version $Id: NetService_i.idl,v 1.4 2005/01/28 20:27:06 vitlav Exp $
*/
// --------------------------------------------------------------------------
#ifndef NetService_i_IDL_
#define BaseProcess_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
// --------------------------------------------------------------------------
/*!
* \interface NetService_i
*/
interface NetService_i
{
void registration( in BaseObjectName name, in Object ref );
void unregistration( in BaseObjectName name, in Object ref );
Object resolve(in BaseObjectName name);
Object resolveid( in BaseObjectId name);
};
#endif
\ No newline at end of file
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2005/11/01 21:44:53 $
* \version $Id: RepositoryAgent_i.idl,v 1.5 2005/11/01 21:44:53 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef RepositoryAgent_i_IDL_
#define RepositoryAgent_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetObject_i.idl"
// --------------------------------------------------------------------------------------------------------------
/*!
* \interface RepositoryAgent_i
* \brief
* .
* ,
* , . .
*/
interface RepositoryAgent_i: UniSetObject_i
{
//
exception NameNotFound
{
string errmsg;
};
exception ResolveError
{
string errmsg;
};
// void registration( in BaseObjectName name, in Object ref );
// void unregistration( in BaseObjectName name, in Object ref );
// Object resolve(in BaseObjectName name) raises(NameNotFound, ResolveError);
Object resolveid( in UniSetTypes::ObjectId name) raises(NameNotFound, ResolveError);
};
#endif
\ No newline at end of file
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2005/01/28 21:24:12 $
* \version $Id: TimerService_i.idl,v 1.1 2005/01/28 21:24:12 vitlav Exp $
*/
// --------------------------------------------------------------------------
#ifndef TimerService_i_IDL_
#define TimerService_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
#include "../UniSetTypes/UniSetObject_i.idl"
// --------------------------------------------------------------------------
/*!
* \interface TimerService_i
*/
interface TimerService_i: UniSetObject_i
{
/*!
*
*/
exception LimitTimers
{
long maxTimers;
};
/*! id
* ( )
*/
exception TimerAlreadyExist
{
};
/*!
* ۣ
*/
exception TimeMSLowLimit
{
long lowLimitMS;
};
/*! */
struct Timer
{
UniSetTypes::TimerId timerid;
long timeMS;
short ticks;
short msgPriority;
};
/*! */
void askTimer( in Timer ti, in UniSetTypes::ConsumerInfo ci )
raises(LimitTimers, TimerAlreadyExist, TimeMSLowLimit);
// void setSysTime(...);
// void getSysTime(...);
};
#endif
\ No newline at end of file
############################################################################
# This file is part of the UniSet library #
############################################################################
# CC- HH-
CCDIR=$(top_builddir)/src/ObjectRepository
HHDIR=$(top_builddir)/include
# IDL
IDLFILES=UniSetTypes_i.idl UniSetObject_i.idl ObjectsManager_i.idl
include $(top_builddir)/conf/idl.mk
idl_include_HEADERS = *.idl
idl_includedir = $(datadir)/idl/@PACKAGE@/UniSetTypes
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2007/12/18 20:24:11 $
* \version $Id: ObjectsManager_i.idl,v 1.2 2007/12/18 20:24:11 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef ObjectsManager_i_IDL_
#define ObjectsManager_i_IDL_
// ---------------------------------------------------------------------------
#include "UniSetObject_i.idl"
#include "UniSetTypes_i.idl"
// ---------------------------------------------------------------------------
//module UniSet
//{
/*!
* \interface ObjectsManager_i
* \brief
* \author Pavel Vainerman <pv>
* \version
* \date September 2001-
*
* .
* .
*/
interface ObjectsManager_i : UniSetObject_i
{
/*!< */
void broadcast(in UniSetTypes::TransportMessage msg);
/*! ()
* \param MaxLength -
* SimpleInfo.
* \note
* MaxLength,
* MaxLength . <=,
* .
* \note .
* ,
*
* .. .. ... MaxLength
* .
* \todo ,
* ( >1000 ) ...
*/
UniSetTypes::SimpleInfoSeq getObjectsInfo( in long MaxLength );
};
//}; // end of module UniSet
#endif
// --------------------------------------------------------------------------------------------------------------
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2007/12/17 22:50:59 $
* \version $Id: UniSetObject_i.idl,v 1.4 2007/12/17 22:50:59 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef UniSetObject_i_IDL_
#define UniSetObject_i_IDL_
// ---------------------------------------------------------------------------
#include "UniSetTypes_i.idl"
// ---------------------------------------------------------------------------
//module UniSet
//{
/*!
* \interface UniSetObject_i
* \brief
* \author Pavel Vainerman <pv>
*
* . .
*
*/
interface UniSetObject_i
{
UniSetTypes::ObjectId getId(); /*!< */
UniSetTypes::ObjectType getType(); /*!< */
UniSetTypes::SimpleInfo getInfo(); /*!< */
boolean exist(); /*!< */
/*! */
void push(in UniSetTypes::TransportMessage msg);
};
//}; // end of module UniSet
#endif
// --------------------------------------------------------------------------------------------------------------
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2009/01/23 23:56:54 $
* \version $Id: UniSetTypes_i.idl,v 1.9 2009/01/23 23:56:54 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef UniSetTypes_i_IDL_
#define UniSetTypes_i_IDL_
// --------------------------------------------------------------------------
//module UniSet
//{
module UniSetTypes
{
typedef string<100> BaseObjectName;
typedef long ObjectId; /*!< */
typedef long MessageCode; /*!< */
typedef long ThresholdId; /*!< */
typedef long TimerId; /*!< */
typedef string<30> ObjectType; /*!< */
typedef octet ByteOfMessage; /*!< */
typedef ByteOfMessage RawDataOfTransportMessage[150]; /*!< */
/*!
*
* \par
* .
* .
*/
struct TransportMessage
{
RawDataOfTransportMessage data;
};
/*!
*
*/
struct NodeInfo
{
ObjectId id;
boolean connected;
ObjectId infserver;
ObjectId dbserver;
string host;
string port;
};
/*! */
struct SimpleInfo
{
ObjectId id;
string info;
};
typedef sequence<SimpleInfo> SimpleInfoSeq;
/*! */
struct ConsumerInfo
{
ObjectId id; /*!< */
ObjectId node; /*!< */
};
/*! */
typedef sequence<ObjectId> IDSeq;
};// end of module UniSetTypes
module UniversalIO
{
/*!
* /
*/
enum IOTypes
{
DigitalInput,
DigitalOutput,
AnalogInput,
AnalogOutput
};
/*! / */
enum UIOCommand
{
UIONotify, /*!< */
UIODontNotify, /*!< */
UIONotifyChange, /*!< , ( ) */
UIONotifyFirstNotNull /*!< . , "0" */
};
}; // end of module UniversalIO
//}; // end of module UniSet
// --------------------------------------------------------------------------------------------------------------
#endif // of UniSetTypes_i_IDL
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). Here is a another example:
/bin/bash ./configure CONFIG_SHELL=/bin/bash
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
############################################################################
# This file is part of the UniSet library #
############################################################################
SUBDIRS=IDL src lib include Utilities extentions docs
include $(top_builddir)/conf/common.mk
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSet.pc
uniset-0.4.6: Sat Jan 29 00:58:58 2005
tested with gcc3.4
moved development tree to SourceForge
LDFLAGS configure
LIBS
, libUniset
Utilities/ClassGen xsltproc
PLCNet
- "uniset-check"
(saveState/Value, getState/Value), setState/Value ..)
- , Debug syslog ( ݣ )
- (IOR) ...
( IORFile omniNames).
- ObjectIndex_ArrayXML. .. vector, XML.
- sstream str(), ss.rdbuf()->freeze(0);
(http://www.intuit.ru/department/pl/cpp/17/2.html)
\ No newline at end of file
############################################################################
# This file is part of the UniSet library #
############################################################################
bin_PROGRAMS = uniset-admin
uniset_admin_SOURCES = admin.cc
uniset_admin_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_admin_CPPFLAGS = -I$(top_builddir)/lib
include $(top_builddir)/conf/setting.mk
#!/bin/sh
START=uniset-start.sh
${START} -f "./uniset-admin --confile test.xml --`basename $0 .sh` $1 $2 $3 $4"
#!/bin/sh
#
ln -s -f admin.sh start
ln -s -f admin.sh exist
ln -s -f admin.sh finish
ln -s -f admin.sh foldUp
ln -s -f admin.sh info
ln -s -f admin.sh alarm
ln -s -f admin.sh create
#ln -s -f admin.sh setState
#ln -s -f admin.sh dbcreate
#ln -s -f admin.sh statistic
#ln -s -f admin.sh database
ln -s -f admin.sh logrotate
ln -s -f admin.sh omap
ln -s -f admin.sh msgmap
ln -s -f admin.sh anotify
ln -s -f admin.sh dnotify
ln -s -f admin.sh saveValue
ln -s -f admin.sh saveState
ln -s -f admin.sh setValue
ln -s -f admin.sh setState
ln -s -f admin.sh getValue
ln -s -f admin.sh getState
ln -s -f admin.sh getRawValue
ln -s -f admin.sh getCalibrate
ln -s -f admin.sh help
ln -s -f admin.sh oinfo
ln -s -f /usr/bin/uniset-stop.sh stop.sh
ln -s -f ../../conf/test.xml test.xml
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2007/06/17 21:30:49 $
* \version $Id: DBInterface.cc,v 1.5 2007/06/17 21:30:49 vpashka Exp $
*/
// --------------------------------------------------------------------------
#include <sstream>
#include "DBInterface.h"
using namespace std;
// -----------------------------------------------------------------------------------------
DBInterface::DBInterface():
result(0),
lastQ(""),
queryok(false)
{
mysql = new MYSQL();
}
DBInterface::~DBInterface()
{
close();
delete mysql;
}
// -----------------------------------------------------------------------------------------
bool DBInterface::connect( const string host, const string user, const string pswd, const string dbname)
{
mysql_init(mysql);
// mysql_options(mysql,MYSQL_READ_DEFAULT_GROUP,"your_prog_name");
mysql_options(mysql,MYSQL_OPT_COMPRESS,0);
if (!mysql_real_connect(mysql,host.c_str(), user.c_str(),pswd.c_str(),dbname.c_str(),0,NULL,0))
{
cout << error() << endl;
mysql_close(mysql);
return false;
}
return true;
}
// -----------------------------------------------------------------------------------------
bool DBInterface::close()
{
mysql_close(mysql);
return true;
}
// -----------------------------------------------------------------------------------------
bool DBInterface::insert(const string q)
{
if( !mysql )
return false;
if( mysql_query(mysql,q.c_str()) )
{
queryok=false;
return false;
}
queryok=true;
return true;
}
// -----------------------------------------------------------------------------------------
bool DBInterface::query(const string q)
{
if( !mysql )
return false;
if( mysql_query(mysql,q.c_str()) )
{
queryok=false;
return false;
}
lastQ = q;
result = mysql_store_result(mysql); // _use_result - _num_rows
if( numRows()==0 )
{
queryok=false;
return false;
}
queryok=true;
return true;
}
// -----------------------------------------------------------------------------------------
bool DBInterface::nextRecord()
{
if( !mysql || !result || !queryok )
return false;
if( Row == mysql_fetch_row(result) )
return true;
return false;
}
// -----------------------------------------------------------------------------------------
const string DBInterface::error()
{
return mysql_error(mysql);
}
// -----------------------------------------------------------------------------------------
const string DBInterface::lastQuery()
{
return lastQ;
}
// -----------------------------------------------------------------------------------------
void DBInterface::freeResult()
{
if( !mysql || !result || !queryok )
return;
queryok = false;
mysql_free_result( result );
}
// -----------------------------------------------------------------------------------------
int DBInterface::insert_id()
{
if( !mysql )
return 0;
return mysql_insert_id(mysql);
}
// -----------------------------------------------------------------------------------------
unsigned int DBInterface::numCols()
{
if( result )
return mysql_num_fields(result);
return 0;
}
// -----------------------------------------------------------------------------------------
unsigned int DBInterface::numRows()
{
if( result )
return mysql_num_rows(result);
return 0;
}
// -----------------------------------------------------------------------------------------
const MYSQL_ROW DBInterface::getRow()
{
return Row;
}
// -----------------------------------------------------------------------------------------
const char* DBInterface::gethostinfo()
{
return mysql_get_host_info(mysql);
}
// -----------------------------------------------------------------------------------------
/*
bool DBInterface::createDB(const string dbname)
{
if(!mysql)
return false;
if( mysql_create_db(mysql, dbname.c_str()) )
return true;
return false;
}
// -----------------------------------------------------------------------------------------
bool DBInterface::dropDB(const string dbname)
{
if( mysql_drop_db(mysql, dbname.c_str()))
return true;
return false;
}
*/
// -----------------------------------------------------------------------------------------
MYSQL_RES* DBInterface::listFields(const string table, const string wild )
{
if( !mysql || !result )
return false;
MYSQL_RES *res = mysql_list_fields(mysql, table.c_str(),wild.c_str());
unsigned int cols = mysql_num_fields(result); // numCols();
MYSQL_ROW row=mysql_fetch_row(res);
// MYSQL_FIELD *field = mysql_fetch_fields(res);
// cout << field << " | ";
for( unsigned int i = 0; i<cols; i++)
{
cout << row[i] << " | ";
}
return res; // mysql_list_fields(mysql, table,wild);
}
// -----------------------------------------------------------------------------------------
bool DBInterface::moveToRow(int ind)
{
if(!mysql || !result)
return false;
mysql_data_seek(result, ind);
return true;
}
// -----------------------------------------------------------------------------------------
bool DBInterface::ping()
{
if(!mysql)
return false;
// mysql_ping 0
// ӣ .... ( )
return !mysql_ping(mysql);
}
// -----------------------------------------------------------------------------------------
bool DBInterface::isConnection()
{
return ping(); //!mysql;
}
// -----------------------------------------------------------------------------------------
string DBInterface::addslashes(const string& str)
{
ostringstream tmp;
for( unsigned int i=0; i<str.size(); i++ )
{
// if( !strcmp(str[i],'\'') )
if( str[i] == '\'' )
tmp << "\\";
tmp << str[i];
}
return tmp.str();
}
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2005/08/28 20:55:53 $
* \version $Id: DBInterface.h,v 1.1 2005/08/28 20:55:53 vpashka Exp $
*/
//----------------------------------------------------------------------------
#ifndef DBInterface_H_
#define DBInterface_H_
// ---------------------------------------------------------------------------
#include <string>
#include <iostream>
//#warning mysql_create define USE_OLD_FUNCTIONS
//#define USE_OLD_FUNCTIONS
#include <mysql/mysql.h>
using std::string;
// ----------------------------------------------------------------------------
class DBInterface
{
public:
DBInterface();
~DBInterface();
// bool createDB(const string dbname);
// bool dropDB(const string dbname);
MYSQL_RES * listFields(const string table, const string wild );
bool connect( const string host, const string user, const string pswd,
const string dbname);
bool close();
bool query(const string q);
const string lastQuery();
bool insert(const string q);
string addslashes(const string& str);
/*!
.
...
*/
bool ping();
/*! () */
bool isConnection();
bool nextRecord();
void freeResult();
unsigned int numCols();
unsigned int numRows();
bool moveToRow(int ind);
int insert_id();
const MYSQL_ROW getRow();
const string error();
MYSQL_ROW Row;
// *******************
const char* gethostinfo();
protected:
private:
MYSQL_RES *result;
MYSQL *mysql;
string lastQ;
bool queryok; //
};
// ----------------------------------------------------------------------------------
#endif
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman <pv>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman <pv>
* \date $Date: 2005/08/28 20:55:53 $
* \version $Id: DBServer_MySQL.h,v 1.1 2005/08/28 20:55:53 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef DBServer_MySQL_H_
#define DBServer_MySQL_H_
// --------------------------------------------------------------------------
#include <map>
#include "UniSetTypes.h"
#include "DBInterface.h"
#include "DBServer.h"
//------------------------------------------------------------------------------------------
/*!
* \brief MySQL
\par
DBServer ( DBServer_MySQL::PingTimer ) .
( ) DBServer ( DBServer::ReconnectTimer )
. , -.
\warning DBServer . .
.
\todo , ... ( )
*/
class DBServer_MySQL:
public DBServer
{
public:
DBServer_MySQL( UniSetTypes::ObjectId id );
DBServer_MySQL();
~DBServer_MySQL();
protected:
typedef std::map<int, std::string> DBTableMap;
virtual void initDB(DBInterface *db){};
virtual void initDBTableMap(DBTableMap& tblMap){};
virtual void processingMessage( UniSetTypes::VoidMessage *msg );
virtual void timerInfo( UniSetTypes::TimerMessage* tm );
virtual void sysCommand( UniSetTypes::SystemMessage* sm );
//
virtual void parse( UniSetTypes::SensorMessage* sm );
virtual void parse( UniSetTypes::DBMessage* dbmsg );
virtual void parse( UniSetTypes::InfoMessage* imsg );
virtual void parse( UniSetTypes::AlarmMessage* amsg );
virtual void parse( UniSetTypes::ConfirmMessage* cmsg );
bool writeToBase( const string& query );
virtual void init();
void createTables( DBInterface* db );
inline const char* tblName(int key)
{
return tblMap[key].c_str();
}
enum Timers
{
PingTimer, /*!< */
ReconnectTimer /*!< ( ) */
};
DBInterface *db;
int PingTime;
int ReconnectTime;
bool connect_ok; /*! */
bool activate;
private:
DBTableMap tblMap;
};
//------------------------------------------------------------------------------------------
#endif
############################################################################
# This file is part of the UniSet library #
############################################################################
lib_LTLIBRARIES = libUniSet-mysql.la
libUniSet_mysql_la_SOURCES = DBInterface.cc DBServer_MySQL.cc
libUniSet_mysql_la_LIBADD = $(top_builddir)/lib/libUniSet.la -lmysqlclient
libUniSet_mysql_la_LDFLAGS = -version-info @LIBVER@
bin_PROGRAMS = uniset-mysql-dbserver
uniset_mysql_dbserver_LDADD = libUniSet-mysql.la $(top_builddir)/lib/libUniSet.la
uniset_mysql_dbserver_SOURCES = main.cc
include $(top_builddir)/conf/setting.mk
# install
devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/mysql
// $Id: main.cc,v 1.8 2008/02/10 03:21:41 vpashka Exp $
// --------------------------------------------------------------------------
#include "Configuration.h"
#include "DBServer.h"
#include "ObjectsActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------
static void short_usage()
{
cout << "Usage: uniset-dbserver [--name ObjectId] [--confile configure.xml]\n";
}
// --------------------------------------------------------------------------
int main(int argc,char** argv)
{
try
{
if( argc > 1 && !strcmp(argv[1],"--help") )
{
short_usage();
return 0;
}
uniset_init(argc,argv,"configure.xml");
ObjectId ID = conf->getDBServer();
// ID
string name = conf->getArgParam("--name");
if( !name.empty())
{
if( ID != UniSetTypes::DefaultObjectId )
{
unideb[Debug::WARN] << "(DBServer::main): ID "
<< conf->getConfFileName() << endl;
}
ID = conf->oind->getIdByName(conf->getServicesSection()+"/"+name);
if( ID == UniSetTypes::DefaultObjectId )
{
cerr << "(DBServer::main): '" << name
<< "' . !"
<< " " << conf->getServicesSection() << endl;
return 1;
}
}
else if( ID == UniSetTypes::DefaultObjectId )
{
cerr << "(DBServer::main): " << endl;
short_usage();
return 1;
}
DBServer dbs(ID);
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&dbs));
act.run(false);
}
catch(Exception& ex)
{
cerr << "(DBServer::main): " << ex << endl;
}
catch(...)
{
cerr << "(DBServer::main): catch ..." << endl;
}
return 0;
}
############################################################################
# This file is part of the UniSet library #
############################################################################
bin_PROGRAMS = uniset-infoserver
uniset_infoserver_SOURCES = main.cc
uniset_infoserver_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_infoserver_CPPFLAGS = -I$(top_builddir)/lib $(SIGC_CFLAGS)
include $(top_builddir)/conf/setting.mk
// $Id: main.cc,v 1.13 2008/12/14 21:57:49 vpashka Exp $
// --------------------------------------------------------------------------
#include "Configuration.h"
#include "InfoServer.h"
#include "ISRestorer.h"
#include "ObjectsActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------
static void short_usage()
{
cout << "Usage: uniset-infoserver --name ObjectId [--askfile filename]"
<< " [--confile configure.xml]\n";
}
// --------------------------------------------------------------------------
int main(int argc,char** argv)
{
try
{
if( argc>1 && !strcmp(argv[1],"--help") )
{
short_usage();
return 0;
}
uniset_init(argc,argv,"configure.xml");
ObjectId ID = conf->getInfoServer();
// ID
string name = conf->getArgParam("--name");
if( !name.empty() )
{
if( ID != UniSetTypes::DefaultObjectId )
{
unideb[Debug::WARN] << "(InfoServer::main): ID "
<< conf->getConfFileName() << endl;
}
ID = conf->oind->getIdByName(conf->getServicesSection()+"/"+name);
if( ID == UniSetTypes::DefaultObjectId )
{
cerr << "(InfoServer): '" << name
<< "' . !"
<< " " << conf->getServicesSection() << endl;
return 1;
}
}
else if( ID == UniSetTypes::DefaultObjectId )
{
cerr << "(DBServer::main): " << endl;
short_usage();
return 1;
}
// ask-
string askfile = conf->getArgParam("--askfile",conf->getConfFileName());
if( askfile.empty() )
{
InfoServer is(ID,new ISRestorer_XML(askfile));
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&is));
act.run(false);
}
else
{
InfoServer is(ID);
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&is));
act.run(false);
}
}
catch(Exception& ex)
{
cerr << "(InfoServer::main): " << ex << endl;
}
catch(...)
{
cerr << "(InfoServer::main): catch ..." << endl;
}
return 0;
}
/*! $Id: MBSlave.h,v 1.6 2009/02/24 20:27:24 vpashka Exp $ */
// -------------------------------------------------------------------------
#ifndef MBSlave_H_
#define MBSlave_H_
// -------------------------------------------------------------------------
#include <map>
#include <string>
#include "modbus/ModbusRTUSlaveSlot.h"
// -------------------------------------------------------------------------
/*! MBSlave */
class MBSlave
{
public:
MBSlave( ModbusRTU::ModbusAddr addr, const std::string dev, const std::string speed, bool use485=false );
~MBSlave();
inline void setVerbose( bool state )
{
verbose = state;
}
void execute(); /*!< */
void setLog( DebugStream& dlog );
protected:
//
void sigterm( int signo );
/*! 0x01 */
ModbusRTU::mbErrCode readCoilStatus( ModbusRTU::ReadCoilMessage& query,
ModbusRTU::ReadCoilRetMessage& reply );
/*! 0x02 */
ModbusRTU::mbErrCode readInputStatus( ModbusRTU::ReadInputStatusMessage& query,
ModbusRTU::ReadInputStatusRetMessage& reply );
/*! 0x03 */
ModbusRTU::mbErrCode readOutputRegisters( ModbusRTU::ReadOutputMessage& query,
ModbusRTU::ReadOutputRetMessage& reply );
/*! 0x04 */
ModbusRTU::mbErrCode readInputRegisters( ModbusRTU::ReadInputMessage& query,
ModbusRTU::ReadInputRetMessage& reply );
/*! 0x05 */
ModbusRTU::mbErrCode forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply );
/*! 0x0F */
ModbusRTU::mbErrCode forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply );
/*! 0x10 */
ModbusRTU::mbErrCode writeOutputRegisters( ModbusRTU::WriteOutputMessage& query,
ModbusRTU::WriteOutputRetMessage& reply );
/*! 0x06 */
ModbusRTU::mbErrCode writeOutputSingleRegister( ModbusRTU::WriteSingleOutputMessage& query,
ModbusRTU::WriteSingleOutputRetMessage& reply );
/*! */
ModbusRTU::mbErrCode journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply );
/*! */
ModbusRTU::mbErrCode setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply );
/*! ̣ */
ModbusRTU::mbErrCode remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply );
ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply );
/*! ModbusRTUSlave RS */
ModbusRTUSlaveSlot* rscomm;
ModbusRTU::ModbusAddr addr; /*!< */
bool verbose;
#if 0
typedef std::map<ModbusRTU::mbErrCode,unsigned int> ExchangeErrorMap;
ExchangeErrorMap errmap; /*!< */
ModbusRTU::mbErrCode prev;
// unsigned,
// long.
long askCount; /*!< */
typedef std::map<int,std::string> FileList;
FileList flist;
#endif
private:
};
// -------------------------------------------------------------------------
#endif // MBSlave_H_
// -------------------------------------------------------------------------
/*! $Id: MBTCPServer.h,v 1.1 2008/11/22 23:22:23 vpashka Exp $ */
// -------------------------------------------------------------------------
#ifndef MBTCPServer_H_
#define MBTCPServer_H_
// -------------------------------------------------------------------------
//#include <map>
#include <string>
#include "modbus/ModbusTCPServerSlot.h"
// -------------------------------------------------------------------------
/*! MBTCPServer */
class MBTCPServer
{
public:
MBTCPServer( ModbusRTU::ModbusAddr myaddr, const std::string inetaddr, int port=502, bool verbose=false );
~MBTCPServer();
inline void setVerbose( bool state )
{
verbose = state;
}
void execute(); /*!< */
void setLog( DebugStream& dlog );
protected:
//
void sigterm( int signo );
/*! 0x01 */
ModbusRTU::mbErrCode readCoilStatus( ModbusRTU::ReadCoilMessage& query,
ModbusRTU::ReadCoilRetMessage& reply );
/*! 0x02 */
ModbusRTU::mbErrCode readInputStatus( ModbusRTU::ReadInputStatusMessage& query,
ModbusRTU::ReadInputStatusRetMessage& reply );
/*! 0x03 */
ModbusRTU::mbErrCode readOutputRegisters( ModbusRTU::ReadOutputMessage& query,
ModbusRTU::ReadOutputRetMessage& reply );
/*! 0x04 */
ModbusRTU::mbErrCode readInputRegisters( ModbusRTU::ReadInputMessage& query,
ModbusRTU::ReadInputRetMessage& reply );
/*! 0x05 */
ModbusRTU::mbErrCode forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply );
/*! 0x0F */
ModbusRTU::mbErrCode forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply );
/*! 0x10 */
ModbusRTU::mbErrCode writeOutputRegisters( ModbusRTU::WriteOutputMessage& query,
ModbusRTU::WriteOutputRetMessage& reply );
/*! 0x06 */
ModbusRTU::mbErrCode writeOutputSingleRegister( ModbusRTU::WriteSingleOutputMessage& query,
ModbusRTU::WriteSingleOutputRetMessage& reply );
/*! */
ModbusRTU::mbErrCode journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply );
/*! */
ModbusRTU::mbErrCode setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply );
/*! ̣ */
ModbusRTU::mbErrCode remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply );
ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply );
/*! ModbusSlave RS */
ModbusTCPServerSlot* sslot;
ModbusRTU::ModbusAddr addr; /*!< */
bool verbose;
#if 0
typedef std::map<ModbusRTU::mbErrCode,unsigned int> ExchangeErrorMap;
ExchangeErrorMap errmap; /*!< */
ModbusRTU::mbErrCode prev;
// unsigned,
// long.
long askCount; /*!< */
typedef std::map<int,std::string> FileList;
FileList flist;
#endif
private:
};
// -------------------------------------------------------------------------
#endif // MBTCPServer_H_
// -------------------------------------------------------------------------
bin_PROGRAMS = uniset-mbrtutest uniset-mbrtuslave-echo \
uniset-mbtcpserver-echo uniset-mbtcptest
#uniset-mbtest
uniset_mbrtutest_SOURCES = mbrtutester.cc
uniset_mbrtutest_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_mbtcptest_SOURCES = mbtcptester.cc
uniset_mbtcptest_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_mbrtuslave_echo_SOURCES = MBSlave.cc mbrtuslave.cc
uniset_mbrtuslave_echo_LDADD = $(top_builddir)/lib/libUniSet.la $(SIGC_LIBS)
uniset_mbrtuslave_echo_CPPFLAGS = $(SIGC_CFLAGS)
uniset_mbtcpserver_echo_SOURCES = MBTCPServer.cc mbtcpserver.cc
uniset_mbtcpserver_echo_LDADD = $(top_builddir)/lib/libUniSet.la $(SIGC_LIBS) $(COMCPP_LIBS)
uniset_mbtcpserver_echo_CPPFLAGS = $(SIGC_CFLAGS) $(COMCPP_CFLAGS)
#uniset_mbtest2_SOURCES = mbtester2.cc
#uniset_mbtest2_LDADD = $(top_builddir)/lib/libUniSet.la
// --------------------------------------------------------------------------
//! \version $Id: mbrtuslave.cc,v 1.2 2009/02/24 20:27:24 vpashka Exp $
// --------------------------------------------------------------------------
#include <string>
#include <getopt.h>
#include "Debug.h"
#include "MBSlave.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] = {
{ "help", no_argument, 0, 'h' },
{ "device", required_argument, 0, 'd' },
{ "verbose", no_argument, 0, 'v' },
{ "myaddr", required_argument, 0, 'a' },
{ "speed", required_argument, 0, 's' },
{ "use485F", no_argument, 0, 'y' },
{ NULL, 0, 0, 0 }
};
// --------------------------------------------------------------------------
static void print_help()
{
printf("-h|--help - this message\n");
printf("[-t|--timeout] msec - Timeout. Default: 2000.\n");
printf("[-v|--verbose] - Print all messages to stdout\n");
printf("[-d|--device] dev - use device dev. Default: /dev/ttyS0\n");
printf("[-a|--myaddr] addr - Modbus address for master. Default: 0x01.\n");
printf("[-s|--speed] speed - 9600,14400,19200,38400,57600,115200. Default: 38400.\n");
printf("[-y|--use485F] - use RS485 Fastwel.\n");
printf("[-v|--verbose] - Print all messages to stdout\n");
}
// --------------------------------------------------------------------------
int main( int argc, char **argv )
{
int optindex = 0;
int opt = 0;
int verb = 0;
string dev("/dev/ttyS0");
string speed("38400");
ModbusRTU::ModbusAddr myaddr = 0x01;
int tout = 2000;
DebugStream dlog;
int use485 = 0;
try
{
while( (opt = getopt_long(argc, argv, "hva:d:s:y",longopts,&optindex)) != -1 )
{
switch (opt)
{
case 'h':
print_help();
return 0;
case 'd':
dev = string(optarg);
break;
case 's':
speed = string(optarg);
break;
case 't':
tout = atoi(optarg);
break;
case 'a':
myaddr = ModbusRTU::str2mbAddr(optarg);
break;
case 'v':
verb = 1;
break;
case 'y':
use485 = 1;
break;
case '?':
default:
printf("? argumnet\n");
return 0;
}
}
if( verb )
{
cout << "(init): dev=" << dev << " speed=" << speed
<< " myaddr=" << ModbusRTU::addr2str(myaddr)
<< " timeout=" << tout << " msec "
<< endl;
dlog.addLevel( Debug::type(Debug::CRIT | Debug::WARN | Debug::INFO) );
}
MBSlave mbs(myaddr,dev,speed,use485);
mbs.setLog(dlog);
mbs.setVerbose(verb);
mbs.execute();
}
catch( ModbusRTU::mbException& ex )
{
cerr << "(mbtester): " << ex << endl;
}
catch(SystemError& err)
{
cerr << "(mbslave): " << err << endl;
}
catch(Exception& ex)
{
cerr << "(mbslave): " << ex << endl;
}
catch(...)
{
cerr << "(mbslave): catch(...)" << endl;
}
return 0;
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
//! \version $Id: mbslave.cc,v 1.5 2009/02/24 20:27:24 vpashka Exp $
// --------------------------------------------------------------------------
#include <string>
#include <getopt.h>
#include "Debug.h"
#include "MBSlave.h"
#include "ComPort485F.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] = {
{ "help", no_argument, 0, 'h' },
{ "device", required_argument, 0, 'd' },
{ "verbose", no_argument, 0, 'v' },
{ "myaddr", required_argument, 0, 'a' },
{ "speed", required_argument, 0, 's' },
{ "f485", no_argument, 0, 'g' },
{ NULL, 0, 0, 0 }
};
// --------------------------------------------------------------------------
static void print_help()
{
printf("-h|--help - this message\n");
printf("[-t|--timeout] msec - Timeout. Default: 2000.\n");
printf("[-v|--verbose] - Print all messages to stdout\n");
printf("[-d|--device] dev - use device dev. Default: /dev/ttyS0\n");
printf("[-a|--myaddr] addr - Modbus address for master. Default: 0x01.\n");
printf("[-s|--speed] speed - 9600,14400,19200,38400,57600,115200. Default: 38400.\n");
printf("[-v|--verbose] - Print all messages to stdout\n");
printf("[-g|--f485] - Use 485 Fastwel\n");
}
// --------------------------------------------------------------------------
int main( int argc, char **argv )
{
int optindex = 0;
int opt = 0;
int verb = 0;
int f485 = 0;
string dev("/dev/ttyS0");
string speed("38400");
ModbusRTU::ModbusAddr myaddr = 0x01;
int tout = 2000;
DebugStream dlog;
try
{
while( (opt = getopt_long(argc, argv, "hva:d:s:",longopts,&optindex)) != -1 )
{
switch (opt)
{
case 'h':
print_help();
return 0;
case 'd':
dev = string(optarg);
break;
case 's':
speed = string(optarg);
break;
case 't':
tout = atoi(optarg);
break;
case 'a':
myaddr = ModbusRTU::str2mbAddr(optarg);
break;
case 'v':
verb = 1;
break;
case 'g':
f485 = 1;
break;
case '?':
default:
printf("? argumnet\n");
return 0;
}
}
if( verb )
{
cout << "(init): dev=" << dev << " speed=" << speed
<< " myaddr=" << ModbusRTU::addr2str(myaddr)
<< " timeout=" << tout << " msec "
<< endl;
dlog.addLevel( Debug::type(Debug::CRIT | Debug::WARN | Debug::INFO) );
}
if( f485 )
{
ComPort485F* cp;
if( dev == "/dev/ttyS2" )
cp = new ComPort485F(dev,5);
else if( dev == "/dev/ttyS3" )
cp = new ComPort485F(dev,6);
else
{
cerr << "dev must be /dev/ttyS2 or /dev/tytS3" << endl;
return 1;
}
MBSlave mbs(cp,myaddr,speed);
mbs.setLog(dlog);
mbs.setVerbose(verb);
mbs.execute();
}
else
{
MBSlave mbs(myaddr,dev,speed);
mbs.setLog(dlog);
mbs.setVerbose(verb);
mbs.execute();
}
}
catch( ModbusRTU::mbException& ex )
{
cerr << "(mbtester): " << ex << endl;
}
catch(SystemError& err)
{
cerr << "(mbslave): " << err << endl;
}
catch(Exception& ex)
{
cerr << "(mbslave): " << ex << endl;
}
catch(...)
{
cerr << "(mbslave): catch(...)" << endl;
}
return 0;
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
//! \version $Id: mbtcpserver.cc,v 1.1 2008/11/22 23:22:23 vpashka Exp $
// --------------------------------------------------------------------------
#include <string>
#include <cc++/socket.h>
#include <getopt.h>
#include "Debug.h"
#include "MBTCPServer.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] = {
{ "help", no_argument, 0, 'h' },
{ "iaddr", required_argument, 0, 'i' },
{ "verbose", no_argument, 0, 'v' },
{ "myaddr", required_argument, 0, 'a' },
{ "port", required_argument, 0, 'p' },
{ NULL, 0, 0, 0 }
};
// --------------------------------------------------------------------------
static void print_help()
{
printf("-h|--help - this message\n");
printf("[-t|--timeout] msec - Timeout. Default: 2000.\n");
printf("[-v|--verbose] - Print all messages to stdout\n");
printf("[-i|--iaddr] ip - Server listen ip. Default 127.0.0.1\n");
printf("[-a|--myaddr] addr - Modbus address for master. Default: 0x01.\n");
printf("[-p|--port] port - Server port. Default: 502.\n");
printf("[-v|--verbose] - Print all messages to stdout\n");
}
// --------------------------------------------------------------------------
int main( int argc, char **argv )
{
int optindex = 0;
int opt = 0;
int verb = 0;
int port = 502;
string iaddr("127.0.0.1");
ModbusRTU::ModbusAddr myaddr = 0x01;
int tout = 2000;
DebugStream dlog;
ost::Thread::setException(ost::Thread::throwException);
try
{
while( (opt = getopt_long(argc, argv, "ht:va:p:i:",longopts,&optindex)) != -1 )
{
switch (opt)
{
case 'h':
print_help();
return 0;
case 'i':
iaddr = string(optarg);
break;
case 'p':
port = atoi(optarg);
break;
case 't':
tout = atoi(optarg);
break;
case 'a':
myaddr = ModbusRTU::str2mbAddr(optarg);
break;
case 'v':
verb = 1;
break;
case '?':
default:
printf("? argumnet\n");
return 0;
}
}
if( verb )
{
cout << "(init): iaddr: " << iaddr << ":" << port
<< " myaddr=" << ModbusRTU::addr2str(myaddr)
<< " timeout=" << tout << " msec "
<< endl;
dlog.addLevel( Debug::type(Debug::CRIT | Debug::WARN | Debug::INFO) );
}
MBTCPServer mbs(myaddr,iaddr,port,verb);
mbs.setLog(dlog);
mbs.setVerbose(verb);
mbs.execute();
}
catch( ModbusRTU::mbException& ex )
{
cerr << "(mbtcpserver): " << ex << endl;
}
catch(SystemError& err)
{
cerr << "(mbtcpserver): " << err << endl;
}
catch(Exception& ex)
{
cerr << "(mbtcpserver): " << ex << endl;
}
catch( ost::SockException& e )
{
cerr << e.getString() << ": " << e.getSystemErrorString() << endl;
}
catch(...)
{
cerr << "(mbtcpserver): catch(...)" << endl;
}
return 0;
}
// --------------------------------------------------------------------------
############################################################################
# This file is part of the UniSet library #
############################################################################
UTILS = scripts Admin NullController SViewer-text \
InfoServer SMonit MBTester codegen
#MapSourceParser ClassGen
if DISABLE_MYSQL
SUBDIRS = ${UTILS}
else
SUBDIRS = ${UTILS} DBServer-MySQL
endif
include $(top_builddir)/conf/common.mk
############################################################################
# This file is part of the UniSet library #
############################################################################
bin_PROGRAMS = uniset-nullController
uniset_nullController_SOURCES = NullController.cc main.cc
uniset_nullController_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_nullController_CPPFLAGS = -I$(top_builddir)/lib $(SIGC_CFLAGS)
include $(top_builddir)/conf/setting.mk
// $Id: NullController.cc,v 1.15 2008/12/14 21:57:49 vpashka Exp $
// --------------------------------------------------------------------------
#include "Configuration.h"
#include "NCRestorer.h"
#include "NullController.h"
#include "PassiveTimer.h"
// --------------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------------
NullController::NullController( ObjectId id, const string askdump,
const std::string s_filterField,
const std::string s_filterValue,
const std::string c_filterField,
const std::string c_filterValue,
const std::string d_filterField,
const std::string d_filterValue,
bool _dumpingToDB ):
IONotifyController(id),
dumpingToDB(_dumpingToDB)
{
restorer = NULL;
NCRestorer_XML* askd = new NCRestorer_XML(askdump);
askd->setItemFilter(s_filterField, s_filterValue);
askd->setConsumerFilter(c_filterField, c_filterValue);
askd->setDependsFilter(d_filterField, d_filterValue);
restorer = askd;
/*
// askd->setReadItem( sigc::mem_fun(this,&NullController::readSItem) );
askd->setNCReadItem( sigc::mem_fun(this,&NullController::readSItem) );
askd->setReadThresholdItem( sigc::mem_fun(this,&NullController::readTItem) );
askd->setReadConsumerItem( sigc::mem_fun(this,&NullController::readCItem) );
*/
}
// --------------------------------------------------------------------------------
NullController::~NullController()
{
if( restorer != NULL )
{
delete restorer;
restorer=NULL;
}
}
// --------------------------------------------------------------------------------
void NullController::dumpToDB()
{
if( dumpingToDB )
IONotifyController::dumpToDB();
}
// --------------------------------------------------------------------------------
/*
//bool NullController::readSItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
bool NullController::readSItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec, NCRestorer::SInfo& inf )
{
cout << "******************* (readSItem): sec=" << sec->name << " it=" << it.getProp("name") << endl;
inf.default_val = 1;
return true;
}
// --------------------------------------------------------------------------------
bool NullController::readTItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{
cout << "******************* (readTItem): sec=" << sec->name << " it=" << it.getProp("name") << endl;
return true;
}
// --------------------------------------------------------------------------------
bool NullController::readCItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{
cout << "******************* (readCItem): sec=" << sec->name << " it=" << it.getProp("name") << endl;
return true;
}
*/
// --------------------------------------------------------------------------------
// $Id: NullController.h,v 1.11 2008/02/10 03:21:41 vpashka Exp $
// --------------------------------------------------------------------------
#ifndef NullController_H_
#define NullController_H_
// --------------------------------------------------------------------------
#include <string>
#include "IONotifyController.h"
#include "NCRestorer.h"
// --------------------------------------------------------------------------
class NullController:
public IONotifyController
{
public:
NullController( UniSetTypes::ObjectId id, const std::string restorfile,
const std::string s_filterField="",
const std::string s_filterValue="",
const std::string c_filterField="",
const std::string c_filterValue="",
const std::string d_filterField="",
const std::string d_filterValue="",
bool _dumpingToDB=false );
virtual ~NullController();
protected:
virtual void dumpToDB();
// bool readSItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec, NCRestorer::SInfo& inf );
// bool readTItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec);
// bool readCItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec);
private:
bool dumpingToDB;
};
// --------------------------------------------------------------------------
#endif // NullController_H_
// --------------------------------------------------------------------------
#!/bin/sh
ln -s -f /usr/bin/uniset-stop.sh stop.sh
ln -s -f ../../conf/test.xml test.xml
// $Id: main.cc,v 1.13 2008/02/10 03:21:41 vpashka Exp $
// --------------------------------------------------------------------------
#include "Configuration.h"
#include "NullController.h"
#include "ObjectsActivator.h"
#include "Debug.h"
#include "PassiveTimer.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------
static void short_usage()
{
cout << "Usage: uniset-nullController"
<< " --name ObjectId [--confile configure.xml] [--askfile filename] \n"
<< " --s-filter-field name - \n"
<< " --s-filter-value value - \n"
<< " --c-filter-field name - \n"
<< " --c-filter-value value - \n"
<< " --d-filter-field name - \n"
<< " --d-filter-value value - \n"
<< " --dbDumping [0,1] - dump- \n";
}
// --------------------------------------------------------------------------
int main(int argc,char** argv)
{
try
{
if( argc <=1 )
{
cerr << "\n \n\n";
short_usage();
return 0;
}
if( !strcmp(argv[1],"--help") )
{
short_usage();
return 0;
}
uniset_init(argc,argv,"configure.xml");
// ID
string name = conf->getArgParam("--name");
if( name.empty())
{
cerr << "(nullController): ObjectId!!! (--name)\n";
return 0;
}
ObjectId ID = conf->oind->getIdByName(conf->getControllersSection()+"/"+name);
if( ID == UniSetTypes::DefaultObjectId )
{
cerr << "(nullController): '" << name
<< "' . !"
<< " " << conf->getControllersSection() << endl;
return 0;
}
// ask-
string askfile = conf->getArgParam("--askfile");
if( askfile.empty())
askfile = conf->getConfFileName();
//
string s_field = conf->getArgParam("--s-filter-field");
string s_fvalue = conf->getArgParam("--s-filter-value");
string c_field = conf->getArgParam("--c-filter-field");
string c_fvalue = conf->getArgParam("--c-filter-value");
string d_field = conf->getArgParam("--d-filter-field");
string d_fvalue = conf->getArgParam("--d-filter-value");
//
bool dbDumping = atoi(conf->getArgParam("--dbDumping").c_str());
NullController nc(ID,askfile,s_field,s_fvalue,c_field,c_fvalue,d_field,d_fvalue,dbDumping);
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&nc));
act.run(false);
}
catch(Exception& ex)
{
cerr << "(nullController::main): " << ex << endl;
}
catch(...)
{
cerr << "(nullController::main): catch ..." << endl;
}
return 0;
}
#!/bin/sh
ulimit -Sc 1000000
uniset-start.sh -f ./uniset-nullController --name SharedMemory --confile test.xml --unideb-add-levels info,crit,warn,level9,system
#info,warn,crit,system,level9 > 1.log
#--c-filter-field cfilter --c-filter-value test1 --s-filter-field io --s-filter-value 1
bin_PROGRAMS = uniset-smonit
uniset_smonit_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_smonit_SOURCES = smonitor.cc
#!/bin/sh
ln -s -f /usr/bin/uniset-stop.sh stop.sh
ln -s -f ../../conf/test.xml test.xml
#!/bin/sh
function usage()
{
echo "${0##*/} SID state tv_sec tv_usec"
}
RETVAL=0
sid=$1
state=$2
tv_sec=$3
tv_usec=$4
# action
echo "event: $sid $state $tv_sec $tv_usec"
exit $RETVAL
// $Id: smonitor.cc,v 1.10 2008/11/29 21:24:24 vpashka Exp $
// --------------------------------------------------------------------------
#include <iostream>
#include <string>
#include "ObjectsActivator.h"
#include "Configuration.h"
#include "SMonitor.h"
// -----------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// -----------------------------------------------------------------------------
int main( int argc, char **argv )
{
try
{
if( argc>1 && ( !strcmp(argv[1],"--help") || !strcmp(argv[1],"-h") ) )
{
cout << "Usage: uniset-smonit [ args ] --sid id1,id2,id2,... "
// << " --script scriptname \n"
<< " --confile configure.xml \n";
return 0;
}
uniset_init(argc,argv,"configure.xml");
ObjectId ID(DefaultObjectId);
string name = conf->getArgParam("--name");
if( name.empty() )
name = "TestProc";
ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
{
cerr << "(main): '" << name
<< "' . !"
<< " " << conf->getObjectsSection() << endl;
return 0;
}
ObjectsActivator act;
SMonitor tp(ID);
act.addObject(&tp);
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
act.run(false);
}
catch( Exception& ex )
{
cout << "(main):" << ex << endl;
}
catch(...)
{
cout << "(main): !!!!"<< endl;
}
return 0;
}
// ------------------------------------------------------------------------------------------
#!/bin/sh
uniset-start.sh -f ./uniset-smonit --name TestProc --confile test.xml $@
#--unideb-add-levels system,info,level9
############################################################################
# This file is part of the UniSet library #
############################################################################
bin_PROGRAMS = uniset-sviewer-text
uniset_sviewer_text_SOURCES = main.cc
uniset_sviewer_text_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_sviewer_text_CPPFLAGS = -I$(top_builddir)/lib
include $(top_builddir)/conf/setting.mk
#!/bin/sh
ln -s -f /usr/bin/uniset-stop.sh stop.sh
ln -s -f ../../conf/test.xml test.xml
// $Id: main.cc,v 1.9 2008/02/10 03:21:42 vpashka Exp $
// --------------------------------------------------------------------------
#include <string>
#include "SViewer.h"
#include "Configuration.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------
static void short_usage()
{
cout << "Usage: uniset-sviewer-text [--fullname] [--polltime msec] [--confile uniset-confile]\n";
}
// --------------------------------------------------------------------------
int main(int argc, char **argv)
{
try
{
if( argc > 1 && !strcmp(argv[1],"--help") )
{
short_usage();
return 0;
}
uniset_init(argc,argv,"configure.xml");
/*
UniversalInterface ui;
IDList lst;
lst.add(1);
lst.add(2);
lst.add(3);
lst.add(5);
lst.add(33);
IOController_i::ASensorInfoSeq_var seq = ui.getSensorSeq(lst);
int size = seq->length();
for(int i=0; i<size; i++)
cout << "id=" << seq[i].si.id << " val=" << seq[i].value << endl;
*/
bool fullname = atoi(conf->getArgParam("--fullname").c_str());
SViewer sv(conf->getControllersSection(),!fullname);
int timeMS = atoi(conf->getArgParam("--polltime").c_str());
if( timeMS )
{
cout << "(main): " << timeMS << "[]" << endl;
sv.monitor(timeMS);
}
else
sv.view();
}
catch(Exception& ex )
{
cerr << "(main): " << ex << endl;
}
catch(...)
{
cerr << "(main): !!!!"<< endl;
}
return 0;
}
#!/bin/sh
#while true; do
uniset-start.sh -f ./uniset-sviewer-text --confile test.xml --unideb-add-levels warn,crit
#done
SUBDIRS=tests
bin_SCRIPTS = @PACKAGE@-codegen
xsldir = $(datadir)/uniset/xslt
xsl_DATA = *.xsl
<?xml version='1.0' encoding="koi8-r" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'
xmlns:date="http://exslt.org/dates-and-times">
<xsl:import href="ctl-cpp-common.xsl"/>
<xsl:output method="text" indent="yes" encoding="koi8-r"/>
<xsl:variable name="CLASSNAME">
<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'class-name'"/></xsl:call-template>
</xsl:variable>
<xsl:variable name="BASECLASS">
<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'base-class'"/></xsl:call-template>
</xsl:variable>
<xsl:variable name="OID">
<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'ID'"/></xsl:call-template>
</xsl:variable>
<!-- -->
<xsl:template match="/">
// --------------------------------------------------------------------------
/*
DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
ALL YOUR CHANGES WILL BE LOST.
. .
.
*/
// --------------------------------------------------------------------------
// generate timestamp: <xsl:value-of select="date:date()"/>
// -----------------------------------------------------------------------------
#ifndef <xsl:value-of select="$CLASSNAME"/>_SK_H_
#define <xsl:value-of select="$CLASSNAME"/>_SK_H_
// -----------------------------------------------------------------------------
<xsl:if test="normalize-space($BASECLASS)!=''">#include <xsl:call-template name="preinclude"/><xsl:value-of select="normalize-space($BASECLASS)"/>.h<xsl:call-template name="postinclude"/></xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">#include <xsl:call-template name="preinclude"/>UniSetObject.h<xsl:call-template name="postinclude"/></xsl:if>
#include <xsl:call-template name="preinclude"/>LT_Object.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>UniXML.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>Trigger.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>UniversalInterface.h<xsl:call-template name="postinclude"/>
// -----------------------------------------------------------------------------
class <xsl:value-of select="$CLASSNAME"/>_SK:
<xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/>,</xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">public UniSetObject,</xsl:if>
public LT_Object
{
public:
<xsl:if test="not(normalize-space($OID))=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id = UniSetTypes::conf->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=UniSetTypes::conf->getNode("<xsl:value-of select="normalize-space($OID)"/>") );
</xsl:if>
<xsl:if test="normalize-space($OID)=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("<xsl:value-of select="normalize-space($OID)"/>") );
</xsl:if>
<xsl:value-of select="$CLASSNAME"/>_SK();
virtual ~<xsl:value-of select="$CLASSNAME"/>_SK();
<xsl:call-template name="COMMON-HEAD-PUBLIC"/>
//
<xsl:for-each select="//sensors/item">
<xsl:call-template name="setvar">
<xsl:with-param name="GENTYPE" select="'H'"/>
</xsl:call-template>
</xsl:for-each>
//
<xsl:for-each select="//sensors/item">
<xsl:call-template name="setmsg">
<xsl:with-param name="GENTYPE" select="'H'"/>
</xsl:call-template>
</xsl:for-each>
protected:
<xsl:call-template name="COMMON-HEAD-PROTECTED"/>
private:
<xsl:call-template name="COMMON-HEAD-PRIVATE"/>
};
// -----------------------------------------------------------------------------
#endif // <xsl:value-of select="$CLASSNAME"/>_SK_H_
</xsl:template>
</xsl:stylesheet>
<?xml version='1.0' encoding="koi8-r" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'
xmlns:date="http://exslt.org/dates-and-times">
<xsl:import href="ctl-cpp-common.xsl"/>
<xsl:output method="text" indent="yes" encoding="koi8-r"/>
<xsl:variable name="CLASSNAME">
<xsl:call-template name="settings"><xsl:with-param name="varname" select="'class-name'"/></xsl:call-template>
</xsl:variable>
<xsl:variable name="BASECLASS">
<xsl:call-template name="settings"><xsl:with-param name="varname" select="'base-class'"/></xsl:call-template>
</xsl:variable>
<xsl:variable name="OID">
<xsl:call-template name="settings"><xsl:with-param name="varname" select="'ID'"/></xsl:call-template>
</xsl:variable>
<!-- -->
<xsl:template match="/">
// --------------------------------------------------------------------------
/*
DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
ALL YOUR CHANGES WILL BE LOST.
. .
.
*/
// --------------------------------------------------------------------------
// generate timestamp: <xsl:value-of select="date:date()"/>
// -----------------------------------------------------------------------------
#ifndef <xsl:value-of select="$CLASSNAME"/>_SK_H_
#define <xsl:value-of select="$CLASSNAME"/>_SK_H_
// -----------------------------------------------------------------------------
<xsl:if test="normalize-space($BASECLASS)!=''">#include <xsl:call-template name="preinclude"/><xsl:value-of select="normalize-space($BASECLASS)"/>.h<xsl:call-template name="postinclude"/></xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">#include <xsl:call-template name="preinclude"/>UniSetObject.h<xsl:call-template name="postinclude"/></xsl:if>
#include <xsl:call-template name="preinclude"/>LT_Object.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>UniXML.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>Trigger.h<xsl:call-template name="postinclude"/>
// -----------------------------------------------------------------------------
class <xsl:value-of select="$CLASSNAME"/>_SK:
<xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/>,</xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">public UniSetObject,</xsl:if>
public LT_Object
{
public:
<xsl:if test="not(normalize-space($OID))=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id = conf->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=UniSetTypes::conf->getNode("<xsl:value-of select="normalize-space($CNAME)"/>") );
</xsl:if>
<xsl:if test="normalize-space($OID)=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("<xsl:value-of select="normalize-space($CNAME)"/>") );
</xsl:if>
<xsl:value-of select="$CLASSNAME"/>_SK();
virtual ~<xsl:value-of select="$CLASSNAME"/>_SK();
<xsl:call-template name="COMMON-HEAD-PUBLIC"/>
//
<xsl:for-each select="//smap/item">const UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:for-each>
//
<xsl:for-each select="//msgmap/item">
const UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
bool m_<xsl:value-of select="@name"/>; /*!&lt; /> */
bool prev_m_<xsl:value-of select="@name"/>; /*!&lt; /> */
</xsl:for-each>
//
<xsl:for-each select="//smap/item">
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template><xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template><xsl:text> prev_</xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:for-each>
protected:
<xsl:call-template name="COMMON-HEAD-PROTECTED"/>
private:
<xsl:call-template name="COMMON-HEAD-PRIVATE"/>
};
// -----------------------------------------------------------------------------
#endif // <xsl:value-of select="$CLASSNAME"/>_SK_H_
</xsl:template>
</xsl:stylesheet>
<?xml version='1.0' encoding="koi8-r" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'
xmlns:date="http://exslt.org/dates-and-times">
<xsl:import href="ctl-cpp-common.xsl"/>
<xsl:output method="text" indent="yes" encoding="koi8-r"/>
<xsl:variable name="CLASSNAME">
<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'class-name'"/></xsl:call-template>
</xsl:variable>
<xsl:variable name="BASECLASS">
<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'base-class'"/></xsl:call-template>
</xsl:variable>
<xsl:variable name="OID">
<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'ID'"/></xsl:call-template>
</xsl:variable>
<!-- main UniSet_FSM -->
<xsl:template match="/">
// --------------------------------------------------------------------------
/*
DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
ALL YOUR CHANGES WILL BE LOST.
. .
.
*/
// --------------------------------------------------------------------------
// generate timestamp: <xsl:value-of select="date:date()"/>
// -----------------------------------------------------------------------------
#include &lt;sstream&gt;
#include <xsl:call-template name="preinclude"/>Configuration.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>ObjectsActivator.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>Debug.h<xsl:call-template name="postinclude"/>
#include "<xsl:value-of select="$CLASSNAME"/>.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
// -----------------------------------------------------------------------------
int main( int argc,char* argv[] )
{
if( argc>1 &amp;&amp; strcmp(argv[1],"--help")==0 )
{
cout &lt;&lt; "--name name - ID . IOController1." &lt;&lt; endl;
cout &lt;&lt; "--confile fname - . . configure.xml" &lt;&lt; endl;
cout &lt;&lt; "--logfile fname - fname. <xsl:value-of select="$CLASSNAME"/>.log" &lt;&lt; endl;
return 0;
}
try
{
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "configure.xml" );
conf = new Configuration(argc, argv,confile);
string logfilename = conf->getArgParam("--logfile","<xsl:value-of select="$CLASSNAME"/>.log");
string logname( conf->getLogDir() + logfilename );
unideb.logFile( logname.c_str() );
// ID
ObjectId ID(DefaultObjectId);
string name = conf->getArgParam("--name","<xsl:value-of select="normalize-space($OID)"/>");
if( !name.empty() )
ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
{
cerr &lt;&lt; "(main): '" &lt;&lt; name
&lt;&lt; "' . !"
&lt;&lt; " " &lt;&lt; conf->getObjectsSection() &lt;&lt; endl;
return 1;
}
<xsl:value-of select="$CLASSNAME"/> obj(ID);
ObjectsActivator act;
act.addObject(static_cast&lt;class UniSetObject*&gt;(&amp;obj));
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
act.run(false);
pause(); // ,
}
catch(Exception&amp; ex)
{
cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl;
}
catch(...)
{
cerr &lt;&lt; "(main): catch ..." &lt;&lt; endl;
}
return 0;
}
</xsl:template>
</xsl:stylesheet>
<?xml version='1.0' encoding="koi8-r" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'
xmlns:date="http://exslt.org/dates-and-times">
<xsl:import href="ctl-cpp-common.xsl"/>
<xsl:output method="text" indent="yes" encoding="koi8-r"/>
<xsl:variable name="CLASSNAME">
<xsl:call-template name="settings"><xsl:with-param name="varname" select="'class-name'"/></xsl:call-template>
</xsl:variable>
<xsl:variable name="BASECLASS">
<xsl:call-template name="settings"><xsl:with-param name="varname" select="'base-class'"/></xsl:call-template>
</xsl:variable>
<xsl:variable name="OID">
<xsl:call-template name="settings"><xsl:with-param name="varname" select="'ID'"/></xsl:call-template>
</xsl:variable>
<!-- main UniSet_FSM -->
<xsl:template match="/">
// --------------------------------------------------------------------------
/*
DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
ALL YOUR CHANGES WILL BE LOST.
. .
.
*/
// --------------------------------------------------------------------------
// generate timestamp: <xsl:value-of select="date:date()"/>
// -----------------------------------------------------------------------------
#include &lt;sstream&gt;
#include <xsl:call-template name="preinclude"/>Configuration.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>ObjectsActivator.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>Debug.h<xsl:call-template name="postinclude"/>
#include "<xsl:value-of select="$CLASSNAME"/>.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
// -----------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
if( argc>1 &amp;&amp; strcmp(argv[1],"--help")==0 )
{
cout &lt;&lt; "--name name - ID . <xsl:value-of select="$CLASSNAME"/>." &lt;&lt; endl;
cout &lt;&lt; "--vonfile fname - . . configure.xml" &lt;&lt; endl;
cout &lt;&lt; "--logfile fname - fname. <xsl:value-of select="$CLASSNAME"/>.log" &lt;&lt; endl;
return 0;
}
try
{
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "configure.xml" );
conf = new Configuration(argc, argv,confile);
string logfilename = conf->getArgParam("--logfile","<xsl:value-of select="$CLASSNAME"/>.log");
string logname( conf->getLogDir() + logfilename );
unideb.logFile( logname.c_str() );
<xsl:if test="not(normalize-space(//@OID))=''">
<xsl:value-of select="$CLASSNAME"/> obj;
</xsl:if>
<xsl:if test="normalize-space(//@OID)=''">
// ID
ObjectId ID(DefaultObjectId);
string name = conf->getArgParam("--name","<xsl:value-of select="$CLASSNAME"/>");
if( !name.empty() )
{
ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
{
cerr &lt;&lt; "(main): '" &lt;&lt; name
&lt;&lt; "' . !"
&lt;&lt; " " &lt;&lt; conf->getObjectsSection() &lt;&lt; endl;
return 0;
}
}
<xsl:value-of select="$CLASSNAME"/> obj(ID);
</xsl:if>
ObjectsActivator act;
act.addObject(static_cast&lt;class UniSetObject*&gt;(&amp;obj));
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
act.run(false);
pause(); // ,
}
catch(Exception&amp; ex)
{
cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl;
}
catch(...)
{
cerr &lt;&lt; "(main): catch ..." &lt;&lt; endl;
}
return 0;
}
</xsl:template>
</xsl:stylesheet>
#noinst_PROGRAMS = test
#test_LDADD = $(top_builddir)/lib/libUniSet.la
#test_SOURCES = TestGen_SK.cc TestGen.cc TestGen-main.cc
TestGen_SK.cc: @PACKAGE@-codegen testgen.src.xml
chmod 'a+x' @PACKAGE@-codegen
./uniset-codegen --local-include -l --ask -n TestGen testgen.src.xml
clean-local:
rm -rf *_SK.cc *_SK.h *-main.cc
\ No newline at end of file
#!/bin/sh
cd ..
./uniset-codegen --local-include -l --ask -n TestGen tests/testgen.src.xml
mv -f TestGen* tests/
cd -
\ No newline at end of file
<?xml version="1.0" encoding="koi8-r"?>
<!--
name -
msgcount -
sleep_msec -
type
====
in - ( )
out - ()
io -
-->
<QG>
<settings>
<set name="class-name" val="TestGen"/>
<set name="msg-count" val="20"/>
<set name="sleep-msec" val="150"/>
</settings>
<smap>
<!-- name - . -->
<item name="input1_s" vartype="in" iotype="DI" comment="comment for input1" />
<item name="input2_s" vartype="in" iotype="DI" comment="comment for input2" />
<item name="output1_c" vartype="out" iotype="DO" omment="comment for output1" />
</smap>
<msgmap>
<!-- name - . -->
<item name="mid_Message1" comment="comment for Message 1" />
</msgmap>
</QG>
#!/bin/sh
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
datadir=@datadir@
sysconfdir=@sysconfdir@
top_builddir=@top_builddir@
xsltdir=@datadir@/uniset/xslt
PROG="${0##*/}"
print_usage()
{
[ "$1" = 0 ] || exec >&2
cat <<EOF
Usage: $PROG [options] [xmlfile]
$PROG - generate source code for control process
xmlfile - source xml-file
Valid options are:
-m, --main filename for main.cc. Default: main.cc
-n, --name filename for *_SK files (base class implementation). Default: xmlfilename_SK
-h, --help display help screen
EOF
[ -n "$1" ] && exit "$1" || exit
}
#parse command line options
TEMP=`getopt -n $PROG -o h,n:,m:,a,l -l help,name:,main:,no-main,topdir:,alone,ask,local,local-include,add-cc-include,add-hh-include -- "$@"` || exit 1
eval set -- "$TEMP"
name=
uni_h=
uni_cc=
uni_main=
no_main=
xmlfile=
alone=
ask=
localinc=0
add_cc_inc=
add_hh_inc=
xls_h="ctl-cpp-h.xsl"
xls_c="ctl-cpp-cc.xsl"
xls_m="ctl-cpp-main.xsl"
while :; do
case "$1" in
-h|--help) print_usage 0
;;
-n|--name)
shift
name="$1"
;;
-m|--main)
shift
uni_main="$1".cc
;;
--no-main)
no_main=1
;;
--topdir)
shift
top_builddir="$1"
;;
--alone)
xls_h="ctl-cpp-h-alone.xsl"
xls_c="ctl-cpp-cc-alone.xsl"
xls_m="ctl-cpp-main-alone.xsl"
;;
--with-prev-values)
prev_val=1
;;
--local-include)
localinc=1
;;
--add-cc-include)
add_cc_inc="${add_cc_inc} $1"
;;
--add-hh-include)
add_hh_inc="${add_hh_inc} $1"
;;
--ask)
ask=1
;;
-l|--local)
xsltdir=.
;;
--) shift; break
;;
*) "unrecognized option: $1"
exit 1
;;
esac
shift
done
xmlfile="$1"
[ -n "$xmlfile" ] || print_usage
if [ -z "$name" ]; then
name=$( basename $( basename $xmlfile .xml ) .src )
fi
[ -z "${name}" ] && print_usage 0
uni_h="${name}_SK.h"
uni_cc="${name}_SK.cc"
if [ -z "$uni_main" ]; then
uni_main="${name}-main.cc"
fi
if [ -n "$ask" ]; then
xls_c=$(basename $xls_c .xsl)-ask.xsl
fi
fname=$( basename $xmlfile )
PARAMS=$( echo \
--stringparam SK_H_FILENAME "${uni_h}" \
--stringparam XML_FILENAME "${fname}" \
--stringparam CNAME "${name}" \
--stringparam LOCALINC "${localinc}" \
)
# --stringparam ADD_CC_INC "${add_cc_inc}" \
# --stringparam ADD_HH_INC "${add_hh_inc}" \
# generate xxx_SK class
xsltproc ${PARAMS} ${xsltdir}/${xls_h} $xmlfile > $uni_h
xsltproc ${PARAMS} ${xsltdir}/${xls_c} $xmlfile > $uni_cc
[ -n "$no_main" ] || xsltproc ${PARAMS} ${xsltdir}/${xls_m} $xmlfile > $uni_main
############################################################################
# This file is part of the UniSet library #
############################################################################
include $(top_builddir)/conf/common.mk
bin_SCRIPTS = uniset-start.sh uniset-stop.sh uniset-functions.sh
#!/bin/sh
USERID=0
BASEOMNIPORT=2809
#
function get_userid()
{
USERID=$(expr $UID + 50000)
}
# usage: standart_control {1/0} - {standart port/debug port}
function standart_control()
{
if [ -z $TMPDIR ]
then
TMPDIR=$HOME/tmp
echo TMPDIR. $TMPDIR
else
echo TMPDIR=$TMPDIR
fi
if [ $1 = 1 ]; then
TMPDIR=/var/tmp
echo Omni: $BASEOMNIPORT $TMPDIR
else
get_userid
if [ $USERID = 0 ]
then
echo $(whoami) uid=$UID
exit 0
fi
fi
}
function set_omni_port
{
while [ -n "$1" ]; do
case "$1" in
-p|--port)
shift
OMNIPORT=$1;
echo "set OMNIPORT=$1"
shift;
break;
;;
*)
shift
;;
esac
done
}
function set_omni
{
# omniORB
OMNILOG=$TMPDIR/omniORB
#
RANSERVICES=$OMNILOG/ran.list
touch $RANSERVICES
OMNINAME=omniNames
OMNIPORT=$(expr $USERID + $BASEOMNIPORT)
if [ $(grep "$OMNIPORT/" /etc/services | wc -l) \> 0 ]
then
if [ $USERID = 0 ]
then
echo INFO: $OMNIPORT /etc/services.
else
echo , $OMNIPORT /etc/services.
echo omniNames .
echo
exit 0
fi
fi
[ -e $(which $OMNINAME) ] || { echo Error: $OMNINAME ; exit 0; }
}
function runOmniNames()
{
RETVAL=1
omniTest=0
if [ $std = 1 ]; then
omniTest=$(ps -ax | grep $OMNINAME | grep -v grep | grep -v $0 | wc -l);
else
omniTest=$(ps -aux | grep $OMNINAME | grep $USER | grep -v grep | grep -v $0 | wc -l);
fi
if [ $omniTest \> 0 ];
then
echo $OMNINAME . #.
return 0;
fi
if [ ! -d $OMNILOG ]
then
mkdir -p $OMNILOG
echo omniNames $OMNIPORT
$OMNINAME -start $OMNIPORT -logdir $OMNILOG &>$OMNILOG/background.output &
pid=$!
echo
else
echo omniNames. , $OMNILOG
$OMNINAME -logdir $OMNILOG &>$OMNILOG/background.output &
pid=$!
fi
RET=$?
if [ $RET = 0 ]; then
if [ $WITH_PID = 1 ]; then
echo $pid >"$RUNDIR/$OMNINAME.pid" # pid-
fi;
else
echo omniNames
return 1;
fi
#echo $! $OMNINAME >>$RANSERVICES
if [ $(grep $OMNINAME $RANSERVICES | wc -l) \= 0 ]
then
echo 0 $OMNINAME >>$RANSERVICES
fi
# omniNames -
yes=$(echo $* | grep omniNames )
if [ -n "$yes" ]; then
echo omniNames [ OK ]
$RETVAL=0
fi
return $RETVAL
}
\ No newline at end of file
#!/bin/sh
#
. uniset-functions.sh
WITH_PID=0
std=0
standart_control $std
set_omni
set_omni_port $*
runOmniNames
case $1 in
--foreground|-f)
shift 1
COMLINE=$*
if [ -z "$COMLINE" ]
then
echo " "
exit 0
fi
COMLINE="$COMLINE --uniset-port $OMNIPORT"
echo "$COMLINE"
$COMLINE
echo
exit 1
;;
esac
if [ -z "$*" ]
then
echo " "
exit 0
fi
checkPID=$(echo "$1" | grep pidfile=)
if [ -n "$checkPID" ]; then
PIDFILE="$RUNDIR/${1#--pidfile=}"
shift
NAMEPROG="$1"
else
NAMEPROG="$1"
PIDFILE="$RUNDIR/$(basename $NAMEPROG).pid"
fi
echo -n $NAMEPROG ...
echo ""
ulimit -S -c 0 >/dev/null 2>&1
# $* --uniset-port $OMNIPORT &
echo : "$* --uniset-port $OMNIPORT"
pid=$!
echo $pid >$PIDFILE # pid-
PROGLINE=$(ps -x | grep $(basename $NAMEPROG) | grep -v $0 | grep -v grep)
if [ -n "$PROGLINE" ]; then
RETVAL=1
echo [ OK ]
echo $( echo $PROGLINE | cut -d " " -f 1 ) $NAMEPROG >>$RANSERVICES
else
RETVAL=0
echo [ FAILED ]
fi
exit $RETVAL
#!/bin/sh
SIG=-TERM
ARGS=$1
# ,
# ţ :) (. makefile :install)
. uniset-functions.sh
std=0
standart_control $std
set_omni
case $1 in
--kill|-k)
SIG="-KILL"
;;
esac
checkPID=$(echo "$1" | grep pidfile=)
if [ -n "$checkPID" ]; then
PID=$( echo $(cat $RUNDIR/${1#--pidfile=}) )
echo "KILL PID: $PID "
kill $PID
exit 1;
fi
if [ ! -e $RANSERVICES ]
then
echo $RANSERVICES
exit -1
fi
for i in $(tac $RANSERVICES | cut -d " " -f 2)
do
TOKILL=$(basename $i)
echo -n $TOKILL...
if [ $(ps -x | grep $TOKILL | wc -l) = 0 ]
then
echo " already stoppped [ OK ]"
else
killall $SIG $TOKILL
echo " [ OK ]"
fi
done
rm -f $RANSERVICES
echo "[ OK ]"
#! /bin/sh
#set -x
rm -f po/stamp-po
aclocal || exit 1
autoheader || exit 1
libtoolize --copy || exit 1
automake --add-missing --include-deps --copy || exit 1
autoconf || exit 1
test -f Makefile && ./configure --enable-maintainer-mode
exit 0
# This file is a part of the NCS project. (c) 1999-2002 All rights reserved.
# $Id: idl.mk,v 1.2 2006/10/14 16:53:22 vpashka Exp $
# IDL
# , omniidl
# - ,
# IDL
IDLFLAGS = -I$(top_builddir)/IDL
#
HHTARG=$(patsubst %.idl, ${HHDIR}/%.hh, ${IDLFILES})
CCTARG=$(patsubst %.idl, ${CCDIR}/%SK.cc, ${IDLFILES})
########################################################################
all: ${HHTARG} ${CCTARG}
dynamic: all
${HHTARG} ${CCTARG}: ${IDLFILES}
for i in $^; do ${IDL} -v -bcxx ${IDLFLAGS} $$i; done
mv --target-directory=${HHDIR} *.hh
mv --target-directory=${CCDIR} *.cc
.PHONY: clean depend
clean:
${RM} ${HHTARG} ${CCTARG}
depend:
install:
\ No newline at end of file
#!/bin/sh
# rpm-
. /etc/rpm/etersoft-build-functions
cd ..
SPECNAME=conf/uniset.spec
check_key
update_from_cvs
build_rpms_name $SPECNAME
export BUILDNAME=$BASENAME-$VERSION-$RELEASE
cvs update $SPECNAME ChangeLog && ./cvs2cl.pl && cvs commit -m "Auto updated by $0 for $BUILDNAME" ChangeLog || fatal "can't update Changelog"
add_changelog_helper "- new build" $SPECNAME
prepare_tarball
rpmbb $SPECNAME || fatal "Can't build"
DESTDIR=/var/ftp/pvt/Etersoft/Ourside/i586/RPMS.ourside/
build_rpms_name $SPECNAME
if [ -d ${DESTDIR} ] ; then
rm -f $DESTDIR/$BASENAME*
echo "Copying to $DESTDIR"
cp $RPMDIR/RPMS/$DEFAULTARCH/$BASENAME-*$VERSION-$RELEASE.* $DESTDIR/ || fatal "Can't copying"
chmod o+r $DESTDIR/$BASENAME-*
fi
#
BASERELEASE=$(get_release $SPECNAME | sed -e "s/alt//")
set_release $SPECNAME alt$((BASERELEASE+1))
cvs commit -m "Auto updated by $0 for $BUILDNAME" $SPECNAME || fatal "Can't commit spec"
# Note: we in topscrdir
#TAG=${BUILDNAME//./_}
#echo "Set tag $TAG ..."
#cvs tag $TAG || fatal "Can't set build tag"
############################################################################
# This file is part of the UniSet* library
# Copyright (C) 1999-2002 SET Research Institute. All rights reserved.
# Author: Vitaly Lipatov <lav>
# $Id: setting.mk,v 1.2 2008/12/14 21:57:49 vpashka Exp $
############################################################################
# \file
############################################################################
<?xml version = '1.0' encoding = 'koi8-r' ?>
<UNISETPLC>
<UserData></UserData>
<!-- () UniSet -->
<UniSet>
<NameService host="localhost" port="2809"/>
<LocalNode name="LocalhostNode"/>
<RootSection name="UNISET_PLC"/>
<CountOfNet name="1"/>
<RepeatCount name="3"/>
<RepeatTimeoutMS name="50"/>
<WatchDogTime name="0"/> <!-- [] -->
<PingNodeTime name="0"/> <!-- [] -->
<AutoStartUpTime name="1"/> <!-- [] -->
<DumpStateTime name="10"/><!-- [] -->
<SleepTickMS name="500"/><!-- [] -->
<!-- Debug, logs -->
<UniSetDebug name="unideb" levels="crit,warn" file=""/>
<!-- , -->
<ConfDir name=""/>
<DataDir name=""/>
<BinDir name=""/>
<LogDir name=""/>
<DocDir name=""/>
<LockDir name=""/>
<Services>
<LocalTimeService name="TimeService" MaxCountTimers="100" AskLifeTimeSEC="10"/>
<LocalInfoServer name="InfoServer" dbrepeat="1">
<RouteList>
</RouteList>
</LocalInfoServer>
<LocalDBServer name="DBServer" dbnode="" dbname="UNISET_PLC" dbuser="dbadmin" dbpass="dbadmin" pingTime="60000" reconnectTime="30000"/>
<LocalPrintServer device="/dev/lp0" checkTime="5000" />
</Services>
</UniSet>
<dlog name="dlog" levels="" file=""/>
<SharedMemory name="SharedMemory" shmID="SharedMemory"/>
<MBSlave1 name="MBSlave1" dev="/dev/ttyS0" addr="0x31" speed="9600"
aftersend-pause="0" levels="info,warn,crit" poll_time="200" reply_timeout="60"
>
<filelist>
<!-- ۣ modbus
directory - .
'ConfDir' - ң (. )
'DataDir' - ң (. )
'xxx' -
-->
<item id="1" name="configure.xml" directory="ConfDir"/>
<item id="2" name="VERSION" directory="ConfDir"/>
<item id="3" name="configure.xml.gz" directory="/tmp/"/>
<item id="4" name="SERIAL" directory="ConfDir"/>
</filelist>
</MBSlave1>
<RTUExchange name="RTUExchange"/>
<UDPExchange name="UDPExchange"/>
<UDPExchange2 name="UDPExchange2"/>
<HeartBeatTime time_msec="5000"/>
<ObjectsMap idfromfile="0">
<!--
'sensors'
==========================================
node -
iotype -
priority -
textname -
-->
<nodes port="2809">
<item name="LocalhostNode" alias="" textname=" " ip="127.0.0.1" infserver="InfoServer" dbserver=""/>
<item name="Node2" alias="" textname=" " ip="127.0.0.1" infserver="InfoServer" dbserver=""/>
</nodes>
<!-- ************************ ********************** -->
<sensors name="Sensors">
<item name="Input1_S" textname=" 1" node="" iotype="DI" priority="Medium" default="1" />
<item name="Input2_S" textname=" 2" node="" iotype="DI" priority="Medium" mbtype="rtu" mbaddr="0x31" mbfunc="0x04" mbreg="0x02" rs="1" />
<item name="Input3_S" textname=" 3" node="" iotype="DI" priority="Medium" udp="1"/>
<item name="Input4_S" textname=" 4" node="" iotype="DI" priority="Medium" udp="1"/>
<item name="Input5_S" textname=" 5" node="" iotype="DI" priority="Medium" udp="2"/>
<item name="Input6_S" textname=" 6" node="" iotype="DI" priority="Medium" udp="2">
<depends>
<depend name="Input4_S"/>
</depends>
</item>
<item name="DO_C" textname="Digital output" node="" iotype="DO" priority="Medium"/>
<item name="DO1_C" textname="Digital output" node="" iotype="DO" priority="Medium"/>
<item name="AO_AS" textname="Analog output" node="" iotype="AO" priority="Medium"/>
<item name="AI_AS" textname="Analog input" node="" iotype="AI" default="378" priority="Medium">
<consumers>
<consumer name="TestProc" type="objects" cfilter="test1"/>
<consumer name="PLCProcessor" type="objects"/>
</consumers>
</item>
<item name="Threshold1_S" textname="" node="" iotype="DI" priority="Medium"/>
<item name="TestMode_S" textname="test" node="" iotype="DI" priority="Medium"/>
</sensors>
<thresholds name="thresholds">
<sensor name="AI_AS" node="" iotype="AI">
<threshold name="t1" lowlimit="374" hilimit="376" sensibility="0" id="1" sid="Threshold1_S">
<consumers>
<consumer name="TestProc" type="objects"/>
</consumers>
</threshold>
</sensor>
</thresholds>
<controllers name="Controllers">
<item name="SharedMemory"/>
</controllers>
<!-- ******************* ***************** -->
<services name="Services">
<item name="InfoServer"/>
<item name="DBServer"/>
<item name="PrintServer"/>
<item name="TimeService"/>
</services>
<!-- ******************* ***************** -->
<objects name="UniObjects">
<item name="TestProc"/>
<item name="LProcessor"/>
<item name="IOControl"/>
<item name="RTUExchange"/>
<item name="MBSlave1"/>
<item name="UDPExchange"/>
<item name="UDPExchange2"/>
</objects>
</ObjectsMap>
<messages name="messages" idfromfile="1" >
<item id="101" name="midMsg1" text="Text for message 1"/>
<item id="102" name="midMsg2" text="Text for message 2"/>
<item id="103" name="midMsg3" text="Text for message 3"/>
<item id="104" name="midMsg4" text="Text for message 4"/>
<item id="105" name="midMsg5" text="Text for message 5"/>
</messages>
</UNISETPLC>
%def_disable doc
Name: uniset
Version: 0.96
Release: alt11
Summary: UniSet
License: GPL
Group: Development/C++
URL: http://sourceforge.net/uniset
Packager: Pavel Vainerman <pv@altlinux.ru>
Source: %name-%version.tar.bz2
# Automatically added by buildreq on Sun Dec 28 2008
BuildRequires: libMySQL-devel libcomedi-devel libcommoncpp2-devel libomniORB-devel libsigc++2.0-devel libxml2-devel
#BuildRequires: gcc-c++ libMySQL-devel libomniORB-devel libsigc++2.0-devel libxml2-devel linux-libc-headers python-modules
#BuildRequires: gcc-c++ libMySQL-devel libomniORB-devel libsigc++2.0-devel libxml2-devel python-modules kernel-headers-common pkgconfig zlib-devel
%description
UniSet
%package -n lib%name
Summary: Libraries for UniSet
Group: System/Libraries
%description -n lib%name
This package provides libraries to use UniSet.
%package -n lib%name-devel
Group: Development/C
Summary: Libraries needed to develop for UniSet
Requires: lib%name = %version-%release
%description -n lib%name-devel
Libraries needed to develop for UniSet.
%package -n %name-mysql-dbserver
Group: Development/Databases
Summary: MySQL-dbserver implementatioin for UniSet
Requires: lib%name = %version-%release
%description -n %name-mysql-dbserver
MySQL dbserever for libuniset
%package utils
Summary: UniSet utilities
Group: Development/Tools
Requires: lib%name = %version-%release
%description utils
UniSet utilities
%package -n lib%name-doc
Group: Development/C
Summary: Documentations for developing with UniSet.
Requires: lib%name = %version-%release
%description -n lib%name-doc
Documentations for developing with UniSet
%package -n lib%name-extentions
Group: Development/Databases
Summary: libUniSet extentions
Requires: lib%name = %version-%release
%description -n lib%name-extentions
Libraries needed to develop for UniSetExtentions.
%package -n %name-extentions
Group: Development/Databases
Summary: libUniSet extentions
Requires: lib%name-extentions = %version-%release
%description -n %name-extentions
Extentions for libuniset
%package -n lib%name-extentions-devel
Group: Development/Databases
Summary: Libraries needed to develop for uniset extentions
Requires: lib%name-extentions = %version-%release
%description -n lib%name-extentions-devel
Libraries needed to develop for uniset extentions
%prep
%setup -q
%build
%if_enabled doc
%configure
%else
%configure --disable-docs
%endif
#%make_build
%make
%install
%makeinstall
%post -n lib%name
%postun -n lib%name
%files utils
%_bindir/%name-admin
%_bindir/%name-infoserver
%_bindir/%name-mb*
%_bindir/%name-nullController
%_bindir/%name-sviewer-text
%_bindir/%name-smonit
%_bindir/%name-start*
%_bindir/%name-stop*
%_bindir/%name-func*
%_bindir/%name-codegen
%_datadir/%name/xslt/*.xsl
%files -n lib%name
%_libdir/libUniSet.so*
%exclude %_libdir/*Extentions.so*
%exclude %_libdir/libUniSetIO*.so*
%exclude %_libdir/libUniSetLP*.so*
%exclude %_libdir/libUniSetMB*.so*
%exclude %_libdir/libUniSetRT*.so*
%exclude %_libdir/libUniSetShared*.so*
%files -n lib%name-devel
%_includedir/%name
%_datadir/idl/%name
%_libdir/pkgconfig/libUniSet.pc
%exclude %_includedir/%name/extentions
#%exclude %_libdir/pkgconfig/libUniSet*.pc
%exclude %_libdir/pkgconfig/*Extentions.pc
%exclude %_libdir/pkgconfig/libUniSetIO*.pc
%exclude %_libdir/pkgconfig/libUniSetLog*.pc
%exclude %_libdir/pkgconfig/libUniSetMB*.pc
%exclude %_libdir/pkgconfig/libUniSetRT*.pc
%exclude %_libdir/pkgconfig/libUniSetShared*.pc
%files -n %name-mysql-dbserver
%_bindir/%name-mysql-*dbserver
%_libdir/*-mysql.so*
%files -n lib%name-doc
%if_enabled doc
%_docdir/%name
%endif
%files -n lib%name-extentions
%_libdir/*Extentions.so*
%_libdir/libUniSetIO*.so*
%_libdir/libUniSetLP*.so*
%_libdir/libUniSetMB*.so*
%_libdir/libUniSetRT*.so*
%_libdir/libUniSetShared*.so*
%files -n lib%name-extentions-devel
%_includedir/%name/extentions
%_libdir/pkgconfig/*Extentions.pc
%_libdir/pkgconfig/libUniSetIO*.pc
%_libdir/pkgconfig/libUniSetLog*.pc
%_libdir/pkgconfig/libUniSetMB*.pc
%_libdir/pkgconfig/libUniSetRT*.pc
%_libdir/pkgconfig/libUniSetShared*.pc
#%_libdir/pkgconfig/libUniSet*.pc
%exclude %_libdir/pkgconfig/libUniSet.pc
%files -n %name-extentions
%_bindir/%name-iocontrol
%_bindir/%name-iotest
%_bindir/%name-iocalibr
%_bindir/%name-logicproc
%_bindir/%name-plogicproc
%_bindir/mtrconv
%_bindir/rtustate
%_bindir/%name-rtuexchange
%_bindir/%name-smemory
%changelog
* Sat Jan 17 2009 Pavel Vainerman <pv@altlinux.ru> 0.96-alt7
- new version
* Tue Dec 16 2008 Pavel Vainerman <pv@altlinux.ru> 0.96-alt1
- new version (+extentions)
* Tue Nov 27 2007 Pavel Vainerman <pv@altlinux.ru> 0.93-alt13
- new version
* Tue Nov 27 2007 Pavel Vainerman <pv@altlinux.ru> 0.93-alt11
- new version
* Sun Nov 04 2007 Pavel Vainerman <pv@altlinux.ru> 0.92-alt5
- new version
* Tue Oct 23 2007 Pavel Vainerman <pv@altlinux.ru> 0.92-alt4
- build for C30
* Wed Oct 17 2007 Pavel Vainerman <pv@altlinux.ru> 0.91-alt8
- new version
* Wed Oct 17 2007 Pavel Vainerman <pv@altlinux.ru> 0.91-alt7
- new version
* Fri Sep 14 2007 Pavel Vainerman <pv@altlinux.ru> 0.91-alt6
- new version
* Fri Aug 03 2007 Pavel Vainerman <pv@altlinux.ru> 0.91-alt5
- new build for C30
* Thu Aug 02 2007 Pavel Vainerman <pv@altlinux.ru> 0.91-alt4
- new version for C30
* Thu Aug 02 2007 Pavel Vainerman <pv@altlinux.ru> 0.91-alt3
- new version for C30
* Mon Jul 30 2007 Pavel Vainerman <pv@altlinux.ru> 0.91-alt1
- build for C30
* Fri Jul 13 2007 Pavel Vainerman <pv@altlinux.ru> 0.9-alt14.C30
- buid for C30
* Sun Jul 08 2007 Pavel Vainerman <pv@altlinux.ru> 0.9-alt13
- new build
* Sat Jul 07 2007 Pavel Vainerman <pv@altlinux.ru> 0.9-alt0.C30.1
- build for C30
* Tue Jun 19 2007 Pavel Vainerman <pv@altlinux.ru> 0.8-alt10.M30
- new version
* Mon Jun 18 2007 Pavel Vainerman <pv@altlinux.ru> 0.8-alt9.M30
- new version (for M30)
* Mon Jun 18 2007 Pavel Vainerman <pv@altlinux.ru> 0.8-alt8.M30
- new version (for M30)
* Mon Jun 18 2007 Pavel Vainerman <pv@altlinux.ru> 0.8-alt7
- new version (for M30)
* Mon Jun 18 2007 Pavel Vainerman <pv@altlinux.ru> 0.8-alt1
- new build
* Mon Jun 18 2007 Pavel Vainerman <pv@altlinux.ru> 0.7-alt5
- new build
* Sat Feb 17 2007 Pavel Vainerman <pv@altlinux.ru> 0.7-alt2
- new build
* Mon Feb 05 2007 Pavel Vainerman <pv@altlinux.ru> 0.7-alt1
- new build
* Mon Dec 25 2006 Pavel Vainerman <pv@altlinux.ru> 0.7-alt0.1
- new build
* Tue Jun 13 2006 Pavel Vainerman <pv@altlinux.ru> 0.6-alt2
- fix bug for gcc 4.1.0
* Tue Jun 13 2006 Pavel Vainerman <pv@altlinux.ru> 0.6-alt1
- new version
* Fri Sep 09 2005 Pavel Vainerman <pv@altlinux.ru> 0.5.RC5-alt2
- fixed bug ind AskDUmper::SInfo::operator=
* Mon Aug 29 2005 Pavel Vainerman <pv@altlinux.ru> 0.5.RC5-alt1
- detach mysql-dbserver
- add --disable-mysql for configure script
* Fri Jun 24 2005 Pavel Vainerman <pv@altlinux.ru> 0.5.RC1-alt1
- build new version
- fixed bugs
* Sat Mar 26 2005 Pavel Vainerman <pv@altlinux.ru> 0.4.9-alt4
- fixed bug in IOController: not registration child Objects
- add docs section for IOConfigure
* Sun Feb 27 2005 Pavel Vainerman <pv@altlinux.ru> 0.4.9-alt3
- change createNext in UniXML
- add copyNode (new function to UniXML)
* Tue Feb 22 2005 Pavel Vainerman <pv@altlinux.ru> 0.4.9-alt2
- bug fix for AskDumperXML1
* Mon Feb 21 2005 Pavel Vainerman <pv@altlinux.ru> 0.4.9-alt1
- add ClassGen utility
* Fri Feb 04 2005 Pavel Vainerman <pv@altlinux.ru> 0.4.8-alt1
- correct uniset-admin --logrotate function
* Sat Jan 29 2005 Pavel Vainerman <pv@altlinux.ru> 0.4.7-alt1
- compiled for gcc3.4
* Thu Jan 06 2005 Pavel Vainerman <pv@altlinux.ru> 0.4.6-alt1
- move idl files to /%_datadir/idl/%name
- remove old files
* Mon Jan 03 2005 Pavel Vainerman <pv@altlinux.ru> 0.4.4-alt1
- new version
- rename TimeService --> TimerService
- new start/stop scripts for local run
* Fri Dec 24 2004 Pavel Vainerman <pv@altlinux.ru> 0.4.1-alt1
- new version
- add analog and digital filters
- add sensibility for analog sensor
* Wed Dec 22 2004 Pavel Vainerman <pv@altlinux.ru> 0.0.4-alt1
- build new version
* Tue Nov 09 2004 Pavel Vainerman <pv@altlinux.ru> 0.0.2-alt1
- new version
- disable uniset.xxx-xxx.xxx.rpm
* Mon Nov 08 2004 Pavel Vainerman <pv@altlinux.ru> 0.0.1-alt1
- first build
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# AC_PREREQ(2.59)
AC_INIT([uniset], [0.96], pv@etersoft.ru)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
AC_CONFIG_HEADER(config.h)
dnl Initialize maintainer mode
AM_MAINTAINER_MODE
dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_LANG_CPLUSPLUS dnl switch to C++
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl Initialize libtool
AC_DISABLE_STATIC
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
AM_PROG_LIBTOOL
LIBVER=0:9:0
AC_SUBST(LIBVER)
# Checks for libraries.
PKG_CHECK_MODULES(XML, libxml-2.0)
PKG_CHECK_MODULES(OMNI, omniORB4)
#OMNI_CFLAGS=-D__OMNIORB4
#OMNI_LIBS=-lomniORB4
PKG_CHECK_MODULES(SIGC, sigc++-2.0)
AC_SUBST(SIGC_CFLAGS)
AC_SUBST(SIGC_LIBS)
PKG_CHECK_MODULES(COMCPP, libccgnu2)
AC_SUBST(COMCPP_CFLAGS)
AC_SUBST(COMCPP_LIBS)
# export
LDFLAGS="${OMNI_LIBS} ${XML_LIBS}"
CXXFLAGS="-pedantic -Wall -funsigned-char -D_GNU_SOURCE ${OMNI_CFLAGS} ${XML_CFLAGS} -I\$(top_builddir)/include"
AC_SUBST(LDFLAGS)
AC_SUBST(CXXFLAGS)
# check IDL-compile
IDL=""
AC_CHECK_PROG(IDL, omniidl,[yes])
if test "x$IDL" != x ; then
IDL="omniidl"
else
AC_MSG_ERROR([*** omniidl not found.])
fi
AC_SUBST(IDL)
#check mysql support
AC_MSG_CHECKING([mysql support])
dmysql=false
AC_ARG_ENABLE(mysql, AC_HELP_STRING([--disable-mysql], [disable MySQL support]),
[ if test $enableval = yes; then dmysql=false; else dmysql=true; fi],[ dmysql=false; ])
if test ${dmysql} = false; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(DISABLE_MYSQL, test ${dmysql} = true)
#check build extentions
ext=true
AC_MSG_CHECKING([Extentions])
AC_ARG_ENABLE(extentions,AC_HELP_STRING([--disable-extentions], [disable build uniset extentions]),
[ if test $enableval = yes; then ext=true; else ext=false; fi],[ ext=true; ])
if test ${ext} = true; then
AC_MSG_RESULT([enabled])
# check comedilib
PKG_CHECK_MODULES(COMEDI,comedilib)
AC_SUBST(COMEDI_LIBS)
AC_SUBST(COMEDI_CFLAGS)
else
AC_MSG_RESULT([disabled])
fi
AM_CONDITIONAL(HAVE_EXTENTIONS, test ${ext} = true)
# check Doxygen
DOXYGEN=""
doc=true
dox=
AC_MSG_CHECKING([Generate docs])
AC_ARG_ENABLE(docs,AC_HELP_STRING([--disable-docs], [disable build docs]),
[ if test $enableval = yes; then doc=true; else doc=false; fi],[ doc=true; ])
if test ${doc} = true; then
AC_MSG_RESULT([yes])
AC_CHECK_PROG(dox,doxygen,[yes])
if test "x$dox" != x ; then
DOXYGEN="doxygen"
else
AC_MSG_WARN([*** Doxygen not found])
fi
else
DOXYGEN=
AC_MSG_RESULT([no])
fi
AC_SUBST(DOXYGEN)
AM_CONDITIONAL(HAVE_DOXYGEN, test x$DOXYGEN != x)
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([fcntl.h sys/time.h sys/socket.h syslog.h termios.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_VOLATILE
# Checks for library functions.
#AC_FUNC_CLOSEDIR_VOID
#AC_FUNC_ERROR_AT_LINE
#AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([atexit getcwd gettimeofday atomic_set])
AC_CONFIG_FILES([Makefile
libUniSet.pc
lib/Makefile
IDL/Makefile
IDL/UniSetTypes/Makefile
IDL/Processes/Makefile
IDL/Services/Makefile
src/Communications/Makefile
src/Communications/Modbus/Makefile
src/IOs/Makefile
src/Interfaces/Makefile
src/ObjectRepository/Makefile
src/Processes/Makefile
src/Services/Makefile
src/Threads/Makefile
src/Timers/Makefile
src/Various/Makefile
src/Makefile
include/Makefile
include/modbus/Makefile
include/IOs/Makefile
docs/Makefile
docs/UniSetDox.cfg
docs/UniSetDoxDevel.cfg
Utilities/Makefile
Utilities/scripts/Makefile
Utilities/Admin/Makefile
Utilities/NullController/Makefile
Utilities/SViewer-text/Makefile
Utilities/SMonit/Makefile
Utilities/InfoServer/Makefile
Utilities/MBTester/Makefile
Utilities/DBServer-MySQL/Makefile
Utilities/codegen/Makefile
Utilities/codegen/uniset-codegen
Utilities/codegen/tests/Makefile
extentions/Makefile
extentions/libUniSetExtentions.pc
extentions/lib/Makefile
extentions/include/Makefile
extentions/IOControl/Makefile
extentions/IOControl/libUniSetIOControl.pc
extentions/RTUExchange/Makefile
extentions/RTUExchange/libUniSetRTU.pc
extentions/UDPExchange/Makefile
extentions/UDPExchange/libUniSetUDP.pc
extentions/ModbusSlave/Makefile
extentions/ModbusSlave/libUniSetMBSlave.pc
extentions/LogicProcessor/Makefile
extentions/LogicProcessor/libUniSetLogicProcessor.pc
extentions/SharedMemory/Makefile
extentions/SharedMemory/libUniSetSharedMemory.pc
extentions/SharedMemoryPlus/Makefile])
AC_OUTPUT
This diff is collapsed. Click to expand it.
/*!
\page ConfigurationPage
- \ref ConfigurationPage_secCommon
- \ref ConfigurationPage_secConfFile
\section ConfigurationPage_secCommon
( "configure.xml").
UniSetTypes::conf (. UniSetTypes::Configuration).
UniSetTypes::conf->oind (. UniSetTypes::Configuration::oind),
UniSetTypes::conf->mi (. UniSetTypes::Configuration::mi),
...
UniSetTypes::conf .
main. :
\code
...
#include "ObjectsMap.h"
using namespace UniSetTypes;
int main(int argc, char **argv)
{
try
{
conf = new Configuration(argc, (const char**)argv, "configure.xml", (ObjectInfo*)ObjectsMap);
...
...
}
catch(Exception& ex )
{
unideb[Debug::CRIT] << "(main): " << ex << endl;
}
catch(...)
{
unideb[Debug::CRIT] << " !!!!"<< endl;
}
...
}
\endcode
\section ConfigurationPage_secConfFile
\code
<?xml version = '1.0' encoding = 'koi8-r' ?>
<UniSetTestConfiguration>
<!-- UniSet -->
<UniSet>
<LocalNode name="LocalhostNode"/>
<RootSection name="UniSet"/>
<ServicesSection name="Services"/>
<ImagesPath name="images"/>
<CountOfNet name="1"/>
<RepeatCount name="3"/>
<RepeatTimeoutMS name="50"/>
<UniSetDebug name="unideb" levels="crit,warn" file=""/>
<!-- SystemGuard -->
<WatchDogTime name="0"/> <!-- [] -->
<PingNodeTime name="15"/> <!-- [] -->
<AutoStartUpTime name="1"/> <!-- [] -->
<DumpStateTime name="0"/><!-- [] -->
<SleepTickMS name="2000"/><!-- [] -->
<!-- , -->
<ConfDir name=""/>
<DataDir name=""/>
<BinDir name=""/>
<LogDir name=""/>
<DocDir name=""/>
<LockDir name=""/>
</UniSet>
<Services section="Services">
<LocalTimerService name="TimerService1" MaxCountTimers="100" AskLifeTimeSEC="60"/>
<LocalInfoServer name="InfoServer1" dbrepeat="1">
<RouteList>
<!-- <consumer name="" node=""/> -->
</RouteList>
</LocalInfoServer>
<LocalDBServer name="DBServer1" dbnode="" dbname="Theatre" dbuser="dbadmin" dbpass="dbadmin">
<Tables></Tables>
</LocalDBServer>
</Services>
<!-- -->
<ListOfNodes>
<!--
:
infserver - id - ( "", )
dbnode - id db- DB( "", )
-->
<Node name="LocalhostNode" infserver="InfoServer1" dbserver="DBServer1"/>
</ListOfNodes>
</UniSetTestConfiguration>
\endcode
*/
\ No newline at end of file
/*!
\page ControlProcessPage
- \ref pgCP_secDeclareIDL
- \ref pgCP_secImplementation
- \ref pgCP_secMain
- \ref pgCP_secLT_Object
- \ref pgCP_secRecomendation
UniSetObject.
\par
\c on() \c off().
IDL.
\section pgCP_secDeclareIDL IDL
UniSetObject, IDL-.
\code
#ifndef TestActiveProcess_i_IDL_
#define TestActiveProcess_i_IDL_
// ------------------------------------------------------------------------------------------
#include "../../../IDL/BaseObjectTypes/UniSetObject_i.idl"
// ------------------------------------------------------------------------------------------
interface TestActiveProcess_i: UniSetObject_i
{
void on();
void off();
};
#endif
\endcode
\par
:
- TestActiveProcess_iSK.cc
- TestActiveProcess_iSK.hh
++.
\section pgCP_secImplementation C++
.
. \ref UniSetLibStylePage.
\par
UniSetObject_i UniSetObject.
.
\code
#ifndef TestActiveProcess_H_
#define TestActiveProcess_H_
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
#include "UniSetObject.h"
#include "TestActiveProcess_i.hh"
// ------------------------------------------------------------------------------------------
class TestActiveProcess:
public POA_TestActiveProcess_i,
public UniSetObject
{
public:
// ------- ---------------
TestActiveProcess( UniSetTypes::ObjectId id );
virtual ~TestActiveProcess();
// ------- IDL( ) ---------
virtual void on();
virtual void off();
protected:
// ( )
virtual void processingMessage( UniSetTypes::VoidMessage *msg );
virtual void askSensors(UniversalIO::UIOCommand cmd);
virtual void sysCommand( UniSetTypes::SystemMessage* sm );
virtual void sensorInfo( UniSetTypes::SensorMessage* si );
virtual void timerInfo( UniSetTypes::TimerMessage* tm );
virtual void sigterm( int signo );
// protected
//
TestActiveProcess();
};
\endcode
:
\code
// ------------------------------------------------------------------------------------------
void TestActiveProcess::TestActiveProcess( UniSetTypes::ObjectId id ):
UniSetObject(id)
{
}
// ------------------------------------------------------------------------------------------
void TestActiveProcess::processingMessage( UniSetTypes::VoidMessage *msg)
{
try
{
switch(msg->type)
{
case Message::SensorInfo:
{
SensorMessage sm(msg);
sensorInfo(&sm);
break;
}
case Message::SysCommand:
{
SystemMessage sm(msg);
sysCommand(&sm);
break;
}
case Message::Timer:
{
TimerMessage tm(msg);
timerInfo(&tm);
break;
}
default:
cout << myname << ": "<< msg->type << endl;
break;
}
}
catch(Exception& ex)
{
cout << myname << "(processingMessage): " << ex << endl;
}
catch(...){}
}
// ------------------------------------------------------------------------------------------
void TestActiveProcess::askSensors(UniversalIO::UIOCommand cmd)
{
try
{
//
ui.askState(Sens1, cmd);
ui.askState(Sens2, cmd);
ui.askState(Sens3, cmd, remotenode);
//
ui.askValue(ASens1, cmd);
ui.askValue(ASens2, cmd);
}
catch( Exception& ex )
{
cout << myname << ex << endl;
}
}
// ------------------------------------------------------------------------------------------
void TestActiveProcess::sigterm( int signo )
{
cout << myname << "(sigterm): signo " << signo << endl;
askSensors( UniversalIO::UIODontNotify );
}
// ------------------------------------------------------------------------------------------
void TestActiveProcess::sysCommand( SystemMessage* sm )
{
cout << myname << "(sysCommand): command= "<< sm->command << endl;
switch(sm->command)
{
case SystemMessage::StartUp:
askSensors(UniversalIO::UIONotify);
break;
case SystemMessage::FoldUp:
case SystemMessage::Finish:
askSensors(UniversalIO::UIODontNotify);
break;
case SystemMessage::WatchDog:
askSensors(UniversalIO::UIONotify);
break;
default:
break;
}
}
// ------------------------------------------------------------------------------------------
void TestActiveProcess::sensorInfo( SensorMessage *si )
{
cout << myname << "(sensorInfo): name" << conf->oind.getNameById(si->id,si.node) << endl;
}
// ------------------------------------------------------------------------------------------
void TestActiveProcess::timerInfo( UniSetTypes::TimerMessage* tm )
{
cout << myname << "(timerInfo): timerId=" << tm->id << endl;
}
// ------------------------------------------------------------------------------------------
\endcode
\section pgCP_secMain main()
\code
#include "ObjectsMap.h"
#include "TestActiveProcess.h"
#include "ObjectsActivator.h"
#include "Configuration.h"
// ------------------------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
int main( int argc, char **argv )
{
try
{
conf = new Configuration(argc, (const char**)argv, "configure.xml", (ObjectInfo*)ObjectsMap);
TestActiveProcess tap(testControlProcess);
TestActiveProcess tap2(testControlProcess2);
ObjectsActivator activator;
activator.addObject(&tap);
activator.addObject(&tap2);
activator.run(false);
}
catch( Exception& ex )
{
cout << ex << endl;
}
catch(...)
{
cout << " !!!!"<< endl;
}
return 0;
}
\endcode
\section pgCP_secLT_Object , TimerService-
, , .
UniSetObject, UniSetObject_LT.
.. :
\code
...
class TestActiveProcess:
public POA_TestActiveProcess_i,
public UniSetObject_LT
{
public:
...
}
\endcode
\a ui.askTimer(...), \a askTimer(...).
\code
function my_func()
{
// ui.askTimer(TimerId1, Time)
askTimer(TimerId1, Time);
...
}
\endcode
UniSetObject_LT::askTimer() UniversalInterface::askTimer().
, UniSetObject::callback(),
, .
\sa LT_Object, UniSetObject_LT, ObjectsManager_LT
\section pgCP_secRecomendation
-# .
-# () .
. UniSetObject::sigterm().
-#
-# , \b \a startUp
.
-# , , UniversalInterface.
(UniSetObject::ui), .
\warning ( ) \b .
.
\par
...
*/
\ No newline at end of file
/*! \page DebugPage
DebugStream.
,
̣ ̣ .
- \ref subUsing
- \ref subConf
\subsection subUsing
DebugStream
UniSetTypes::unideb.
, logFile(char const *f);
DebugStream.h
.
unideb[...] .
unideb(...) ( ).
\par :
\code
#include "Debug.h"
#include "Configuration.h"
using namespace UniSetTypes;
...
unideb << " ";
unideb.addLevel(Debug::CRIT); // CRIT
unideb[Debug::CRIT] << " CRIT";
unideb.delLevel(Debug::CRIT); // CRIT
// INFO CRIT"
unideb[Debug::type(Debug::INFO | Debug::CRIT)] << " ";
//
unideb[Debug::INFO] << " ";
unideb(Debug::INFO) << " " << endl;
\endcode
, :
\code
if (unideb.debugging(Debug::INFO)) {
unideb << "...debug output...\n";
}
\endcode
\subsection subConf
, .
UniSetTypes::unideb :
\code
<UniSetDebug name="unideb" levels="crit,warn" file=""/>
\endcode
"--help"
*/
/*!
\page IOConfigurePage /
- \ref pgIOC_secCommon
- \ref pgIOC_secIOTypes
- \ref pgIOC_secAskFile
- \ref pgIOC_secDIO
- \ref pgIOC_secAIO
- \ref pgIOC_secThresholds
- \ref pgIOC_secConsumers
- \ref pgIOC_secSensorMessage
- \ref pgIOC_secAutoGen
\section pgIOC_secCommon
/ IONotifyContoller-
(dump-).
"" "" /,
"" . .
\section pgIOC_secIOTypes /
- \b DI -
- \b DO -
- \b AI -
- \b AO -
\section pgIOC_secAskFile ask-
:
\code
<IOConf readonly="1" dumptime="Wed Mar 23 14:14:42 2005">
<SensorsList>
<sensor name="MyProject/Sensors/AnalogSensor1_AS" node="" iotype="AI"
cmin="0" cmax="100" rmin="0" rmax="4096" default="50">
<consumer name="MyProject/ControlProcesses/Proc1" node=""/>
<consumer name="MyProject/ControlProcesses/Proc2" node=""/>
<consumer name="MyProject/ControlProcesses/Proc3" node=""/>
</sensor>
<sensor name="MyProject/Sensors/AnalogSensor2_AS" node="" iotype="AI"
cmin="10" cmax="500" rmin="0" rmax="4096" priority="">
<consumer name="MyProject/ControlProcesses/Proc1" node=""/>
<consumer name="MyProject/ControlProcesses/Proc2" node=""/>
<consumer name="MyProject/ControlProcesses/Proc3" node=""/>
</sensor>
<sensor name="MyProject/Sensors/DigitalSensor_S" node="" iotype="DI" default="1" priority="Hi">
<consumer name="MyProject/ControlProcesses/Proc1" node=""/>
</sensor>
<sensor name="MyProject/Sensors/ThreshooldSensor_FS" node="" iotype="DI">
<consumer name="MyProject/ControlProcesses/Proc1" node=""/>
<consumer name="MyProject/ControlProcesses/Proc2" node=""/>
</sensor>
</SensorsList>
<ThresholdSensorList>
<sensor name="MyProject/Sensors/AnalogSensor1_AS" node="" iotype="AI">
<Threshold name="t1" lowlimit="5" hilimit="7" sensibility="0" id="0">
<consumer name="MyProject/ControlProcesses/Proc4" node=""/>
</Threshold>
<Threshold name="t2" lowlimit="90" hilimit="92" sensibility="0" id="1"
sid="MyProject/Sensors/ThreshooldSensor_FS" inverse="1"
/>
</sensor>
<sensor name="MyProject/Sensors/AnalogSensor2_AS" node="" iotype="AI">
<Threshold name="t1" lowlimit="5" hilimit="7" sensibility="0" id="0" />
<Threshold name="t2" lowlimit="90" hilimit="92" sensibility="0" id="1"/>
</sensor>
</ThresholdSensorList>
</IOConf>
\endcode
:
- \a SensorsList - /
- \a ThresholdSensorList - .
:
- \a readonly - ,
( )
- \a dumptime -
\sa \ref pgIOC_secAutoGen
\subsection pgIOC_secDIO
\code
<sensor name="MyProject/Sensors/DigitalSensor_S" node="" iotype="DI"
default="1" priotiry
anyparam...>
...
</sensor>
\endcode
:
- \a name -
- \a node - . , Localhost.
- \a iotype - /.( . \ref pgIOC_secIOTypes )
:
- \a default - [1|0] . .. .
"0".
- \a priority - (UniSetTypes::SensorMessage)
. "Medium".
/ ( /) ..
\subsection pgIOC_secAIO
:
\code
<sensor name="MyProject/Sensors/AnalogSensor_S" node="" iotype="AI"
cmin="0" cmax="100" rmin="0" rmax="4096" default="50"
anyparam...>
...
</sensor>
\endcode
:
- \a name -
- \a node - . , Localhost.
- \a iotype - /.( . \ref pgIOC_secIOTypes )
- \a cmin -
- \a cmax -
- \a rmin - "c" . ("" - .. )
- \a rmax - ""
:
- \a default - . .. .
"0".
- \a priority - (UniSetTypes::SensorMessage)
. "Medium".
\subsection pgIOC_secThresholds
- ,
̣ . .
() .
:
\code
<sensor name="MyProject/Sensors/AnalogSensor1_AS" node="" iotype="AI">
<Threshold name="t1" lowlimit="5" hilimit="7" sensibility="0" id="0">
<consumer name="MyProject/ControlProcesses/Proc4" node=""/>
</Threshold>
</sensor>
\endcode
sensor \a name, \a node, \a iotype ,
. ޣ \a SensorsList.
\par
Threshold:
- \a name - ( )
- \a lowlimit - .
<= (lowlimit-sensibility) .
- \a hilimit - .
>= (hilimit+sensibility) .
- \a sensibility - . , "ͣ" . . lowlimit, hilimit.
- \a sid - () .
. ..
, "sid".
TRUE -
FALSE -
- \a id - ().
SensorMessage .
() .
"sid" id .
- \a inverse - [1|0] , sid.
"" .
() "" .
( )
. :
\code
<sensor name="MyProject/Sensors/AnalogSensor1_AS" node="" iotype="AI">
<Threshold name="t2" lowlimit="90" hilimit="92" sensibility="0" id="1"
sid="MyProject/Sensors/ThreshooldSensor_FS" inverse="1"
/>
</sensor>
\endcode
"" \a sid.
\a SensorsList.
\subsection pgIOC_secConsumers
"" ()
UniSetTypes::SensorMessage .
"", "".
\section pgIOC_secSensorMessage ()
UniSetTypes::SensorMessage.
- \a state -
- \a value -
- \a tid -
- \a threshold -
...
\section pgIOC_secAutoGen ask-
*/
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment