LabJackChecksums.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_LABJACKCHECKSUMS_H
17 #define SURGSIM_DEVICES_LABJACK_LINUX_LABJACKCHECKSUMS_H
18 
19 #include <array>
20 
22 
23 namespace SurgSim
24 {
25 namespace Device
26 {
27 
30 namespace LabJack
31 {
37 unsigned char normalChecksum8(const std::array<unsigned char, MAXIMUM_BUFFER>& bytes, int count);
38 
44 uint16_t extendedChecksum16(const std::array<unsigned char, MAXIMUM_BUFFER>& bytes, int count);
45 
50 unsigned char extendedChecksum8(const std::array<unsigned char, MAXIMUM_BUFFER>& bytes);
51 
57 void normalChecksum(std::array<unsigned char, MAXIMUM_BUFFER>* bytes, int count);
58 
64 void extendedChecksum(std::array<unsigned char, MAXIMUM_BUFFER>* bytes, int count);
65 
66 }; // namespace LabJack
67 }; // namespace Device
68 }; // namespace SurgSim
69 
70 #endif // SURGSIM_DEVICES_LABJACK_LINUX_LABJACKCHECKSUMS_H
void extendedChecksum(std::array< unsigned char, MAXIMUM_BUFFER > *bytes, int count)
Performs the 1's complement unsigned checksums required for extended command communication with the l...
Definition: LabJackChecksums.cpp:67
Definition: DriveElementFromInputBehavior.cpp:27
uint16_t extendedChecksum16(const std::array< unsigned char, MAXIMUM_BUFFER > &bytes, int count)
Calculates a 16-bit 1's complement unsigned checksum specifically for extended command communication ...
Definition: LabJackChecksums.cpp:44
void normalChecksum(std::array< unsigned char, MAXIMUM_BUFFER > *bytes, int count)
Performs the 8-bit 1's complement unsigned checksum required for normal command communication with th...
Definition: LabJackChecksums.cpp:62
unsigned char extendedChecksum8(const std::array< unsigned char, MAXIMUM_BUFFER > &bytes)
Calculates an 8-bit 1's complement unsigned checksum specifically for extended command communication ...
Definition: LabJackChecksums.cpp:57
unsigned char normalChecksum8(const std::array< unsigned char, MAXIMUM_BUFFER > &bytes, int count)
Calculates an 8-bit 1's complement unsigned checksum specifically for normal command communication wi...
Definition: LabJackChecksums.cpp:25