LabJackTypeConverters.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_DEVICES_LABJACK_LINUX_LABJACKTYPECONVERTERS_H
17 #define SURGSIM_DEVICES_LABJACK_LINUX_LABJACKTYPECONVERTERS_H
18 
19 #include <array>
20 
22 
23 namespace SurgSim
24 {
25 namespace Device
26 {
27 namespace LabJack
28 {
29 
37 double doubleFromChars(const std::array<unsigned char, MAXIMUM_BUFFER>& bytes, int startIndex);
38 
46 uint32_t uint32FromChars(const std::array<unsigned char, LabJack::MAXIMUM_BUFFER> &bytes, int startIndex, int count);
47 
54 uint16_t uint16FromChars(const std::array<unsigned char, LabJack::MAXIMUM_BUFFER> &bytes, int startIndex, int count);
55 
56 }; // namespace LabJack
57 }; // namespace Device
58 }; // namespace SurgSim
59 
60 #endif // SURGSIM_DEVICES_LABJACK_LINUX_LABJACKTYPECONVERTERS_H
Definition: DriveElementFromInputBehavior.cpp:27
uint16_t uint16FromChars(const std::array< unsigned char, LabJack::MAXIMUM_BUFFER > &bytes, int startIndex, int count)
Converts an array of bytes to a uint16_t, with the least significant byte at startIndex.
Definition: LabJackTypeConverters.cpp:55
uint32_t uint32FromChars(const std::array< unsigned char, LabJack::MAXIMUM_BUFFER > &bytes, int startIndex, int count)
Converts an array of bytes to a uint32_t, with the least significant byte at startIndex, and the most significant byte at startIndex + byteCount - 1.
Definition: LabJackTypeConverters.cpp:41
double doubleFromChars(const std::array< unsigned char, MAXIMUM_BUFFER > &bytes, int startIndex)
Converts an eight byte array to a floating point double value.
Definition: LabJackTypeConverters.cpp:26