Urbi SDK Remote for C++  2.7.5
sensor.cc
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008-2011, Gostai S.A.S.
00003  *
00004  * This software is provided "as is" without warranty of any kind,
00005  * either expressed or implied, including but not limited to the
00006  * implied warranties of fitness for a particular purpose.
00007  *
00008  * See the LICENSE file for more information.
00009  */
00010 
00011 #include <iostream>
00012 
00013 #include "sensor.hh"
00014 
00015 UStart(sensor);
00016 
00017 sensor::sensor(std::string s)
00018   : UObject(s)
00019 {
00020   UBindVar(sensor, val);
00021   USensor(val);
00022   val = 4;
00023   UBindFunction(sensor, init);
00024   UBindFunction(sensor, setVal);
00025   UNotifyChange(val, &sensor::newval);
00026   UNotifyAccess(val, &sensor::getval);
00027 }
00028 
00029 int
00030 sensor::init()
00031 {
00032   return 0;
00033 }
00034 
00035 UReturn
00036 sensor::newval(UVar& v)
00037 {
00038   std::cout << (int)v << std::endl;
00039   return 0;
00040 }
00041 
00042 void
00043 sensor::setVal(int v)
00044 {
00045   val = v;
00046 }
00047 
00048 UReturn
00049 sensor::getval(UVar& v)
00050 {
00051   v = 666;
00052   std::cout << "set value to 666" << std::endl;
00053   return 0;
00054 }