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 // Created on behalf of Universal Robots A/S
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 // -- END LICENSE BLOCK ------------------------------------------------
19 
20 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
29 
30 #ifndef UR_CLIENT_LIBRARY_PRIMARY_INTERFACE_H_INCLUDED
31 #define UR_CLIENT_LIBRARY_PRIMARY_INTERFACE_H_INCLUDED
32 
33 #include <inttypes.h>
34 #include <cstddef>
35 #include <endian.h>
37 
38 namespace urcl
39 {
40 namespace primary_interface
41 {
42 static const int UR_PRIMARY_PORT = 30001;
43 static const int UR_SECONDARY_PORT = 30002;
47 enum class RobotPackageType : int8_t
48 {
49  DISCONNECT = -1,
50  ROBOT_STATE = 16,
51  ROBOT_MESSAGE = 20,
52  HMC_MESSAGE = 22,
57 };
58 
63 {
64 public:
65  PackageHeader() = default;
66  virtual ~PackageHeader() = default;
67 
68  using _package_size_type = int32_t;
69 
77  static size_t getPackageLength(uint8_t* buf)
78  {
79  return be32toh(*(reinterpret_cast<_package_size_type*>(buf)));
80  }
81 };
82 } // namespace primary_interface
83 } // namespace urcl
84 
85 #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 Tue Jul 4 2023 02:09:47