kmlSctBase.cpp
Go to the documentation of this file.
00001 //
00002 // C++ Implementation: kmlSctBase
00003 //
00004 // Description:
00005 //
00006 //
00007 // Author: Tiziano Müller <tiziano.mueller@neuronics.ch>, (C) 2006
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 
00013 #include "KNI/kmlSctBase.h"
00014 
00015 
00016 bool CSctBase::init(CKatBase* _own, const TSctDesc _sctDesc, CCplBase* _protocol) {
00017         gnl.own = _own;
00018         gnl.SID = _sctDesc.ctrlID;
00019         gnl.res = _sctDesc.sens_res;
00020         dat.cnt = _sctDesc.sens_count;
00021         dat.arr = new short[dat.cnt];
00022         protocol =  _protocol;
00023         return true;
00024 }
00025 
00026 
00027 void CSctBase::recvDAT() {
00028         int i;                  //iterator
00029         byte    p[32];          //packet
00030         byte    buf[256];       //readbuf
00031         byte    sz = 0;         //readbuf size
00032 
00033         //switch between 8/12 bit resolution
00034         p[0] = 'E';
00035         p[1] = gnl.SID;
00036 
00037         protocol->comm(p,buf,&sz);
00038         if (!buf[1])
00039                 throw ParameterReadingException("DAT");
00040         for (i=0; i<dat.cnt; i++) {
00041                 dat.arr[i] = (short)buf[i+2];
00042         }
00043 
00044 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


kni
Author(s): Neuronics AG (see AUTHORS.txt); ROS wrapper by Martin Günther
autogenerated on Tue May 28 2013 14:52:54