primary/package_header.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // Copyright 2019 FZI Forschungszentrum Informatik
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 // -- END LICENSE BLOCK ------------------------------------------------
18 
19 //----------------------------------------------------------------------
27 //----------------------------------------------------------------------
28 
29 #ifndef UR_CLIENT_LIBRARY_PRIMARY_INTERFACE_H_INCLUDED
30 #define UR_CLIENT_LIBRARY_PRIMARY_INTERFACE_H_INCLUDED
31 
32 #include <inttypes.h>
33 #include <cstddef>
34 #include <endian.h>
36 
37 namespace urcl
38 {
39 namespace primary_interface
40 {
41 static const int UR_PRIMARY_PORT = 30001;
42 static const int UR_SECONDARY_PORT = 30002;
46 enum class RobotPackageType : int8_t
47 {
48  DISCONNECT = -1,
49  ROBOT_STATE = 16,
50  ROBOT_MESSAGE = 20,
51  HMC_MESSAGE = 22,
56 };
57 
62 {
63 public:
64  PackageHeader() = default;
65  virtual ~PackageHeader() = default;
66 
67  using _package_size_type = int32_t;
68 
76  static size_t getPackageLength(uint8_t* buf)
77  {
78  return be32toh(*(reinterpret_cast<_package_size_type*>(buf)));
79  }
80 };
81 } // namespace primary_interface
82 } // namespace urcl
83 
84 #endif // ifndef UR_CLIENT_LIBRARY_PRIMARY_INTERFACE_H_INCLUDED
This class represents the header for primary packages.
static size_t getPackageLength(uint8_t *buf)
Reads a buffer, interpreting the next bytes as the size of the contained package. ...
static const int UR_SECONDARY_PORT
RobotPackageType
Possible RobotPackage types.


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Sun May 9 2021 02:16:26