#include <escort97.h>
Inheritance diagram for Escort97:
Public Member Functions | |
Escort97 () | |
virtual | ~Escort97 () |
virtual Port::Error | close () |
Close the port. | |
Port::Error | open (const std::string &config) |
Open the port. | |
void | setNumValues (int num) |
Set number of values this partucular multimeter provides. | |
int | numValues () |
Return number of values this partucular multimeter provides. | |
std::string | mode (int i=0) |
The current measurement mode. | |
std::string | unit (int i=0) |
String representation of the unit. | |
double | value (int i=0) |
The measured value. | |
bool | hasValue () |
Do we have a measurement already? | |
bool | overflow () |
An overflow happened. | |
bool | lowBat () |
Battery is low. | |
void | setConsoleLogging (bool on) |
bool | timeout () const |
Check if there was a timeout. | |
int | start () |
Start the thread. | |
void | wait () |
Wait for the thread to finish (no timeout!). | |
void | stop () |
Gracefully stop the thread. | |
void | quit () |
Forcibly stop thread. | |
bool | running () const |
Is the thread running? | |
Static Public Member Functions | |
static DMMClass * | create () |
static DMMClass * | create_protocol (std::string protocolName) |
Create an instance of the given protocol. | |
static int | num_protocols () |
Return number of known protocols. | |
static Protocol | protocol (int i) |
Return protocol description. | |
static std::string | print_protocols () |
Return list of known protocol names separated by ' '. | |
static std::string | print_devices () |
Return list of known devices separated by ' '. | |
static bool | has_device (const std::string &deviceName) |
Test if the devicename is known. | |
static Device | get_device (const std::string &deviceName) |
Get device description. | |
static std::string | html_device_table () |
static std::string | device_table () |
Protected Member Functions | |
virtual Port::Error | open_impl (const std::string &config) |
Open the port (the real thing). | |
virtual void | run () |
The main loop. | |
std::string | byteToDigit (unsigned char byte) |
int | readData (Port *port, unsigned char *buffer, int syncByte, int minLen, int maxLen) const |
void | addValue (double value, int index) |
Protected Attributes | |
SerialPort | m_port |
time_t | m_openTime |
Seconds since epoch when port was opened. This is needed for the timeout. | |
bool | m_hasValue |
Set to true if a valid value has been read. | |
int | m_numValues |
Stores the number of values this multimeter provides. | |
bool | m_overflow |
Set to true if an overflow happened (And clear if the overflow condition is gone). | |
bool | m_lowBat |
Set true if multimeter indicates low battery state. | |
Mutex | m_mutex |
Hold this mutex when reading or writing values. | |
std::string | m_mode [8] |
The mode. | |
std::string | m_unit [8] |
The unit. | |
double | m_value [8] |
The value. | |
bool | m_consoleLogging |
bool | m_run |
pthread_t | m_pthread |
Static Protected Attributes | |
static Protocol | s_protocol [] |
static Device | s_device [] |
This is a 21 byte binary protocol. The Escort 97 multimeter continuously sends the collowing 21 byte packet:
Data Items ( 21 Nibbles ) | |
Item | Meaning |
1 | Start Code (0x0f) |
2 | Function |
3 | Primary Mode |
4 | Secondary Mode |
5 | Primary Value Digital 1 (From right to left) |
6 | Primary Value Digital 2 |
7 | Primary Value Digital 3 |
8 | Primary Value Digital 4 |
9 | Primary Value Digital 5 if = 11 the Primary Value = OL |
10 | Bit3 = Primary Sign( 1 = - ) ; Bit2-Bit0 = Primary Range |
11 | Secondary Value Digital 1 (From right to left) |
12 | Secondary Value Digital 2 |
13 | Secondary Value Digital 3 |
14 | Secondary Value Digital 4 |
15 | Secondary Value Digital 5 if = 11 the Secondary Value = OL |
16 | Bit3 = Secondary Sign( 1 = - ) ; Bit2-Bit0 = Secondary Range |
17 | Bit3 : dBm Set 0 = Normal ; 1 = dBm test Bit2 : A/mA Select 0 = mA ; 1 = A Bit1 : Input Warnning 0 = Right ; 1 = Error Bit0 : Battary State 0 = Right ; 1 = Low |
18 | Bit3 : 4000/40000 Set 0 = 4000 ; 1 = 40000 Bit2 : Peak Hold Set 0 = Normal ; 1 = Peak Hold test Bit1 : 1/1 ,1/100 Set 0 = 1/1 ; 1 = 1/100 Bit0 : +/- Set 0 = + ; 1 = - |
19 | Bit3 : Temp C ,Temp F Set 0 = Temp C ; 1 = Temp F Bit2 : Square Wave Output Select 0 = Unused ; 1 = Select Bit1 : Timer Counter Select 0 = Unused ; 1 = Select Bit0 : -- |
20 | Display Mode |
21 | Stop Code (0x00) |
Display values
100000 (0x20) Value Code = 0
100001 (0x21) Value Code = 1
100010 (0x22) Value Code = 2
100011 (0x23) Value Code = 3
100100 (0x24) Value Code = 4
100101 (0x25) Value Code = 5
100110 (0x26) Value Code = 6
100111 (0x27) Value Code = 7
101000 (0x28) Value Code = 8
101001 (0x29) Value Code = 9
101011 (0x2a) Value Code = OL
Decimal point | |||||||
Value: | Item9=1 | Item8=2 | Item7=4 | Item6=1 | Item5=9 | ||
Range: | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
V | 1.2419V | 12.419V | 124.19V | 1242.9V | |||
mV | 12.419mV | 124.19mV | |||||
uA | 124.19uA | 1241.9uA | |||||
mA | 12.419mA | 124.19mA | |||||
A | 1.2419A | 12.419A | |||||
ohmo | 124.19Ohm | 1.2419KOhm | 12.419KOhm | 124.19KOhm | 1.2419MOhm | 12.419M | 12.419nS |
diode | 1.2419V | ||||||
temp | 1241.9 Degree C/ Degree F | ||||||
Hz | 12.419Hz | 124.19Hz | 1.2419KHz | 12.419KHz | 124.19KHz | ||
mS | 124.19mS | 1241.9mS | |||||
Hz counter | 12.419Hz | 124.19Hz | 1.2419KHz | 12.419KHz | 124.19KHz | 1.2419MHz | 12.419MHz |
Primary function | ||||||||
Function | 02 | 03 | 17b1 | 17b0 | 19b3 | 19b2 | 19b1 | Notes |
AC V | -- | 00 | -- | 0 | -- | -- | -- | Item2 = 0 - 1 |
DC V | 01 | 01 | -- | 0 | -- | -- | -- | |
AC+DC V | 01 | 02 | -- | 0 | -- | -- | -- | |
AC mV | 02 | 00 | -- | 0 | -- | -- | -- | |
DC mV | 02 | 01 | -- | 0 | -- | -- | -- | |
AC+DC mV | 02 | 02 | -- | 0 | -- | -- | -- | |
AC uA | 03 | 00 | -- | 0 | -- | -- | -- | |
DC uA | 03 | 01 | -- | 0 | -- | -- | -- | |
AC+DC uA | 03 | 02 | -- | 0 | -- | -- | -- | |
AC mA | 04 | 00 | 0 | 0 | -- | -- | -- | |
DC mA | 04 | 01 | 0 | 0 | -- | -- | -- | |
AC+DC mA | 04 | 02 | 0 | 0 | -- | -- | -- | |
AC A | 04 | 00 | 1 | 0 | -- | -- | -- | |
DC A | 04 | 01 | 1 | 0 | -- | -- | -- | |
AC+DC A | 04 | 02 | 1 | 0 | -- | -- | -- | |
AC dBm | -- | 00 | -- | 1 | -- | -- | -- | Item2 = 0 - 4 |
DC dBm | -- | 01 | -- | 1 | -- | -- | -- | Item2 = 0 - 4 |
AC+DC dBm | -- | 02 | -- | 1 | -- | -- | -- | Item2 = 0 - 4 |
TEMP C | 05 | 03 | -- | -- | 0 | 0 | 0 | |
TEMP F | 05 | 03 | -- | -- | 1 | 0 | 0 | |
OHMO | 06 | 04 | -- | -- | -- | -- | -- | |
DIODE | 07 | 05 | -- | -- | -- | -- | -- | |
Cx | 08 | 06 | -- | -- | -- | -- | -- | |
Hz | -- | 08 | -- | -- | -- | -- | -- | Item2 = 0 - 4 |
Pulse Width | -- | 09 | -- | -- | -- | -- | -- | Item2 = 0 - 4 |
Duty Cycle | -- | 0A | -- | -- | -- | -- | -- | Item2 = 0 - 4 |
Hz Counter | 07 | 08 | -- | -- | -- | -- | -- |
Definition at line 130 of file escort97.h.
|
Definition at line 24 of file escort97.cpp. References DMMClass::setNumValues(). |
|
Definition at line 30 of file escort97.cpp. |
|
Definition at line 156 of file dmmclass.cpp. References DMMClass::m_value. Referenced by VC820::run(), PeakTech10Ascii::run(), M9803R::run(), GDM703::setAscii(), and MetexAscii::setMetexAscii(). |
|
Definition at line 56 of file escort97.cpp. |
|
Close the port.
Implements DMMClass. Definition at line 39 of file escort97.cpp. References SerialPort::close(), and m_port. |
|
Definition at line 138 of file escort97.h. |
|
Create an instance of the given protocol.
Definition at line 199 of file dmmclass.cpp. References DMMClass::Protocol::createFunction, DMMClass::num_protocols(), and DMMClass::s_protocol. |
|
Return table with information about all known devices Definition at line 295 of file dmmclass.cpp. References DMMClass::Device::brand, DMMClass::Device::name, DMMClass::numValues(), DMMClass::Device::port, and DMMClass::s_device. |
|
Get device description.
Definition at line 278 of file dmmclass.cpp. References DMMClass::Device::brand, DMMClass::Device::name, DMMClass::numValues(), and DMMClass::s_device. |
|
Test if the devicename is known.
Definition at line 260 of file dmmclass.cpp. References DMMClass::Device::brand, DMMClass::Device::name, DMMClass::numValues(), and DMMClass::s_device. |
|
Do we have a measurement already?
Definition at line 121 of file dmmclass.h. References DMMClass::m_hasValue, and DMMClass::m_mutex. |
|
Return HTML table with information about all known devices Definition at line 355 of file dmmclass.cpp. References DMMClass::Device::brand, DMMClass::Device::name, DMMClass::numValues(), DMMClass::Device::port, and DMMClass::s_device. |
|
Battery is low. The Implementation of the multimeter class has to take care of this. Definition at line 133 of file dmmclass.h. References DMMClass::m_lowBat, and DMMClass::m_mutex. |
|
The current measurement mode. The specific implementation must set these to one of the following (The GUI QtDMM depends on this).
Definition at line 144 of file dmmclass.cpp. References DMMClass::m_mode, and DMMClass::m_mutex. |
|
Return number of known protocols.
Definition at line 212 of file dmmclass.cpp. References DMMClass::count_protocols(). Referenced by DMMClass::create_protocol(). |
|
Return number of values this partucular multimeter provides. Some multimeter may have more than on value. This class supports up to 8 values.
Definition at line 85 of file dmmclass.h. References DMMClass::m_numValues. Referenced by DMMClass::device_table(), DMMClass::get_device(), DMMClass::has_device(), DMMClass::html_device_table(), and DMMClass::print_devices(). |
|
Open the port.
Definition at line 130 of file dmmclass.cpp. References DMMClass::m_openTime, and DMMClass::open_impl(). |
|
Open the port (the real thing).
Implements DMMClass. Definition at line 34 of file escort97.cpp. References m_port, and SerialPort::open(). |
|
An overflow happened. The Implementation of the multimeter class has to take care of this. Definition at line 127 of file dmmclass.h. References DMMClass::m_mutex, and DMMClass::m_overflow. |
|
Return list of known devices separated by '
Definition at line 244 of file dmmclass.cpp. References DMMClass::Device::brand, DMMClass::Device::name, DMMClass::numValues(), and DMMClass::s_device. |
|
Return list of known protocol names separated by '
Definition at line 228 of file dmmclass.cpp. References DMMClass::Protocol::menuText, DMMClass::Protocol::name, and DMMClass::s_protocol. |
|
Return protocol description.
Definition at line 221 of file dmmclass.h. References DMMClass::s_protocol. |
|
Forcibly stop thread. Not recommended as this might leak resources Definition at line 52 of file thread.cpp. |
|
Helper function. Read data from the given port.
Definition at line 167 of file dmmclass.cpp. References DMMClass::m_consoleLogging, Port::Ok, and Port::readByte(). Referenced by MetexAscii::run(), M9803R::run(), GDM703::run(), and run(). |
|
The main loop. Continuously read the multimeter here (And do whatever is needed to make the multimeter send values [polling]). New values have to be filled into m_value, m_mode and m_unit. Hold the mutex while doing so. Example: ... we assume a 14 byte protocol ...
unsigned char buffer[64];
while (m_run) { int cnt = readData( buffer );
if (-1 != cnt) { unsigned char *byte = buffer+cnt-14;
... decode the raw multimeter data ...
m_mutex.lock(); m_value[0] = ... m_unit[0] = ... m_mode[0] = ... m_hasValue = true; m_mutex.unlock(); } } Implements DMMClass. Definition at line 44 of file escort97.cpp. References m_port, Thread::m_run, and DMMClass::readData(). |
|
Is the thread running?
Definition at line 62 of file thread.h. References Thread::m_run. |
|
Definition at line 135 of file dmmclass.h. References DMMClass::m_consoleLogging. |
|
Set number of values this partucular multimeter provides. Some multimeter may have more than on value. This class supports up to 8 values.
Definition at line 78 of file dmmclass.h. References DMMClass::m_numValues. Referenced by Escort97(), and GDM703::GDM703(). |
|
Start the thread.
Definition at line 39 of file thread.cpp. References Thread::m_pthread, Thread::m_run, and Thread::start_thread(). Referenced by MetexAscii::MetexAscii(), MetexAscii::run(), and GDM703::run(). |
|
Gracefully stop the thread.
Definition at line 54 of file thread.h. References Thread::m_run. |
|
Check if there was a timeout. If the multimeter didn't send data for 5 seconds this goes true Definition at line 137 of file dmmclass.cpp. References DMMClass::m_hasValue, and DMMClass::m_openTime. |
|
String representation of the unit. Example: V, mV, uV, A, uA, nF, mH, MOhm, kOhm.
Definition at line 150 of file dmmclass.cpp. References DMMClass::m_mutex, and DMMClass::m_unit. |
|
The measured value.
Definition at line 161 of file dmmclass.cpp. References DMMClass::m_mutex, and DMMClass::m_value. Referenced by PeakTech10Ascii::run(), GDM703::setAscii(), and MetexAscii::setMetexAscii(). |
|
Wait for the thread to finish (no timeout!).
Definition at line 47 of file thread.cpp. References Thread::m_pthread. |
|
Definition at line 265 of file dmmclass.h. Referenced by DMMClass::readData(), and DMMClass::setConsoleLogging(). |
|
Set to true if a valid value has been read.
Definition at line 250 of file dmmclass.h. Referenced by DMMClass::hasValue(), VC820::run(), PeakTech10Ascii::run(), MetexAscii::run(), M9803R::run(), GDM703::run(), GDM703::setAscii(), MetexAscii::setMetexAscii(), and DMMClass::timeout(). |
|
Set true if multimeter indicates low battery state.
Definition at line 256 of file dmmclass.h. Referenced by DMMClass::lowBat(), and VC820::run(). |
|
The mode.
Definition at line 260 of file dmmclass.h. Referenced by DMMClass::mode(), VC820::run(), PeakTech10Ascii::run(), M9803R::run(), GDM703::setAscii(), and MetexAscii::setMetexAscii(). |
|
Hold this mutex when reading or writing values.
Definition at line 258 of file dmmclass.h. Referenced by DMMClass::hasValue(), DMMClass::lowBat(), DMMClass::mode(), DMMClass::overflow(), VC820::run(), PeakTech10Ascii::run(), M9803R::run(), GDM703::setAscii(), MetexAscii::setMetexAscii(), DMMClass::unit(), and DMMClass::value(). |
|
Stores the number of values this multimeter provides.
Definition at line 252 of file dmmclass.h. Referenced by DMMClass::numValues(), MetexAscii::run(), and DMMClass::setNumValues(). |
|
Seconds since epoch when port was opened. This is needed for the timeout.
Definition at line 248 of file dmmclass.h. Referenced by DMMClass::open(), and DMMClass::timeout(). |
|
Set to true if an overflow happened (And clear if the overflow condition is gone).
Definition at line 254 of file dmmclass.h. Referenced by DMMClass::overflow(), M9803R::run(), GDM703::setAscii(), and MetexAscii::setMetexAscii(). |
|
Definition at line 141 of file escort97.h. Referenced by close(), open_impl(), and run(). |
|
Definition at line 66 of file thread.h. Referenced by Thread::start(), and Thread::wait(). |
|
Definition at line 65 of file thread.h. Referenced by VC820::run(), PeakTech10Ascii::run(), MetexAscii::run(), M9803R::run(), GDM703::run(), run(), Thread::running(), Thread::start(), and Thread::stop(). |
|
The unit.
Definition at line 262 of file dmmclass.h. Referenced by VC820::run(), PeakTech10Ascii::run(), M9803R::run(), GDM703::setAscii(), MetexAscii::setMetexAscii(), and DMMClass::unit(). |
|
The value.
Definition at line 264 of file dmmclass.h. Referenced by DMMClass::addValue(), and DMMClass::value(). |
|
Definition at line 268 of file dmmclass.h. Referenced by DMMClass::device_table(), DMMClass::get_device(), DMMClass::has_device(), DMMClass::html_device_table(), and DMMClass::print_devices(). |
|
Initial value: { Protocol( &Metex14BytesPolling::create, "M14P", "Metex 14 bytes ASCII polling" ), Protocol( &Metex14BytesContinuous::create, "M14C", "Metex 14 bytes ASCII continuous" ), Protocol( &Metex15BytesContinuous::create, "M15C", "Metex 15 bytes ASCII continuous" ), Protocol( &VC820::create, "VC820", "VC820 14 bytes binary continuous" ), Protocol( &M9803R::create, "M9803R", "M9803R 12 bytes binary continuous" ), Protocol( &IOCBUVMonitor::create, "IOCB", "IOCB UV Monitor" ), Protocol( &PeakTech10Ascii::create, "PT10A", "Peaktech 11 bytes ASCII" ), Protocol( &GDM703::create, "GDM703", "GDM703 26 bytes binary continuous" ), Protocol( &Escort97::create, "ESC97", "Escort 97 binary continuous" ), Protocol( 0, "", "" ) } Definition at line 267 of file dmmclass.h. Referenced by DMMClass::count_protocols(), DMMClass::create_protocol(), DMMClass::print_protocols(), and DMMClass::protocol(). |