cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsSartoriusSerial.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Anton Deguet
7  Created on: 2009-03-27
8 
9  (C) Copyright 2009-2011 Johns Hopkins University (JHU), All Rights Reserved.
10 
11 --- begin cisst license - do not edit ---
12 
13 This software is provided "as is" under an open source license, with
14 no warranty. The complete license can be found in license.txt and
15 http://www.cisst.org/cisst/license.txt.
16 
17 --- end cisst license ---
18 */
19 
20 #ifndef _mtsSartoriusSerial_h
21 #define _mtsSartoriusSerial_h
22 
23 //includes from cisstlibraries
28 
29 // Always include last
31 
41 {
43 
44  protected:
45 
47  void SetSerialPortDefaults(void);
48 
50  void SetupInterface(void);
51 
53  void SendPrintToggle(void);
54 
55  public:
56  bool GetWeight(double & weightInGrams, bool & stable);
57  protected:
58  bool GetModel(std::string & modelName);
59  bool ProcessBuffer(void);
60  typedef const char * const_char_pointer;
61  void UpdateStateTable(const const_char_pointer & buffer);
62 
65 
67  enum {BUFFER_SIZE = 512};
68  char BytesReadSoFar[BUFFER_SIZE];
69  unsigned int NbBytesReadSoFar;
70  char TempBuffer[BUFFER_SIZE];
71 
74 
75  public:
76 
77  mtsSartoriusSerial(const std::string & taskName,
78  const std::string & serialPortName);
79  mtsSartoriusSerial(const std::string & taskName,
80  unsigned int serialPortNumber);
81 
82  // all four methods are pure virtual in mtsTaskContinous
83  void Configure(const std::string & CMN_UNUSED(filename)) {};
84  void Startup(void);
85  void Run(void);
86  void Cleanup(void);
87 
88 };
89 
91 
92 #endif //_mtsSartoriusSerial_h_
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
const char * const_char_pointer
Definition: mtsSartoriusSerial.h:60
unsigned int NbBytesReadSoFar
Definition: mtsSartoriusSerial.h:69
Portability across compilers and operating systems tools.
#define CMN_UNUSED(argument)
Definition: cmnPortability.h:479
Defines a continuously executing task.
virtual void Startup(void)
Definition: mtsComponent.h:262
void Configure(const std::string &CMN_UNUSED(filename))
Definition: mtsSartoriusSerial.h:83
mtsDouble Weight
Definition: mtsSartoriusSerial.h:64
#define CMN_DECLARE_SERVICES(hasDynamicCreation, lod)
Definition: cmnClassRegisterMacros.h:116
virtual void Run(void)=0
Device wrapper for Sartorius scale (model GC 2502)
Definition: mtsSartoriusSerial.h:40
Definition: mtsTaskContinuous.h:77
const int CMN_NO_DYNAMIC_CREATION
Definition: cmnClassRegisterMacros.h:328
Serial port.
Definition: osaSerialPort.h:50
virtual void Cleanup(void)
Definition: mtsComponent.h:267
Declaration of osaSerialPort.
CMN_DECLARE_SERVICES_INSTANTIATION(mtsSartoriusSerial)
osaSerialPort SerialPort
Definition: mtsSartoriusSerial.h:73
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76