Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
KNI_4.3.0
src
Base
kmlSctBase.cpp
Go to the documentation of this file.
1
//
2
// C++ Implementation: kmlSctBase
3
//
4
// Description:
5
//
6
//
7
// Author: Tiziano Müller <tiziano.mueller@neuronics.ch>, (C) 2006
8
//
9
// Copyright: See COPYING file that comes with this distribution
10
//
11
//
12
13
#include "
KNI/kmlSctBase.h
"
14
15
16
bool
CSctBase::init
(
CKatBase
* _own,
const
TSctDesc
_sctDesc,
CCplBase
* _protocol) {
17
gnl
.
own
= _own;
18
gnl
.
SID
= _sctDesc.
ctrlID
;
19
gnl
.
res
= _sctDesc.
sens_res
;
20
dat
.
cnt
= _sctDesc.
sens_count
;
21
dat
.
arr
=
new
short
[
dat
.
cnt
];
22
protocol
= _protocol;
23
return
true
;
24
}
25
26
27
void
CSctBase::recvDAT
() {
28
int
i;
//iterator
29
byte
p[32];
//packet
30
byte
buf[256];
//readbuf
31
byte
sz = 0;
//readbuf size
32
33
//switch between 8/12 bit resolution
34
p[0] =
'E'
;
35
p[1] =
gnl
.
SID
;
36
37
protocol
->
comm
(p,buf,&sz);
38
if
(!buf[1])
39
throw
ParameterReadingException
(
"DAT"
);
40
for
(i=0; i<
dat
.
cnt
; i++) {
41
dat
.
arr
[i] = (short)buf[i+2];
42
}
43
44
}
byte
unsigned char byte
type specification (8 bit)
Definition:
cdlBase.h:29
kmlSctBase.h
CSctBase::gnl
TSctGNL gnl
controller generals
Definition:
kmlSctBase.h:77
TSctDesc::sens_count
short sens_count
count of sensors
Definition:
kmlSctBase.h:36
CCplBase
Abstract base class for protocol definiton.
Definition:
cplBase.h:47
CSctBase::dat
TSctDAT dat
sensor data
Definition:
kmlSctBase.h:78
TSctDesc::ctrlID
byte ctrlID
controller number (ID)
Definition:
kmlSctBase.h:34
CKatBase
Base Katana class.
Definition:
kmlBase.h:132
CSctBase::protocol
CCplBase * protocol
protocol interface
Definition:
kmlSctBase.h:85
TSctDAT::cnt
short cnt
count of sensors
Definition:
kmlSctBase.h:58
TSctDAT::arr
short * arr
sensor data
Definition:
kmlSctBase.h:59
CCplBase::comm
virtual void comm(const byte *pack, byte *buf, byte *size)=0
Base communication function.
TSctGNL::res
short res
resolution: 8/12 bit
Definition:
kmlSctBase.h:52
TSctGNL::SID
byte SID
slave ID
Definition:
kmlSctBase.h:51
TSctDesc
sensor controller description (partly)
Definition:
kmlSctBase.h:33
ParameterReadingException
Definition:
kmlCommon.h:44
TSctGNL::own
CKatBase * own
parent robot
Definition:
kmlSctBase.h:50
TSctDesc::sens_res
short sens_res
resolution: 8/12 bit
Definition:
kmlSctBase.h:35
CSctBase::init
bool init(CKatBase *_own, const TSctDesc _sctDesc, CCplBase *protocol)
Definition:
kmlSctBase.cpp:16
CSctBase::recvDAT
void recvDAT()
receive data
Definition:
kmlSctBase.cpp:27
kni
Author(s): Martin Günther
autogenerated on Fri Jan 3 2020 04:01:16