updated to latest implementation

This commit is contained in:
Ruixiang Du
2019-10-10 11:19:24 +08:00
4461 changed files with 4820 additions and 518157 deletions

19
NOTE.md
View File

@@ -1,19 +0,0 @@
```
$ sudo apt-get install ros-kinetic-joint-state-controller
$ sudo apt-get install ros-kinetic-effort-controllers
$ sudo apt-get install ros-kinetic-position-controllers
```
```
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py cmd_vel:=scout_robot/cmd_vel
```
xacro to URDF
```
$ rosrun xacro xacro scout.urdf.xacro > agilex_scout.urdf
```
URDF to PROTO
```
$ python urdf2webots.py --input=someRobot.urdf [--output=outputFile] [--box-collision] [--normal]
```

View File

@@ -4,15 +4,64 @@
* scout_bringup: launch and configuration files to start ROS nodes
* scout_base: a ROS wrapper around Scout SDK to monitor and control the robot
* scout_sdk: Scout SDK customized for ROS
* scout_msgs: scout related message definitions
* (scout_robot: meta package for the Scout robot ROS packages)
* (scout_ros: meta package for the Scout robot ROS packages)
## Basic Usage
## Communication interface setup
### Setup CAN-To-USB adapter
1. Enable gs_usb kernel module
```
$ sudo modprobe gs_usb
```
2. Bringup can device
```
$ sudo ip link set can0 up type can bitrate 500000
```
3. If no error occured during the previous steps, you should be able to see the can device now by using command
```
$ ifconfig -a
```
4. Install and use can-utils to test the hardware
```
$ sudo apt install can-utils
```
5. Testing command
```
# receiving data from can0
$ candump can0
# send data to can0
$ cansend can0 001#1122334455667788
```
Two scripts inside the "scout_bringup/scripts" folder are provided for easy setup. You can run "./setup_can2usb.bash" for the first-time setup and run "./bringup_can2usb.bash" to bring up the device each time you unplug and re-plug the adapter.
### Setup UART
Generally your UART2USB cable should be automatically recognized as "/dev/ttyUSB0" or something similar and ready for use. If you get the error "... permission denied ..." when trying to open the port, you need to grant access of the port to your user accout:
```
$ sudo usermod -a -G dialout <username>
```
Replace "<username>" in the above command with your Linux username. You need to re-login to get the change to take effect.
## Basic usage of the ROS package
1. Install dependent ROS packages
```
$ sudo apt install ros-melodic-controller-manager
$ sudo apt install ros-melodic-teleop-twist-keyboard
```
@@ -33,11 +82,22 @@
* Start the base node
```
$ roslaunch scout_bringup scout_minimal.launch
```
```
$ roslaunch scout_bringup scout_minimal.launch
```
or (if you're using a serial port)
```
$ roslaunch scout_bringup scout_minimal_uart.launch
```
* Start the keyboard tele-op node
```
$ roslaunch scout_bringup scout_teleop_keyboard.launch
```
```
$ roslaunch scout_bringup scout_teleop_keyboard.launch
```
**SAFETY PRECAUSION**:
The default command values of the keyboard teleop node are high, make sure you decrease the speed commands before starting to control the robot with your keyboard! Have your remote controller ready to take over the control whenever necessary.

View File

@@ -4,9 +4,10 @@ project(scout_base)
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
# cmake module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(catkin REQUIRED COMPONENTS
controller_manager
hardware_interface
roslaunch
roslint
roscpp
@@ -14,7 +15,12 @@ find_package(catkin REQUIRED COMPONENTS
std_msgs
geometry_msgs
scout_msgs
tf)
scout_sdk
tf2
tf2_ros
)
# find_package(LCM REQUIRED)
# find_package(Boost REQUIRED COMPONENTS chrono)
@@ -24,8 +30,8 @@ find_package(catkin REQUIRED COMPONENTS
catkin_package(
INCLUDE_DIRS include
LIBRARIES scoutbase
CATKIN_DEPENDS hardware_interface scout_msgs roscpp sensor_msgs
LIBRARIES scout_messenger
CATKIN_DEPENDS scout_msgs roscpp sensor_msgs scout_sdk
# DEPENDS Boost
)
@@ -38,31 +44,35 @@ catkin_package(
include_directories(
include
${catkin_INCLUDE_DIRS}
${LCM_INCLUDE_DIRS}
)
# add scout sdk
add_subdirectory(src/scout_sdk)
add_library(scout_messenger STATIC src/scout_messenger.cpp)
target_link_libraries(scout_messenger scoutbase ${catkin_LIBRARIES})
target_link_libraries(scout_messenger ${catkin_LIBRARIES})
set_property(TARGET scout_messenger PROPERTY POSITION_INDEPENDENT_CODE ON)
add_executable(scout_base_node src/scout_base_node.cpp)
target_link_libraries(scout_base_node scoutbase scout_messenger ${catkin_LIBRARIES})
target_link_libraries(scout_base_node scout_messenger ${catkin_LIBRARIES})
# add_executable(imu_broadcast_node src/imu_broadcast_node.cpp)
# target_link_libraries(imu_broadcast_node ${catkin_LIBRARIES} ${LCM_LIBRARIES})
#############
## Install ##
#############
# roslaunch_add_file_check(launch)
roslaunch_add_file_check(launch)
# install(TARGETS scoutcpp scoutio scout_base
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(TARGETS scout_messenger scout_base_node
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
# install(DIRECTORY launch config
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY include/lcmtypes
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION})
install(DIRECTORY launch urdf
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

View File

@@ -0,0 +1,36 @@
###############################################################################
# Find package: lcm
#
# This sets the following variables:
# <package>_FOUND
# <package>_INCLUDE_DIRS
# <package>_LIBRARIES
# Source: https://github.com/RobotLocomotion/director/blob/master/cmake/modules/FindLCM.cmake
macro(pkg_config_find_module varname pkgname header library pathsuffix)
find_package(PkgConfig)
pkg_check_modules(${varname}_pkgconfig ${pkgname})
find_path(${varname}_INCLUDE_DIR ${header}
HINTS ${${varname}_pkgconfig_INCLUDEDIR}
PATH_SUFFIXES ${pathsuffix}
DOC "Path to ${pkgname} include directory")
find_library(${varname}_LIBRARY ${library} HINTS ${${varname}_pkgconfig_LIBDIR} DOC "Path to ${pkgname} library")
set(${varname}_INCLUDE_DIRS ${${varname}_INCLUDE_DIR})
set(${varname}_LIBRARIES ${${varname}_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(${varname} DEFAULT_MSG ${varname}_INCLUDE_DIR ${varname}_LIBRARY)
mark_as_advanced(${varname}_INCLUDE_DIR)
mark_as_advanced(${varname}_LIBRARY)
endmacro()
pkg_config_find_module(LCM lcm lcm/lcm.h lcm lcm)

View File

@@ -0,0 +1,17 @@
#ifndef __lcmtypes_wescore_h__
#define __lcmtypes_wescore_h__
#include "wescore_lcm_msgs_IMU.h"
#include "wescore_lcm_msgs_NavSatFix.h"
#include "wescore_lcm_msgs_NavSatStatus.h"
#include "wescore_lcm_msgs_Quaternion.h"
#include "wescore_lcm_msgs_RawAccel.h"
#include "wescore_lcm_msgs_RawGyro.h"
#include "wescore_lcm_msgs_RawIMU10DOF.h"
#include "wescore_lcm_msgs_RawIMU6DOF.h"
#include "wescore_lcm_msgs_RawIMU9DOF.h"
#include "wescore_lcm_msgs_RawMag.h"
#include "wescore_lcm_msgs_Vector2.h"
#include "wescore_lcm_msgs_Vector3.h"
#endif

View File

@@ -0,0 +1,17 @@
#ifndef __lcmtypes_wescore_hpp__
#define __lcmtypes_wescore_hpp__
#include "wescore_lcm_msgs/IMU.hpp"
#include "wescore_lcm_msgs/NavSatFix.hpp"
#include "wescore_lcm_msgs/NavSatStatus.hpp"
#include "wescore_lcm_msgs/Quaternion.hpp"
#include "wescore_lcm_msgs/RawAccel.hpp"
#include "wescore_lcm_msgs/RawGyro.hpp"
#include "wescore_lcm_msgs/RawIMU10DOF.hpp"
#include "wescore_lcm_msgs/RawIMU6DOF.hpp"
#include "wescore_lcm_msgs/RawIMU9DOF.hpp"
#include "wescore_lcm_msgs/RawMag.hpp"
#include "wescore_lcm_msgs/Vector2.hpp"
#include "wescore_lcm_msgs/Vector3.hpp"
#endif

View File

@@ -0,0 +1,215 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_IMU_hpp__
#define __wescore_lcm_msgs_IMU_hpp__
#include <lcm/lcm_coretypes.h>
#include "lcmtypes/wescore_lcm_msgs/Quaternion.hpp"
#include "lcmtypes/wescore_lcm_msgs/Vector3.hpp"
#include "lcmtypes/wescore_lcm_msgs/Vector3.hpp"
namespace wescore_lcm_msgs
{
class IMU
{
public:
int64_t mtime;
wescore_lcm_msgs::Quaternion orientation;
double orientation_covariance[9];
wescore_lcm_msgs::Vector3 angular_velocity;
double angular_velocity_covariance[9];
wescore_lcm_msgs::Vector3 linear_acceleration;
double linear_acceleration_covariance[9];
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "IMU"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int IMU::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int IMU::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int IMU::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t IMU::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* IMU::getTypeName()
{
return "IMU";
}
int IMU::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->orientation._encodeNoHash(buf, offset + pos, maxlen - pos);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->orientation_covariance[0], 9);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->angular_velocity._encodeNoHash(buf, offset + pos, maxlen - pos);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->angular_velocity_covariance[0], 9);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->linear_acceleration._encodeNoHash(buf, offset + pos, maxlen - pos);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->linear_acceleration_covariance[0], 9);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int IMU::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->orientation._decodeNoHash(buf, offset + pos, maxlen - pos);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->orientation_covariance[0], 9);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->angular_velocity._decodeNoHash(buf, offset + pos, maxlen - pos);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->angular_velocity_covariance[0], 9);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->linear_acceleration._decodeNoHash(buf, offset + pos, maxlen - pos);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->linear_acceleration_covariance[0], 9);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int IMU::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __int64_t_encoded_array_size(NULL, 1);
enc_size += this->orientation._getEncodedSizeNoHash();
enc_size += __double_encoded_array_size(NULL, 9);
enc_size += this->angular_velocity._getEncodedSizeNoHash();
enc_size += __double_encoded_array_size(NULL, 9);
enc_size += this->linear_acceleration._getEncodedSizeNoHash();
enc_size += __double_encoded_array_size(NULL, 9);
return enc_size;
}
uint64_t IMU::_computeHash(const __lcm_hash_ptr *p)
{
const __lcm_hash_ptr *fp;
for(fp = p; fp != NULL; fp = fp->parent)
if(fp->v == IMU::getHash)
return 0;
const __lcm_hash_ptr cp = { p, IMU::getHash };
uint64_t hash = 0xac2e31fe8e135e97LL +
wescore_lcm_msgs::Quaternion::_computeHash(&cp) +
wescore_lcm_msgs::Vector3::_computeHash(&cp) +
wescore_lcm_msgs::Vector3::_computeHash(&cp);
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,224 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_NavSatFix_hpp__
#define __wescore_lcm_msgs_NavSatFix_hpp__
#include <lcm/lcm_coretypes.h>
#include "lcmtypes/wescore_lcm_msgs/NavSatStatus.hpp"
namespace wescore_lcm_msgs
{
class NavSatFix
{
public:
wescore_lcm_msgs::NavSatStatus status;
double latitude;
double longitude;
double altitude;
double position_covariance[9];
int8_t position_covariance_type;
public:
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int8_t COVARIANCE_TYPE_UNKNOWN = 0;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int8_t COVARIANCE_TYPE_APPROXIMATED = 1;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int8_t COVARIANCE_TYPE_DIAGONAL_KNOWN = 2;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int8_t COVARIANCE_TYPE_KNOWN = 3;
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "NavSatFix"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int NavSatFix::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int NavSatFix::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int NavSatFix::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t NavSatFix::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* NavSatFix::getTypeName()
{
return "NavSatFix";
}
int NavSatFix::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = this->status._encodeNoHash(buf, offset + pos, maxlen - pos);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->latitude, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->longitude, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->altitude, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->position_covariance[0], 9);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->position_covariance_type, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int NavSatFix::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = this->status._decodeNoHash(buf, offset + pos, maxlen - pos);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->latitude, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->longitude, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->altitude, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->position_covariance[0], 9);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->position_covariance_type, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int NavSatFix::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += this->status._getEncodedSizeNoHash();
enc_size += __double_encoded_array_size(NULL, 1);
enc_size += __double_encoded_array_size(NULL, 1);
enc_size += __double_encoded_array_size(NULL, 1);
enc_size += __double_encoded_array_size(NULL, 9);
enc_size += __int8_t_encoded_array_size(NULL, 1);
return enc_size;
}
uint64_t NavSatFix::_computeHash(const __lcm_hash_ptr *p)
{
const __lcm_hash_ptr *fp;
for(fp = p; fp != NULL; fp = fp->parent)
if(fp->v == NavSatFix::getHash)
return 0;
const __lcm_hash_ptr cp = { p, NavSatFix::getHash };
uint64_t hash = 0x60c5a36268b1a1a0LL +
wescore_lcm_msgs::NavSatStatus::_computeHash(&cp);
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,200 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_NavSatStatus_hpp__
#define __wescore_lcm_msgs_NavSatStatus_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
/// GPS
class NavSatStatus
{
public:
int8_t status;
int16_t service;
public:
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int8_t STATUS_NO_FIX = -1;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int8_t STATUS_FIX = 0;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int8_t STATUS_SBAS_FIX = 1;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int8_t STATUS_GBAS_FIX = 2;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int16_t SERVICE_GPS = 1;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int16_t SERVICE_GLONASS = 2;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int16_t SERVICE_COMPASS = 4;
// If you're using C++11 and are getting compiler errors saying
// things like constexpr needed for in-class initialization of
// static data member then re-run lcm-gen with '--cpp-std=c++11'
// to generate code that is compliant with C++11
static const int16_t SERVICE_GALILEO = 8;
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "NavSatStatus"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int NavSatStatus::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int NavSatStatus::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int NavSatStatus::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t NavSatStatus::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* NavSatStatus::getTypeName()
{
return "NavSatStatus";
}
int NavSatStatus::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->status, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __int16_t_encode_array(buf, offset + pos, maxlen - pos, &this->service, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int NavSatStatus::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->status, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __int16_t_decode_array(buf, offset + pos, maxlen - pos, &this->service, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int NavSatStatus::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __int8_t_encoded_array_size(NULL, 1);
enc_size += __int16_t_encoded_array_size(NULL, 1);
return enc_size;
}
uint64_t NavSatStatus::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0x76b236592075c1dbLL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,175 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_Quaternion_hpp__
#define __wescore_lcm_msgs_Quaternion_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
class Quaternion
{
public:
double x;
double y;
double z;
double w;
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "Quaternion"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int Quaternion::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int Quaternion::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int Quaternion::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t Quaternion::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* Quaternion::getTypeName()
{
return "Quaternion";
}
int Quaternion::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->x, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->y, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->z, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->w, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int Quaternion::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->x, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->y, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->z, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->w, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int Quaternion::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __double_encoded_array_size(NULL, 1);
enc_size += __double_encoded_array_size(NULL, 1);
enc_size += __double_encoded_array_size(NULL, 1);
enc_size += __double_encoded_array_size(NULL, 1);
return enc_size;
}
uint64_t Quaternion::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0x9b1dee9dfc8c0515LL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,157 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_RawAccel_hpp__
#define __wescore_lcm_msgs_RawAccel_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
class RawAccel
{
public:
int64_t mtime;
float accel[3];
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "RawAccel"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int RawAccel::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawAccel::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int RawAccel::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t RawAccel::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* RawAccel::getTypeName()
{
return "RawAccel";
}
int RawAccel::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->accel[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawAccel::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->accel[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawAccel::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __int64_t_encoded_array_size(NULL, 1);
enc_size += __float_encoded_array_size(NULL, 3);
return enc_size;
}
uint64_t RawAccel::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0x1317644918cca9a1LL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,158 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_RawGyro_hpp__
#define __wescore_lcm_msgs_RawGyro_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
/// IMU data
class RawGyro
{
public:
int64_t mtime;
float gyro[3];
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "RawGyro"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int RawGyro::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawGyro::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int RawGyro::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t RawGyro::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* RawGyro::getTypeName()
{
return "RawGyro";
}
int RawGyro::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->gyro[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawGyro::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->gyro[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawGyro::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __int64_t_encoded_array_size(NULL, 1);
enc_size += __float_encoded_array_size(NULL, 3);
return enc_size;
}
uint64_t RawGyro::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0xc2ebea5c61fc00c8LL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,175 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_RawIMU10DOF_hpp__
#define __wescore_lcm_msgs_RawIMU10DOF_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
class RawIMU10DOF
{
public:
int64_t mtime;
float gyro[3];
float accel[3];
float baro;
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "RawIMU10DOF"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int RawIMU10DOF::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawIMU10DOF::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int RawIMU10DOF::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t RawIMU10DOF::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* RawIMU10DOF::getTypeName()
{
return "RawIMU10DOF";
}
int RawIMU10DOF::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->gyro[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->accel[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->baro, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawIMU10DOF::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->gyro[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->accel[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->baro, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawIMU10DOF::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __int64_t_encoded_array_size(NULL, 1);
enc_size += __float_encoded_array_size(NULL, 3);
enc_size += __float_encoded_array_size(NULL, 3);
enc_size += __float_encoded_array_size(NULL, 1);
return enc_size;
}
uint64_t RawIMU10DOF::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0xd27571225f0da045LL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,166 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_RawIMU6DOF_hpp__
#define __wescore_lcm_msgs_RawIMU6DOF_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
class RawIMU6DOF
{
public:
int64_t mtime;
float gyro[3];
float accel[3];
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "RawIMU6DOF"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int RawIMU6DOF::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawIMU6DOF::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int RawIMU6DOF::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t RawIMU6DOF::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* RawIMU6DOF::getTypeName()
{
return "RawIMU6DOF";
}
int RawIMU6DOF::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->gyro[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->accel[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawIMU6DOF::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->gyro[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->accel[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawIMU6DOF::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __int64_t_encoded_array_size(NULL, 1);
enc_size += __float_encoded_array_size(NULL, 3);
enc_size += __float_encoded_array_size(NULL, 3);
return enc_size;
}
uint64_t RawIMU6DOF::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0x825c4435b1c7fa46LL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,175 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_RawIMU9DOF_hpp__
#define __wescore_lcm_msgs_RawIMU9DOF_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
class RawIMU9DOF
{
public:
int64_t mtime;
float gyro[3];
float accel[3];
float magn[3];
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "RawIMU9DOF"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int RawIMU9DOF::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawIMU9DOF::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int RawIMU9DOF::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t RawIMU9DOF::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* RawIMU9DOF::getTypeName()
{
return "RawIMU9DOF";
}
int RawIMU9DOF::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->gyro[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->accel[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->magn[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawIMU9DOF::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->gyro[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->accel[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->magn[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawIMU9DOF::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __int64_t_encoded_array_size(NULL, 1);
enc_size += __float_encoded_array_size(NULL, 3);
enc_size += __float_encoded_array_size(NULL, 3);
enc_size += __float_encoded_array_size(NULL, 3);
return enc_size;
}
uint64_t RawIMU9DOF::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0x225ef7a05c5d1715LL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,157 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_RawMag_hpp__
#define __wescore_lcm_msgs_RawMag_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
class RawMag
{
public:
int64_t mtime;
float magn[3];
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "RawMag"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int RawMag::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawMag::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int RawMag::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t RawMag::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* RawMag::getTypeName()
{
return "RawMag";
}
int RawMag::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_encode_array(buf, offset + pos, maxlen - pos, &this->magn[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawMag::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->mtime, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __float_decode_array(buf, offset + pos, maxlen - pos, &this->magn[0], 3);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int RawMag::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __int64_t_encoded_array_size(NULL, 1);
enc_size += __float_encoded_array_size(NULL, 3);
return enc_size;
}
uint64_t RawMag::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0xc2ebe073b6fa00c8LL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,157 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_Vector2_hpp__
#define __wescore_lcm_msgs_Vector2_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
class Vector2
{
public:
double x;
double y;
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "Vector2"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int Vector2::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int Vector2::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int Vector2::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t Vector2::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* Vector2::getTypeName()
{
return "Vector2";
}
int Vector2::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->x, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->y, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int Vector2::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->x, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->y, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int Vector2::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __double_encoded_array_size(NULL, 1);
enc_size += __double_encoded_array_size(NULL, 1);
return enc_size;
}
uint64_t Vector2::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0xd259512e30b44885LL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,166 @@
/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
* BY HAND!!
*
* Generated by lcm-gen
**/
#ifndef __wescore_lcm_msgs_Vector3_hpp__
#define __wescore_lcm_msgs_Vector3_hpp__
#include <lcm/lcm_coretypes.h>
namespace wescore_lcm_msgs
{
class Vector3
{
public:
double x;
double y;
double z;
public:
/**
* Encode a message into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at thie byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally be
* equal to getEncodedSize().
* @return The number of bytes encoded, or <0 on error.
*/
inline int encode(void *buf, int offset, int maxlen) const;
/**
* Check how many bytes are required to encode this message.
*/
inline int getEncodedSize() const;
/**
* Decode a message from binary form into this instance.
*
* @param buf The buffer containing the encoded message.
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @return The number of bytes decoded, or <0 if an error occured.
*/
inline int decode(const void *buf, int offset, int maxlen);
/**
* Retrieve the 64-bit fingerprint identifying the structure of the message.
* Note that the fingerprint is the same for all instances of the same
* message type, and is a fingerprint on the message type definition, not on
* the message contents.
*/
inline static int64_t getHash();
/**
* Returns "Vector3"
*/
inline static const char* getTypeName();
// LCM support functions. Users should not call these
inline int _encodeNoHash(void *buf, int offset, int maxlen) const;
inline int _getEncodedSizeNoHash() const;
inline int _decodeNoHash(const void *buf, int offset, int maxlen);
inline static uint64_t _computeHash(const __lcm_hash_ptr *p);
};
int Vector3::encode(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
int64_t hash = getHash();
tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);
if (tlen < 0) return tlen; else pos += tlen;
return pos;
}
int Vector3::decode(const void *buf, int offset, int maxlen)
{
int pos = 0, thislen;
int64_t msg_hash;
thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1);
if (thislen < 0) return thislen; else pos += thislen;
if (msg_hash != getHash()) return -1;
thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos);
if (thislen < 0) return thislen; else pos += thislen;
return pos;
}
int Vector3::getEncodedSize() const
{
return 8 + _getEncodedSizeNoHash();
}
int64_t Vector3::getHash()
{
static int64_t hash = static_cast<int64_t>(_computeHash(NULL));
return hash;
}
const char* Vector3::getTypeName()
{
return "Vector3";
}
int Vector3::_encodeNoHash(void *buf, int offset, int maxlen) const
{
int pos = 0, tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->x, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->y, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->z, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int Vector3::_decodeNoHash(const void *buf, int offset, int maxlen)
{
int pos = 0, tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->x, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->y, 1);
if(tlen < 0) return tlen; else pos += tlen;
tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->z, 1);
if(tlen < 0) return tlen; else pos += tlen;
return pos;
}
int Vector3::_getEncodedSizeNoHash() const
{
int enc_size = 0;
enc_size += __double_encoded_array_size(NULL, 1);
enc_size += __double_encoded_array_size(NULL, 1);
enc_size += __double_encoded_array_size(NULL, 1);
return enc_size;
}
uint64_t Vector3::_computeHash(const __lcm_hash_ptr *)
{
uint64_t hash = 0x573f2fdd2f76508fLL;
return (hash<<1) + ((hash>>63)&1);
}
}
#endif

View File

@@ -0,0 +1,155 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_IMU_h
#define _wescore_lcm_msgs_IMU_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "lcmtypes/wescore_lcm_msgs_Quaternion.h"
#include "lcmtypes/wescore_lcm_msgs_Vector3.h"
#include "lcmtypes/wescore_lcm_msgs_Vector3.h"
typedef struct _wescore_lcm_msgs_IMU wescore_lcm_msgs_IMU;
struct _wescore_lcm_msgs_IMU
{
int64_t mtime;
wescore_lcm_msgs_Quaternion orientation;
double orientation_covariance[9];
wescore_lcm_msgs_Vector3 angular_velocity;
double angular_velocity_covariance[9];
wescore_lcm_msgs_Vector3 linear_acceleration;
double linear_acceleration_covariance[9];
};
/**
* Create a deep copy of a wescore_lcm_msgs_IMU.
* When no longer needed, destroy it with wescore_lcm_msgs_IMU_destroy()
*/
wescore_lcm_msgs_IMU* wescore_lcm_msgs_IMU_copy(const wescore_lcm_msgs_IMU* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_IMU created by wescore_lcm_msgs_IMU_copy()
*/
void wescore_lcm_msgs_IMU_destroy(wescore_lcm_msgs_IMU* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_IMU_subscription_t wescore_lcm_msgs_IMU_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_IMU is received.
*/
typedef void(*wescore_lcm_msgs_IMU_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_IMU *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_IMU using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_IMU_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_IMU *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_IMU using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_IMU_subscription_t* wescore_lcm_msgs_IMU_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_IMU_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_IMU_subscribe()
*/
int wescore_lcm_msgs_IMU_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_IMU_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_IMU_subscription_set_queue_capacity(
wescore_lcm_msgs_IMU_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_IMU into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_IMU_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_IMU_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_IMU *p);
/**
* Decode a message of type wescore_lcm_msgs_IMU from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_IMU_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_IMU_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_IMU *msg);
/**
* Release resources allocated by wescore_lcm_msgs_IMU_decode()
* @return 0
*/
int wescore_lcm_msgs_IMU_decode_cleanup(wescore_lcm_msgs_IMU *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_IMU
*/
int wescore_lcm_msgs_IMU_encoded_size(const wescore_lcm_msgs_IMU *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_IMU_get_hash(void);
uint64_t __wescore_lcm_msgs_IMU_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_IMU_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_IMU *p, int elements);
int __wescore_lcm_msgs_IMU_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_IMU *p, int elements);
int __wescore_lcm_msgs_IMU_decode_array_cleanup(wescore_lcm_msgs_IMU *p, int elements);
int __wescore_lcm_msgs_IMU_encoded_array_size(const wescore_lcm_msgs_IMU *p, int elements);
int __wescore_lcm_msgs_IMU_clone_array(const wescore_lcm_msgs_IMU *p, wescore_lcm_msgs_IMU *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,157 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_NavSatFix_h
#define _wescore_lcm_msgs_NavSatFix_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "lcmtypes/wescore_lcm_msgs_NavSatStatus.h"
#define WESCORE_LCM_MSGS_NAVSATFIX_COVARIANCE_TYPE_UNKNOWN 0
#define WESCORE_LCM_MSGS_NAVSATFIX_COVARIANCE_TYPE_APPROXIMATED 1
#define WESCORE_LCM_MSGS_NAVSATFIX_COVARIANCE_TYPE_DIAGONAL_KNOWN 2
#define WESCORE_LCM_MSGS_NAVSATFIX_COVARIANCE_TYPE_KNOWN 3
typedef struct _wescore_lcm_msgs_NavSatFix wescore_lcm_msgs_NavSatFix;
struct _wescore_lcm_msgs_NavSatFix
{
wescore_lcm_msgs_NavSatStatus status;
double latitude;
double longitude;
double altitude;
double position_covariance[9];
int8_t position_covariance_type;
};
/**
* Create a deep copy of a wescore_lcm_msgs_NavSatFix.
* When no longer needed, destroy it with wescore_lcm_msgs_NavSatFix_destroy()
*/
wescore_lcm_msgs_NavSatFix* wescore_lcm_msgs_NavSatFix_copy(const wescore_lcm_msgs_NavSatFix* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_NavSatFix created by wescore_lcm_msgs_NavSatFix_copy()
*/
void wescore_lcm_msgs_NavSatFix_destroy(wescore_lcm_msgs_NavSatFix* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_NavSatFix_subscription_t wescore_lcm_msgs_NavSatFix_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_NavSatFix is received.
*/
typedef void(*wescore_lcm_msgs_NavSatFix_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_NavSatFix *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_NavSatFix using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_NavSatFix_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_NavSatFix *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_NavSatFix using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_NavSatFix_subscription_t* wescore_lcm_msgs_NavSatFix_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_NavSatFix_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_NavSatFix_subscribe()
*/
int wescore_lcm_msgs_NavSatFix_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_NavSatFix_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_NavSatFix_subscription_set_queue_capacity(
wescore_lcm_msgs_NavSatFix_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_NavSatFix into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_NavSatFix_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_NavSatFix_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_NavSatFix *p);
/**
* Decode a message of type wescore_lcm_msgs_NavSatFix from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_NavSatFix_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_NavSatFix_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_NavSatFix *msg);
/**
* Release resources allocated by wescore_lcm_msgs_NavSatFix_decode()
* @return 0
*/
int wescore_lcm_msgs_NavSatFix_decode_cleanup(wescore_lcm_msgs_NavSatFix *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_NavSatFix
*/
int wescore_lcm_msgs_NavSatFix_encoded_size(const wescore_lcm_msgs_NavSatFix *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_NavSatFix_get_hash(void);
uint64_t __wescore_lcm_msgs_NavSatFix_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_NavSatFix_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_NavSatFix *p, int elements);
int __wescore_lcm_msgs_NavSatFix_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_NavSatFix *p, int elements);
int __wescore_lcm_msgs_NavSatFix_decode_array_cleanup(wescore_lcm_msgs_NavSatFix *p, int elements);
int __wescore_lcm_msgs_NavSatFix_encoded_array_size(const wescore_lcm_msgs_NavSatFix *p, int elements);
int __wescore_lcm_msgs_NavSatFix_clone_array(const wescore_lcm_msgs_NavSatFix *p, wescore_lcm_msgs_NavSatFix *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,157 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_NavSatStatus_h
#define _wescore_lcm_msgs_NavSatStatus_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
#define WESCORE_LCM_MSGS_NAVSATSTATUS_STATUS_NO_FIX -1
#define WESCORE_LCM_MSGS_NAVSATSTATUS_STATUS_FIX 0
#define WESCORE_LCM_MSGS_NAVSATSTATUS_STATUS_SBAS_FIX 1
#define WESCORE_LCM_MSGS_NAVSATSTATUS_STATUS_GBAS_FIX 2
#define WESCORE_LCM_MSGS_NAVSATSTATUS_SERVICE_GPS 1
#define WESCORE_LCM_MSGS_NAVSATSTATUS_SERVICE_GLONASS 2
#define WESCORE_LCM_MSGS_NAVSATSTATUS_SERVICE_COMPASS 4
#define WESCORE_LCM_MSGS_NAVSATSTATUS_SERVICE_GALILEO 8
/// GPS
typedef struct _wescore_lcm_msgs_NavSatStatus wescore_lcm_msgs_NavSatStatus;
struct _wescore_lcm_msgs_NavSatStatus
{
int8_t status;
int16_t service;
};
/**
* Create a deep copy of a wescore_lcm_msgs_NavSatStatus.
* When no longer needed, destroy it with wescore_lcm_msgs_NavSatStatus_destroy()
*/
wescore_lcm_msgs_NavSatStatus* wescore_lcm_msgs_NavSatStatus_copy(const wescore_lcm_msgs_NavSatStatus* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_NavSatStatus created by wescore_lcm_msgs_NavSatStatus_copy()
*/
void wescore_lcm_msgs_NavSatStatus_destroy(wescore_lcm_msgs_NavSatStatus* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_NavSatStatus_subscription_t wescore_lcm_msgs_NavSatStatus_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_NavSatStatus is received.
*/
typedef void(*wescore_lcm_msgs_NavSatStatus_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_NavSatStatus *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_NavSatStatus using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_NavSatStatus_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_NavSatStatus *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_NavSatStatus using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_NavSatStatus_subscription_t* wescore_lcm_msgs_NavSatStatus_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_NavSatStatus_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_NavSatStatus_subscribe()
*/
int wescore_lcm_msgs_NavSatStatus_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_NavSatStatus_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_NavSatStatus_subscription_set_queue_capacity(
wescore_lcm_msgs_NavSatStatus_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_NavSatStatus into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_NavSatStatus_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_NavSatStatus_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_NavSatStatus *p);
/**
* Decode a message of type wescore_lcm_msgs_NavSatStatus from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_NavSatStatus_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_NavSatStatus_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_NavSatStatus *msg);
/**
* Release resources allocated by wescore_lcm_msgs_NavSatStatus_decode()
* @return 0
*/
int wescore_lcm_msgs_NavSatStatus_decode_cleanup(wescore_lcm_msgs_NavSatStatus *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_NavSatStatus
*/
int wescore_lcm_msgs_NavSatStatus_encoded_size(const wescore_lcm_msgs_NavSatStatus *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_NavSatStatus_get_hash(void);
uint64_t __wescore_lcm_msgs_NavSatStatus_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_NavSatStatus_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_NavSatStatus *p, int elements);
int __wescore_lcm_msgs_NavSatStatus_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_NavSatStatus *p, int elements);
int __wescore_lcm_msgs_NavSatStatus_decode_array_cleanup(wescore_lcm_msgs_NavSatStatus *p, int elements);
int __wescore_lcm_msgs_NavSatStatus_encoded_array_size(const wescore_lcm_msgs_NavSatStatus *p, int elements);
int __wescore_lcm_msgs_NavSatStatus_clone_array(const wescore_lcm_msgs_NavSatStatus *p, wescore_lcm_msgs_NavSatStatus *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,149 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_Quaternion_h
#define _wescore_lcm_msgs_Quaternion_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _wescore_lcm_msgs_Quaternion wescore_lcm_msgs_Quaternion;
struct _wescore_lcm_msgs_Quaternion
{
double x;
double y;
double z;
double w;
};
/**
* Create a deep copy of a wescore_lcm_msgs_Quaternion.
* When no longer needed, destroy it with wescore_lcm_msgs_Quaternion_destroy()
*/
wescore_lcm_msgs_Quaternion* wescore_lcm_msgs_Quaternion_copy(const wescore_lcm_msgs_Quaternion* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_Quaternion created by wescore_lcm_msgs_Quaternion_copy()
*/
void wescore_lcm_msgs_Quaternion_destroy(wescore_lcm_msgs_Quaternion* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_Quaternion_subscription_t wescore_lcm_msgs_Quaternion_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_Quaternion is received.
*/
typedef void(*wescore_lcm_msgs_Quaternion_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_Quaternion *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_Quaternion using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_Quaternion_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_Quaternion *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_Quaternion using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_Quaternion_subscription_t* wescore_lcm_msgs_Quaternion_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_Quaternion_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_Quaternion_subscribe()
*/
int wescore_lcm_msgs_Quaternion_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_Quaternion_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_Quaternion_subscription_set_queue_capacity(
wescore_lcm_msgs_Quaternion_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_Quaternion into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_Quaternion_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_Quaternion_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_Quaternion *p);
/**
* Decode a message of type wescore_lcm_msgs_Quaternion from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_Quaternion_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_Quaternion_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_Quaternion *msg);
/**
* Release resources allocated by wescore_lcm_msgs_Quaternion_decode()
* @return 0
*/
int wescore_lcm_msgs_Quaternion_decode_cleanup(wescore_lcm_msgs_Quaternion *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_Quaternion
*/
int wescore_lcm_msgs_Quaternion_encoded_size(const wescore_lcm_msgs_Quaternion *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_Quaternion_get_hash(void);
uint64_t __wescore_lcm_msgs_Quaternion_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_Quaternion_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_Quaternion *p, int elements);
int __wescore_lcm_msgs_Quaternion_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_Quaternion *p, int elements);
int __wescore_lcm_msgs_Quaternion_decode_array_cleanup(wescore_lcm_msgs_Quaternion *p, int elements);
int __wescore_lcm_msgs_Quaternion_encoded_array_size(const wescore_lcm_msgs_Quaternion *p, int elements);
int __wescore_lcm_msgs_Quaternion_clone_array(const wescore_lcm_msgs_Quaternion *p, wescore_lcm_msgs_Quaternion *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,147 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_RawAccel_h
#define _wescore_lcm_msgs_RawAccel_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _wescore_lcm_msgs_RawAccel wescore_lcm_msgs_RawAccel;
struct _wescore_lcm_msgs_RawAccel
{
int64_t mtime;
float accel[3];
};
/**
* Create a deep copy of a wescore_lcm_msgs_RawAccel.
* When no longer needed, destroy it with wescore_lcm_msgs_RawAccel_destroy()
*/
wescore_lcm_msgs_RawAccel* wescore_lcm_msgs_RawAccel_copy(const wescore_lcm_msgs_RawAccel* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_RawAccel created by wescore_lcm_msgs_RawAccel_copy()
*/
void wescore_lcm_msgs_RawAccel_destroy(wescore_lcm_msgs_RawAccel* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_RawAccel_subscription_t wescore_lcm_msgs_RawAccel_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_RawAccel is received.
*/
typedef void(*wescore_lcm_msgs_RawAccel_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_RawAccel *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_RawAccel using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_RawAccel_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_RawAccel *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_RawAccel using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_RawAccel_subscription_t* wescore_lcm_msgs_RawAccel_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_RawAccel_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_RawAccel_subscribe()
*/
int wescore_lcm_msgs_RawAccel_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_RawAccel_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_RawAccel_subscription_set_queue_capacity(
wescore_lcm_msgs_RawAccel_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_RawAccel into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_RawAccel_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawAccel_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawAccel *p);
/**
* Decode a message of type wescore_lcm_msgs_RawAccel from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_RawAccel_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawAccel_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawAccel *msg);
/**
* Release resources allocated by wescore_lcm_msgs_RawAccel_decode()
* @return 0
*/
int wescore_lcm_msgs_RawAccel_decode_cleanup(wescore_lcm_msgs_RawAccel *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_RawAccel
*/
int wescore_lcm_msgs_RawAccel_encoded_size(const wescore_lcm_msgs_RawAccel *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_RawAccel_get_hash(void);
uint64_t __wescore_lcm_msgs_RawAccel_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_RawAccel_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawAccel *p, int elements);
int __wescore_lcm_msgs_RawAccel_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawAccel *p, int elements);
int __wescore_lcm_msgs_RawAccel_decode_array_cleanup(wescore_lcm_msgs_RawAccel *p, int elements);
int __wescore_lcm_msgs_RawAccel_encoded_array_size(const wescore_lcm_msgs_RawAccel *p, int elements);
int __wescore_lcm_msgs_RawAccel_clone_array(const wescore_lcm_msgs_RawAccel *p, wescore_lcm_msgs_RawAccel *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,148 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_RawGyro_h
#define _wescore_lcm_msgs_RawGyro_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
/// IMU data
typedef struct _wescore_lcm_msgs_RawGyro wescore_lcm_msgs_RawGyro;
struct _wescore_lcm_msgs_RawGyro
{
int64_t mtime;
float gyro[3];
};
/**
* Create a deep copy of a wescore_lcm_msgs_RawGyro.
* When no longer needed, destroy it with wescore_lcm_msgs_RawGyro_destroy()
*/
wescore_lcm_msgs_RawGyro* wescore_lcm_msgs_RawGyro_copy(const wescore_lcm_msgs_RawGyro* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_RawGyro created by wescore_lcm_msgs_RawGyro_copy()
*/
void wescore_lcm_msgs_RawGyro_destroy(wescore_lcm_msgs_RawGyro* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_RawGyro_subscription_t wescore_lcm_msgs_RawGyro_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_RawGyro is received.
*/
typedef void(*wescore_lcm_msgs_RawGyro_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_RawGyro *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_RawGyro using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_RawGyro_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_RawGyro *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_RawGyro using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_RawGyro_subscription_t* wescore_lcm_msgs_RawGyro_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_RawGyro_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_RawGyro_subscribe()
*/
int wescore_lcm_msgs_RawGyro_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_RawGyro_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_RawGyro_subscription_set_queue_capacity(
wescore_lcm_msgs_RawGyro_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_RawGyro into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_RawGyro_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawGyro_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawGyro *p);
/**
* Decode a message of type wescore_lcm_msgs_RawGyro from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_RawGyro_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawGyro_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawGyro *msg);
/**
* Release resources allocated by wescore_lcm_msgs_RawGyro_decode()
* @return 0
*/
int wescore_lcm_msgs_RawGyro_decode_cleanup(wescore_lcm_msgs_RawGyro *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_RawGyro
*/
int wescore_lcm_msgs_RawGyro_encoded_size(const wescore_lcm_msgs_RawGyro *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_RawGyro_get_hash(void);
uint64_t __wescore_lcm_msgs_RawGyro_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_RawGyro_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawGyro *p, int elements);
int __wescore_lcm_msgs_RawGyro_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawGyro *p, int elements);
int __wescore_lcm_msgs_RawGyro_decode_array_cleanup(wescore_lcm_msgs_RawGyro *p, int elements);
int __wescore_lcm_msgs_RawGyro_encoded_array_size(const wescore_lcm_msgs_RawGyro *p, int elements);
int __wescore_lcm_msgs_RawGyro_clone_array(const wescore_lcm_msgs_RawGyro *p, wescore_lcm_msgs_RawGyro *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,149 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_RawIMU10DOF_h
#define _wescore_lcm_msgs_RawIMU10DOF_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _wescore_lcm_msgs_RawIMU10DOF wescore_lcm_msgs_RawIMU10DOF;
struct _wescore_lcm_msgs_RawIMU10DOF
{
int64_t mtime;
float gyro[3];
float accel[3];
float baro;
};
/**
* Create a deep copy of a wescore_lcm_msgs_RawIMU10DOF.
* When no longer needed, destroy it with wescore_lcm_msgs_RawIMU10DOF_destroy()
*/
wescore_lcm_msgs_RawIMU10DOF* wescore_lcm_msgs_RawIMU10DOF_copy(const wescore_lcm_msgs_RawIMU10DOF* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_RawIMU10DOF created by wescore_lcm_msgs_RawIMU10DOF_copy()
*/
void wescore_lcm_msgs_RawIMU10DOF_destroy(wescore_lcm_msgs_RawIMU10DOF* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_RawIMU10DOF_subscription_t wescore_lcm_msgs_RawIMU10DOF_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_RawIMU10DOF is received.
*/
typedef void(*wescore_lcm_msgs_RawIMU10DOF_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_RawIMU10DOF *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_RawIMU10DOF using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_RawIMU10DOF_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_RawIMU10DOF *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_RawIMU10DOF using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_RawIMU10DOF_subscription_t* wescore_lcm_msgs_RawIMU10DOF_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_RawIMU10DOF_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_RawIMU10DOF_subscribe()
*/
int wescore_lcm_msgs_RawIMU10DOF_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_RawIMU10DOF_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_RawIMU10DOF_subscription_set_queue_capacity(
wescore_lcm_msgs_RawIMU10DOF_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_RawIMU10DOF into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_RawIMU10DOF_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawIMU10DOF_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawIMU10DOF *p);
/**
* Decode a message of type wescore_lcm_msgs_RawIMU10DOF from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_RawIMU10DOF_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawIMU10DOF_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawIMU10DOF *msg);
/**
* Release resources allocated by wescore_lcm_msgs_RawIMU10DOF_decode()
* @return 0
*/
int wescore_lcm_msgs_RawIMU10DOF_decode_cleanup(wescore_lcm_msgs_RawIMU10DOF *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_RawIMU10DOF
*/
int wescore_lcm_msgs_RawIMU10DOF_encoded_size(const wescore_lcm_msgs_RawIMU10DOF *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_RawIMU10DOF_get_hash(void);
uint64_t __wescore_lcm_msgs_RawIMU10DOF_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_RawIMU10DOF_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawIMU10DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU10DOF_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawIMU10DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU10DOF_decode_array_cleanup(wescore_lcm_msgs_RawIMU10DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU10DOF_encoded_array_size(const wescore_lcm_msgs_RawIMU10DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU10DOF_clone_array(const wescore_lcm_msgs_RawIMU10DOF *p, wescore_lcm_msgs_RawIMU10DOF *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,148 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_RawIMU6DOF_h
#define _wescore_lcm_msgs_RawIMU6DOF_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _wescore_lcm_msgs_RawIMU6DOF wescore_lcm_msgs_RawIMU6DOF;
struct _wescore_lcm_msgs_RawIMU6DOF
{
int64_t mtime;
float gyro[3];
float accel[3];
};
/**
* Create a deep copy of a wescore_lcm_msgs_RawIMU6DOF.
* When no longer needed, destroy it with wescore_lcm_msgs_RawIMU6DOF_destroy()
*/
wescore_lcm_msgs_RawIMU6DOF* wescore_lcm_msgs_RawIMU6DOF_copy(const wescore_lcm_msgs_RawIMU6DOF* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_RawIMU6DOF created by wescore_lcm_msgs_RawIMU6DOF_copy()
*/
void wescore_lcm_msgs_RawIMU6DOF_destroy(wescore_lcm_msgs_RawIMU6DOF* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_RawIMU6DOF_subscription_t wescore_lcm_msgs_RawIMU6DOF_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_RawIMU6DOF is received.
*/
typedef void(*wescore_lcm_msgs_RawIMU6DOF_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_RawIMU6DOF *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_RawIMU6DOF using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_RawIMU6DOF_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_RawIMU6DOF *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_RawIMU6DOF using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_RawIMU6DOF_subscription_t* wescore_lcm_msgs_RawIMU6DOF_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_RawIMU6DOF_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_RawIMU6DOF_subscribe()
*/
int wescore_lcm_msgs_RawIMU6DOF_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_RawIMU6DOF_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_RawIMU6DOF_subscription_set_queue_capacity(
wescore_lcm_msgs_RawIMU6DOF_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_RawIMU6DOF into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_RawIMU6DOF_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawIMU6DOF_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawIMU6DOF *p);
/**
* Decode a message of type wescore_lcm_msgs_RawIMU6DOF from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_RawIMU6DOF_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawIMU6DOF_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawIMU6DOF *msg);
/**
* Release resources allocated by wescore_lcm_msgs_RawIMU6DOF_decode()
* @return 0
*/
int wescore_lcm_msgs_RawIMU6DOF_decode_cleanup(wescore_lcm_msgs_RawIMU6DOF *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_RawIMU6DOF
*/
int wescore_lcm_msgs_RawIMU6DOF_encoded_size(const wescore_lcm_msgs_RawIMU6DOF *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_RawIMU6DOF_get_hash(void);
uint64_t __wescore_lcm_msgs_RawIMU6DOF_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_RawIMU6DOF_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawIMU6DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU6DOF_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawIMU6DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU6DOF_decode_array_cleanup(wescore_lcm_msgs_RawIMU6DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU6DOF_encoded_array_size(const wescore_lcm_msgs_RawIMU6DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU6DOF_clone_array(const wescore_lcm_msgs_RawIMU6DOF *p, wescore_lcm_msgs_RawIMU6DOF *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,149 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_RawIMU9DOF_h
#define _wescore_lcm_msgs_RawIMU9DOF_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _wescore_lcm_msgs_RawIMU9DOF wescore_lcm_msgs_RawIMU9DOF;
struct _wescore_lcm_msgs_RawIMU9DOF
{
int64_t mtime;
float gyro[3];
float accel[3];
float magn[3];
};
/**
* Create a deep copy of a wescore_lcm_msgs_RawIMU9DOF.
* When no longer needed, destroy it with wescore_lcm_msgs_RawIMU9DOF_destroy()
*/
wescore_lcm_msgs_RawIMU9DOF* wescore_lcm_msgs_RawIMU9DOF_copy(const wescore_lcm_msgs_RawIMU9DOF* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_RawIMU9DOF created by wescore_lcm_msgs_RawIMU9DOF_copy()
*/
void wescore_lcm_msgs_RawIMU9DOF_destroy(wescore_lcm_msgs_RawIMU9DOF* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_RawIMU9DOF_subscription_t wescore_lcm_msgs_RawIMU9DOF_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_RawIMU9DOF is received.
*/
typedef void(*wescore_lcm_msgs_RawIMU9DOF_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_RawIMU9DOF *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_RawIMU9DOF using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_RawIMU9DOF_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_RawIMU9DOF *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_RawIMU9DOF using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_RawIMU9DOF_subscription_t* wescore_lcm_msgs_RawIMU9DOF_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_RawIMU9DOF_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_RawIMU9DOF_subscribe()
*/
int wescore_lcm_msgs_RawIMU9DOF_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_RawIMU9DOF_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_RawIMU9DOF_subscription_set_queue_capacity(
wescore_lcm_msgs_RawIMU9DOF_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_RawIMU9DOF into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_RawIMU9DOF_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawIMU9DOF_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawIMU9DOF *p);
/**
* Decode a message of type wescore_lcm_msgs_RawIMU9DOF from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_RawIMU9DOF_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawIMU9DOF_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawIMU9DOF *msg);
/**
* Release resources allocated by wescore_lcm_msgs_RawIMU9DOF_decode()
* @return 0
*/
int wescore_lcm_msgs_RawIMU9DOF_decode_cleanup(wescore_lcm_msgs_RawIMU9DOF *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_RawIMU9DOF
*/
int wescore_lcm_msgs_RawIMU9DOF_encoded_size(const wescore_lcm_msgs_RawIMU9DOF *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_RawIMU9DOF_get_hash(void);
uint64_t __wescore_lcm_msgs_RawIMU9DOF_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_RawIMU9DOF_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawIMU9DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU9DOF_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawIMU9DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU9DOF_decode_array_cleanup(wescore_lcm_msgs_RawIMU9DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU9DOF_encoded_array_size(const wescore_lcm_msgs_RawIMU9DOF *p, int elements);
int __wescore_lcm_msgs_RawIMU9DOF_clone_array(const wescore_lcm_msgs_RawIMU9DOF *p, wescore_lcm_msgs_RawIMU9DOF *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,147 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_RawMag_h
#define _wescore_lcm_msgs_RawMag_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _wescore_lcm_msgs_RawMag wescore_lcm_msgs_RawMag;
struct _wescore_lcm_msgs_RawMag
{
int64_t mtime;
float magn[3];
};
/**
* Create a deep copy of a wescore_lcm_msgs_RawMag.
* When no longer needed, destroy it with wescore_lcm_msgs_RawMag_destroy()
*/
wescore_lcm_msgs_RawMag* wescore_lcm_msgs_RawMag_copy(const wescore_lcm_msgs_RawMag* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_RawMag created by wescore_lcm_msgs_RawMag_copy()
*/
void wescore_lcm_msgs_RawMag_destroy(wescore_lcm_msgs_RawMag* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_RawMag_subscription_t wescore_lcm_msgs_RawMag_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_RawMag is received.
*/
typedef void(*wescore_lcm_msgs_RawMag_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_RawMag *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_RawMag using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_RawMag_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_RawMag *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_RawMag using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_RawMag_subscription_t* wescore_lcm_msgs_RawMag_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_RawMag_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_RawMag_subscribe()
*/
int wescore_lcm_msgs_RawMag_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_RawMag_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_RawMag_subscription_set_queue_capacity(
wescore_lcm_msgs_RawMag_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_RawMag into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_RawMag_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawMag_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawMag *p);
/**
* Decode a message of type wescore_lcm_msgs_RawMag from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_RawMag_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_RawMag_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawMag *msg);
/**
* Release resources allocated by wescore_lcm_msgs_RawMag_decode()
* @return 0
*/
int wescore_lcm_msgs_RawMag_decode_cleanup(wescore_lcm_msgs_RawMag *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_RawMag
*/
int wescore_lcm_msgs_RawMag_encoded_size(const wescore_lcm_msgs_RawMag *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_RawMag_get_hash(void);
uint64_t __wescore_lcm_msgs_RawMag_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_RawMag_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_RawMag *p, int elements);
int __wescore_lcm_msgs_RawMag_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_RawMag *p, int elements);
int __wescore_lcm_msgs_RawMag_decode_array_cleanup(wescore_lcm_msgs_RawMag *p, int elements);
int __wescore_lcm_msgs_RawMag_encoded_array_size(const wescore_lcm_msgs_RawMag *p, int elements);
int __wescore_lcm_msgs_RawMag_clone_array(const wescore_lcm_msgs_RawMag *p, wescore_lcm_msgs_RawMag *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,147 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_Vector2_h
#define _wescore_lcm_msgs_Vector2_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _wescore_lcm_msgs_Vector2 wescore_lcm_msgs_Vector2;
struct _wescore_lcm_msgs_Vector2
{
double x;
double y;
};
/**
* Create a deep copy of a wescore_lcm_msgs_Vector2.
* When no longer needed, destroy it with wescore_lcm_msgs_Vector2_destroy()
*/
wescore_lcm_msgs_Vector2* wescore_lcm_msgs_Vector2_copy(const wescore_lcm_msgs_Vector2* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_Vector2 created by wescore_lcm_msgs_Vector2_copy()
*/
void wescore_lcm_msgs_Vector2_destroy(wescore_lcm_msgs_Vector2* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_Vector2_subscription_t wescore_lcm_msgs_Vector2_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_Vector2 is received.
*/
typedef void(*wescore_lcm_msgs_Vector2_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_Vector2 *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_Vector2 using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_Vector2_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_Vector2 *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_Vector2 using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_Vector2_subscription_t* wescore_lcm_msgs_Vector2_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_Vector2_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_Vector2_subscribe()
*/
int wescore_lcm_msgs_Vector2_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_Vector2_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_Vector2_subscription_set_queue_capacity(
wescore_lcm_msgs_Vector2_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_Vector2 into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_Vector2_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_Vector2_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_Vector2 *p);
/**
* Decode a message of type wescore_lcm_msgs_Vector2 from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_Vector2_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_Vector2_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_Vector2 *msg);
/**
* Release resources allocated by wescore_lcm_msgs_Vector2_decode()
* @return 0
*/
int wescore_lcm_msgs_Vector2_decode_cleanup(wescore_lcm_msgs_Vector2 *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_Vector2
*/
int wescore_lcm_msgs_Vector2_encoded_size(const wescore_lcm_msgs_Vector2 *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_Vector2_get_hash(void);
uint64_t __wescore_lcm_msgs_Vector2_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_Vector2_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_Vector2 *p, int elements);
int __wescore_lcm_msgs_Vector2_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_Vector2 *p, int elements);
int __wescore_lcm_msgs_Vector2_decode_array_cleanup(wescore_lcm_msgs_Vector2 *p, int elements);
int __wescore_lcm_msgs_Vector2_encoded_array_size(const wescore_lcm_msgs_Vector2 *p, int elements);
int __wescore_lcm_msgs_Vector2_clone_array(const wescore_lcm_msgs_Vector2 *p, wescore_lcm_msgs_Vector2 *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,148 @@
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#ifndef _wescore_lcm_msgs_Vector3_h
#define _wescore_lcm_msgs_Vector3_h
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _wescore_lcm_msgs_Vector3 wescore_lcm_msgs_Vector3;
struct _wescore_lcm_msgs_Vector3
{
double x;
double y;
double z;
};
/**
* Create a deep copy of a wescore_lcm_msgs_Vector3.
* When no longer needed, destroy it with wescore_lcm_msgs_Vector3_destroy()
*/
wescore_lcm_msgs_Vector3* wescore_lcm_msgs_Vector3_copy(const wescore_lcm_msgs_Vector3* to_copy);
/**
* Destroy an instance of wescore_lcm_msgs_Vector3 created by wescore_lcm_msgs_Vector3_copy()
*/
void wescore_lcm_msgs_Vector3_destroy(wescore_lcm_msgs_Vector3* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _wescore_lcm_msgs_Vector3_subscription_t wescore_lcm_msgs_Vector3_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* wescore_lcm_msgs_Vector3 is received.
*/
typedef void(*wescore_lcm_msgs_Vector3_handler_t)(
const lcm_recv_buf_t *rbuf, const char *channel,
const wescore_lcm_msgs_Vector3 *msg, void *userdata);
/**
* Publish a message of type wescore_lcm_msgs_Vector3 using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int wescore_lcm_msgs_Vector3_publish(lcm_t *lcm, const char *channel, const wescore_lcm_msgs_Vector3 *msg);
/**
* Subscribe to messages of type wescore_lcm_msgs_Vector3 using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is
* received. This function is invoked by LCM during calls to lcm_handle()
* and lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
wescore_lcm_msgs_Vector3_subscription_t* wescore_lcm_msgs_Vector3_subscribe(
lcm_t *lcm, const char *channel, wescore_lcm_msgs_Vector3_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by wescore_lcm_msgs_Vector3_subscribe()
*/
int wescore_lcm_msgs_Vector3_unsubscribe(lcm_t *lcm, wescore_lcm_msgs_Vector3_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int wescore_lcm_msgs_Vector3_subscription_set_queue_capacity(
wescore_lcm_msgs_Vector3_subscription_t* subs, int num_messages);
/**
* Encode a message of type wescore_lcm_msgs_Vector3 into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to wescore_lcm_msgs_Vector3_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_Vector3_encode(void *buf, int offset, int maxlen, const wescore_lcm_msgs_Vector3 *p);
/**
* Decode a message of type wescore_lcm_msgs_Vector3 from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with wescore_lcm_msgs_Vector3_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int wescore_lcm_msgs_Vector3_decode(const void *buf, int offset, int maxlen, wescore_lcm_msgs_Vector3 *msg);
/**
* Release resources allocated by wescore_lcm_msgs_Vector3_decode()
* @return 0
*/
int wescore_lcm_msgs_Vector3_decode_cleanup(wescore_lcm_msgs_Vector3 *p);
/**
* Check how many bytes are required to encode a message of type wescore_lcm_msgs_Vector3
*/
int wescore_lcm_msgs_Vector3_encoded_size(const wescore_lcm_msgs_Vector3 *p);
// LCM support functions. Users should not call these
int64_t __wescore_lcm_msgs_Vector3_get_hash(void);
uint64_t __wescore_lcm_msgs_Vector3_hash_recursive(const __lcm_hash_ptr *p);
int __wescore_lcm_msgs_Vector3_encode_array(
void *buf, int offset, int maxlen, const wescore_lcm_msgs_Vector3 *p, int elements);
int __wescore_lcm_msgs_Vector3_decode_array(
const void *buf, int offset, int maxlen, wescore_lcm_msgs_Vector3 *p, int elements);
int __wescore_lcm_msgs_Vector3_decode_array_cleanup(wescore_lcm_msgs_Vector3 *p, int elements);
int __wescore_lcm_msgs_Vector3_encoded_array_size(const wescore_lcm_msgs_Vector3 *p, int elements);
int __wescore_lcm_msgs_Vector3_clone_array(const wescore_lcm_msgs_Vector3 *p, wescore_lcm_msgs_Vector3 *q, int elements);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -14,26 +14,28 @@
#include <ros/ros.h>
#include <nav_msgs/Odometry.h>
#include <tf/transform_broadcaster.h>
// #include <tf/transform_broadcaster.h>
#include <tf2_ros/transform_broadcaster.h>
#include "scout_msgs/ScoutLightCmd.h"
#include "scout_base/scout_base.hpp"
#include "scout_sdk/scout_base.hpp"
namespace wescore
{
class ScoutROSMessenger
{
public:
explicit ScoutROSMessenger(ros::NodeHandle nh);
ScoutROSMessenger(ScoutBase *scout, ros::NodeHandle nh);
explicit ScoutROSMessenger(ros::NodeHandle *nh);
ScoutROSMessenger(ScoutBase *scout, ros::NodeHandle *nh);
std::string odom_frame_;
std::string base_frame_;
bool simulated_robot_;
int sim_control_rate_;
bool simulated_robot_ = false;
int sim_control_rate_ = 50;
void SetupSubscription();
void PublishStateToROS();
void PublishSimStateToROS(double linear, double angular);
@@ -41,7 +43,7 @@ public:
private:
ScoutBase *scout_;
ros::NodeHandle nh_;
ros::NodeHandle *nh_;
std::mutex twist_mutex_;
geometry_msgs::Twist current_twist_;
@@ -50,9 +52,8 @@ private:
ros::Publisher status_publisher_;
ros::Subscriber motion_cmd_subscriber_;
ros::Subscriber light_cmd_subscriber_;
tf::TransformBroadcaster tf_broadcaster_;
tf2_ros::TransformBroadcaster tf_broadcaster_;
private:
// speed variables
double linear_speed_ = 0.0;
double angular_speed_ = 0.0;

View File

@@ -1,10 +1,22 @@
<launch>
<node name="scout_odom" pkg="scout_base" type="scout_base_node" output="screen">
<param name="port_name" type="string" value="can0" />
<!--
The robot can be controlled either through CAN bus or UART port. Make sure the hardware
interface is set up correctly before attempting to connect to the robot.
You only need to specify the port name, such as "can0", "/dev/ttyUSB0". The port should
operate with the following configuration:
* CAN bus: 500k
* UART: 115200, Parity None, 8-bit Data, 1 Stop Bit
-->
<arg name="port_name" default="can0" />
<arg name="simulated_robot" default="false" />
<node name="scout_base_node" pkg="scout_base" type="scout_base_node" output="screen">
<param name="port_name" type="string" value="$(arg port_name)" />
<param name="simulated_robot" type="bool" value="$(arg simulated_robot)" />
<param name="odom_frame" type="string" value="odom" />
<param name="base_frame" type="string" value="base_footprint" />
<param name="simulated_robot" type="bool" value="false" />
<param name="base_frame" type="string" value="base_link" />
</node>
</launch>

View File

@@ -1,14 +0,0 @@
<launch>
<node name="scout_odom" pkg="scout_vrep_sim" type="scout_base_sim" output="screen">
<param name="odom_frame" type="string" value="odom" />
<param name="base_frame" type="string" value="base_link" />
<param name="simulated_robot" type="bool" value="true" />
<param name="sim_control_rate" value="50" />
</node>
<!-- Differential controller parameters and basic localization -->
<!--
<include file="$(find scout_control)/launch/control.launch" />
-->
</launch>

View File

@@ -0,0 +1,6 @@
<launch>
<param name="robot_description" textfile="$(find scout_base)/urdf/agilex_scout.urdf" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" required="true" args="-d $(find scout_viz)/rviz/scout_model.rviz" />
</launch>

View File

@@ -14,24 +14,18 @@
<url type="repository">TODO</url>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>controller_manager</build_depend>
<build_depend>hardware_interface</build_depend>
<build_depend>scout_msgs</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>roslaunch</build_depend>
<build_depend>roslint</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>scout_sdk</build_depend>
<run_depend>controller_manager</run_depend>
<run_depend>diff_drive_controller</run_depend>
<run_depend>geometry_msgs</run_depend>
<run_depend>hardware_interface</run_depend>
<run_depend>scout_control</run_depend>
<run_depend>scout_msgs</run_depend>
<run_depend>scout_description</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>sensor_msgs</run_depend>
<run_depend>topic_tools</run_depend>
<run_depend>scout_sdk</run_depend>
<export></export>
</package>

View File

@@ -0,0 +1,72 @@
/*
* imu_broadcast_node.cpp
*
* Created on: Oct 02, 2019 19:09
* Description:
*
* Copyright (c) 2019 Ruixiang Du (rdu)
*/
#include <string>
#include <lcm/lcm-cpp.hpp>
#include "lcmtypes/wescore.hpp"
#include <ros/ros.h>
#include <sensor_msgs/Imu.h>
ros::Publisher imu_pub;
struct MessageBroadcaster
{
void IMULCMCallback(const lcm::ReceiveBuffer *rbuf, const std::string &chan, const wescore_lcm_msgs::IMU *msg)
{
static uint64_t count = 0;
// std::cout << "imu msg received" << std::endl;
sensor_msgs::Imu imu_msg;
imu_msg.header.frame_id = "imu_link";
imu_msg.header.stamp = ros::Time::now();
imu_msg.header.seq = count++;
imu_msg.angular_velocity.x = msg->angular_velocity.x;
imu_msg.angular_velocity.y = msg->angular_velocity.y;
imu_msg.angular_velocity.z = msg->angular_velocity.z;
imu_msg.linear_acceleration.x = msg->linear_acceleration.x;
imu_msg.linear_acceleration.y = msg->linear_acceleration.y;
imu_msg.linear_acceleration.z = msg->linear_acceleration.z;
for (int i = 0; i < 9; ++i)
{
imu_msg.orientation_covariance[i] = msg->orientation_covariance[i];
imu_msg.angular_velocity_covariance[i] = msg->angular_velocity_covariance[i];
imu_msg.linear_acceleration_covariance[i] = msg->linear_acceleration_covariance[i];
}
imu_pub.publish(imu_msg);
}
};
int main(int argc, char **argv)
{
// setup LCM
lcm::LCM lcm;
if (!lcm.good())
return 1;
MessageBroadcaster mb;
lcm.subscribe("sensor_hub_raw_imu", &MessageBroadcaster::IMULCMCallback, &mb);
// setup ROS node
ros::init(argc, argv, "imu_broadcast_node");
ros::NodeHandle nh;
imu_pub = nh.advertise<sensor_msgs::Imu>("imu", 1000);
ROS_INFO("Started broadcasting");
while (ros::ok())
{
lcm.handleTimeout(5);
}
return 0;
}

View File

@@ -1,12 +1,11 @@
#include <string>
#include <boost/thread.hpp>
#include <ros/ros.h>
#include <sensor_msgs/JointState.h>
#include <tf/transform_broadcaster.h>
#include <nav_msgs/Odometry.h>
#include "scout_base/scout_base.hpp"
#include "scout_sdk/scout_base.hpp"
#include "scout_base/scout_messenger.hpp"
using namespace wescore;
@@ -15,20 +14,30 @@ int main(int argc, char **argv)
{
// setup ROS node
ros::init(argc, argv, "scout_odom");
ros::NodeHandle node("scout_robot"), private_node("~");
ros::NodeHandle node(""), private_node("~");
// instantiate a robot
// instantiate a robot object
ScoutBase robot;
ScoutROSMessenger messenger(&robot, node);
ScoutROSMessenger messenger(&robot, &node);
std::string scout_can_port;
private_node.param<std::string>("port_name", scout_can_port, std::string("can0"));
// fetch parameters before connecting to robot
std::string port_name;
private_node.param<std::string>("port_name", port_name, std::string("can0"));
private_node.param<std::string>("odom_frame", messenger.odom_frame_, std::string("odom"));
private_node.param<std::string>("base_frame", messenger.base_frame_, std::string("base_footprint"));
private_node.param<std::string>("base_frame", messenger.base_frame_, std::string("base_link"));
private_node.param<bool>("simulated_robot", messenger.simulated_robot_, false);
// connect to scout and setup ROS subscription
robot.Connect(scout_can_port);
// connect to robot and setup ROS subscription
if (port_name.find("can") != std::string::npos)
{
robot.Connect(port_name);
ROS_INFO("Using CAN bus to talk with the robot");
}
else
{
robot.Connect(port_name, 115200);
ROS_INFO("Using UART to talk with the robot");
}
messenger.SetupSubscription();
// publish robot state at 20Hz while listening to twist commands

View File

@@ -9,27 +9,29 @@
#include "scout_base/scout_messenger.hpp"
#include <tf/transform_broadcaster.h>
#include "scout_msgs/ScoutStatus.h"
namespace wescore
{
ScoutROSMessenger::ScoutROSMessenger(ros::NodeHandle nh) : scout_(nullptr), nh_(nh)
ScoutROSMessenger::ScoutROSMessenger(ros::NodeHandle *nh) : scout_(nullptr), nh_(nh)
{
}
ScoutROSMessenger::ScoutROSMessenger(ScoutBase *scout, ros::NodeHandle nh) : scout_(scout), nh_(nh)
ScoutROSMessenger::ScoutROSMessenger(ScoutBase *scout, ros::NodeHandle *nh) : scout_(scout), nh_(nh)
{
}
void ScoutROSMessenger::SetupSubscription()
{
// odometry publisher
odom_publisher_ = nh_.advertise<nav_msgs::Odometry>(odom_frame_, 50);
status_publisher_ = nh_.advertise<scout_msgs::ScoutStatus>("/scout_status", 10);
odom_publisher_ = nh_->advertise<nav_msgs::Odometry>(odom_frame_, 50);
status_publisher_ = nh_->advertise<scout_msgs::ScoutStatus>("/scout_status", 10);
// cmd subscriber
motion_cmd_subscriber_ = nh_.subscribe<geometry_msgs::Twist>("/cmd_vel", 5, &ScoutROSMessenger::TwistCmdCallback, this); //不启用平滑包则订阅“cmd_vel”
light_cmd_subscriber_ = nh_.subscribe<scout_msgs::ScoutLightCmd>("/scout_light_control", 5, &ScoutROSMessenger::LightCmdCallback, this);
motion_cmd_subscriber_ = nh_->subscribe<geometry_msgs::Twist>("/cmd_vel", 5, &ScoutROSMessenger::TwistCmdCallback, this); //不启用平滑包则订阅“cmd_vel”
light_cmd_subscriber_ = nh_->subscribe<scout_msgs::ScoutLightCmd>("/scout_light_control", 5, &ScoutROSMessenger::LightCmdCallback, this);
}
void ScoutROSMessenger::TwistCmdCallback(const geometry_msgs::Twist::ConstPtr &msg)

View File

@@ -1,50 +0,0 @@
cmake_minimum_required(VERSION 3.1.0)
project(scout_sdk)
# generate symbols for IDE indexer
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/devel)
## Set compiler to use c++ 11 features
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
## Put all binary files into /bin and libraries into /lib
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
## Use GNUInstallDirs to install libraries into correct
# locations on all platforms.
include(GNUInstallDirs)
## Chosse build type
set(CMAKE_BUILD_TYPE Release)
# set(CMAKE_BUILD_TYPE Debug)
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
## Optionally built modules: ON/OFF
set(BUILD_TESTS OFF)
set(BUILD_MONITOR ON)
# Disable monitor if ncurses library is not found
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses QUIET)
if(BUILD_MONITOR AND NOT CURSES_FOUND)
set(BUILD_MONITOR OFF)
message(STATUS "Monitor app will not be built due to missing ncurses library, try: sudo apt install libncurses5-dev")
endif()
## Add source directories
add_subdirectory(src)

View File

@@ -1,9 +0,0 @@
# Add source directories
add_subdirectory(apps)
add_subdirectory(comm)
add_subdirectory(scout_base)
add_subdirectory(third_party)
if(BUILD_TESTS)
add_subdirectory(unit_tests)
endif()

View File

@@ -1,16 +0,0 @@
# Dependency libraries
#find_package(LIBRARY_NAME REQUIRED)
# tests
add_executable(app_scout_demo scout_demo/scout_demo.cpp)
target_link_libraries(app_scout_demo scoutbase)
# add_executable(demo_scout_can demo_scout_can.cpp)
# target_link_libraries(demo_scout_can scoutbase)
# add_executable(demo_scout_serial demo_scout_serial.cpp)
# target_link_libraries(demo_scout_serial scoutbase)
if(BUILD_MONITOR)
add_subdirectory(scout_monitor)
endif()

View File

@@ -1,116 +0,0 @@
/*
* demo_scout_can.cpp
*
* Created on: Jun 12, 2019 05:03
* Description:
*
* Copyright (c) 2019 Ruixiang Du (rdu)
*/
#include "scout_base/scout_base.hpp"
using namespace wescore;
int main(int argc, char **argv)
{
std::string device_name;
int32_t baud_rate = 0;
if (argc == 2)
{
device_name = {argv[1]};
std::cout << "Specified CAN: " << device_name << std::endl;
}
else if (argc == 3)
{
device_name = {argv[1]};
baud_rate = std::stol(argv[2]);
std::cout << "Specified serial: " << device_name << "@" << baud_rate << std::endl;
}
else
{
std::cout << "Usage: app_scout_monitor <interface>" << std::endl
<< "Example 1: ./app_scout_demo can0" << std::endl
<< "Example 2: ./app_scout_demo /dev/ttyUSB0 115200" << std::endl;
return -1;
}
ScoutBase scout;
scout.Connect(device_name, baud_rate);
// light control
std::cout << "Light: const off" << std::endl;
scout.SetLightCommand({ScoutLightCmd::LightMode::CONST_OFF, 0, ScoutLightCmd::LightMode::CONST_OFF, 0});
sleep(3);
std::cout << "Light: const on" << std::endl;
scout.SetLightCommand({ScoutLightCmd::LightMode::CONST_ON, 0, ScoutLightCmd::LightMode::CONST_ON, 0});
sleep(3);
std::cout << "Light: breath" << std::endl;
scout.SetLightCommand({ScoutLightCmd::LightMode::BREATH, 0, ScoutLightCmd::LightMode::BREATH, 0});
sleep(3);
std::cout << "Light: custom 90-80" << std::endl;
scout.SetLightCommand({ScoutLightCmd::LightMode::CUSTOM, 90, ScoutLightCmd::LightMode::CUSTOM, 80});
sleep(3);
std::cout << "Light: diabled cmd control" << std::endl;
scout.DisableLightCmdControl();
int count = 0;
while (true)
{
// motion control
if (count < 5)
{
std::cout << "Motor: 0.2, 0" << std::endl;
scout.SetMotionCommand(0.2, 0.0);
}
else if (count < 10)
{
std::cout << "Motor: 0.8, 0" << std::endl;
scout.SetMotionCommand(0.8, 0.0);
}
else if (count < 15)
{
std::cout << "Motor: 1.5, 0" << std::endl;
scout.SetMotionCommand(1.5, 0.0);
}
else if (count < 20)
{
std::cout << "Motor: 1.0, 0.5" << std::endl;
scout.SetMotionCommand(1.0, 0.5);
}
else if (count < 25)
{
std::cout << "Motor: 0.0, 0" << std::endl;
scout.SetMotionCommand(0.0, 0.0);
}
else if (count < 30)
{
std::cout << "Motor: -0.5, 0" << std::endl;
scout.SetMotionCommand(-0.5, 0.0);
}
else if (count < 35)
{
std::cout << "Motor: -1.0, -0.5" << std::endl;
scout.SetMotionCommand(-1.0, -0.5);
}
else if (count < 40)
{
std::cout << "Motor: 0.0, 0, Light: breath" << std::endl;
scout.SetMotionCommand(0.0, 0.0);
scout.SetLightCommand({ScoutLightCmd::LightMode::BREATH, 0, ScoutLightCmd::LightMode::BREATH, 0});
}
auto state = scout.GetScoutState();
std::cout << "-------------------------------" << std::endl;
std::cout << "count: " << count << std::endl;
std::cout << "control mode: " << static_cast<int>(state.control_mode) << " , base state: " << static_cast<int>(state.base_state) << std::endl;
std::cout << "battery voltage: " << state.battery_voltage << std::endl;
std::cout << "velocity (linear, angular): " << state.linear_velocity << ", " << state.angular_velocity << std::endl;
std::cout << "-------------------------------" << std::endl;
sleep(1);
++count;
}
return 0;
}

View File

@@ -1,24 +0,0 @@
# Dependency libraries
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses REQUIRED)
# Add libraries
set(SCOUT_MONITOR_SRC
src/nshapes.cpp
src/ncolors.cpp
src/scout_monitor.cpp
)
add_library(monitor STATIC ${SCOUT_MONITOR_SRC})
target_link_libraries(monitor scoutbase ${CURSES_LIBRARIES})
target_include_directories(monitor PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CURSES_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>
PRIVATE src)
add_subdirectory(app)
# Add executables
if(BUILD_TESTS)
add_subdirectory(tests)
endif()

View File

@@ -1,3 +0,0 @@
# Add executables
add_executable(app_scout_monitor app_scout_monitor.cpp)
target_link_libraries(app_scout_monitor monitor)

View File

@@ -1,40 +0,0 @@
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string>
#include <iostream>
#include "monitor/scout_monitor.hpp"
using namespace wescore;
int main(int argc, char **argv)
{
std::string device_name;
int32_t baud_rate = 0;
if (argc == 2)
{
device_name = {argv[1]};
std::cout << "Specified CAN: " << device_name << std::endl;
}
else if (argc == 3)
{
device_name = {argv[1]};
baud_rate = std::stol(argv[2]);
std::cout << "Specified serial: " << device_name << "@" << baud_rate << std::endl;
}
else
{
std::cout << "Usage: app_scout_monitor <interface>" << std::endl
<< "Example 1: ./app_scout_monitor can1" << std::endl
<< "Example 2: ./app_scout_monitor /dev/ttyUSB0 115200" << std::endl;
return -1;
}
ScoutMonitor monitor;
monitor.Run(device_name, baud_rate);
return 0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

View File

@@ -1,67 +0,0 @@
/*
* ncolors.hpp
*
* Created on: Jun 20, 2019 06:22
* Description:
*
* Original source: https://www.linuxjournal.com/content/about-ncurses-colors-0
* This copy is based on the original implementation, modified and
* maintained by Ruixiang.
*
* Copyright (c) 2018 Jim Hall
* Copyright (c) 2019 Ruixiang Du (rdu)
*/
#ifndef NCOLORS_HPP
#define NCOLORS_HPP
#include <ncurses.h>
namespace wescore
{
struct NColors
{
enum BackgroundColor
{
BLACK = 0,
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
YELLOW,
WHITE
};
enum ForegroundColor
{
/*
BLACK = 0,
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
YELLOW,
WHITE,*/
BRIGHT_BLACK = 8,
BRIGHT_BLUE,
BRIGHT_GREEN,
BRIGHT_CYAN,
BRIGHT_RED,
BRIGHT_MAGENTA,
BRIGHT_YELLOW,
BRIGHT_WHITE
};
static void InitColors();
static void SetColor(int fg, int bg = BLACK);
static void UnsetColor(int fg, int bg = BLACK);
static void WSetColor(WINDOW *win, int fg, int bg = BLACK);
static void WUnsetColor(WINDOW *win, int fg, int bg = BLACK);
};
} // namespace wescore
#endif /* NCOLORS_HPP */

View File

@@ -1,24 +0,0 @@
/*
* nshapes.hpp
*
* Created on: Jun 20, 2019 06:21
* Description:
*
* Copyright (c) 2019 Ruixiang Du (rdu)
*/
#ifndef NSHAPES_HPP
#define NSHAPES_HPP
#include <ncurses.h>
namespace wescore
{
struct NShapes
{
static void DrawRectangle(int tl_y, int tl_x, int br_y, int br_x);
static void WDrawRectangle(WINDOW *win, int tl_y, int tl_x, int br_y, int br_x);
};
} // namespace wescore
#endif /* NSHAPES_HPP */

View File

@@ -1,78 +0,0 @@
/*
* scout_monitor.hpp
*
* Created on: Jun 12, 2019 01:19
* Description:
*
* Copyright (c) 2019 Ruixiang Du (rdu)
*/
#ifndef SCOUT_MONITOR_HPP
#define SCOUT_MONITOR_HPP
#include "scout_base/scout_base.hpp"
#include <ncurses.h>
namespace wescore
{
class ScoutMonitor
{
public:
ScoutMonitor();
~ScoutMonitor();
void Run(std::string device_name = "", int32_t baud_rate = 0);
void Terminate() { keep_running_ = false; }
private:
bool keep_running_ = true;
bool test_mode_ = true;
int term_sx_ = -1;
int term_sy_ = -1;
WINDOW *body_info_win_;
int bi_win_sx_;
int bi_win_sy_;
int bi_origin_x_;
int bi_origin_y_;
WINDOW *system_info_win_;
int si_win_sx_;
int si_win_sy_;
int si_origin_x_;
int si_origin_y_;
WINDOW *scout_cmd_win_;
ScoutBase scout_base_;
ScoutState scout_state_;
const int linear_axis_length_ = 5;
const int angular_axis_length_ = 5;
const int vehicle_fp_offset_x_ = 9;
const int vehicle_fp_offset_y_ = 9;
bool resizing_detected_;
void UpdateAll();
void ClearAll();
void CalcDimensions();
void HandleResizing();
void SetTestStateData();
void ShowVehicleState(int y, int x);
void ShowStatusItemName(int y, int x, std::string name);
void ShowFault(int y, int x, bool no_fault);
void ShowMotorInfo(int y, int x, double cur, int rpm, int temp, bool is_right);
void UpdateScoutBodyInfo();
void UpdateScoutSystemInfo();
void UpdateScoutCmdWindow();
};
} // namespace wescore
#endif /* SCOUT_MONITOR_HPP */

View File

@@ -1,114 +0,0 @@
/*
* ncolors.cpp
*
* Created on: Jun 20, 2019 06:22
* Description:
*
* Copyright (c) 2019 Ruixiang Du (rdu)
*/
#include "monitor/ncolors.hpp"
#include <iostream>
namespace
{
int IsBold(int fg)
{
/* return the intensity bit */
int i;
i = 1 << 3;
return (i & fg);
}
int ColorNum(int fg, int bg)
{
int B, bbb, ffff;
B = 1 << 7;
bbb = (7 & bg) << 4;
ffff = 7 & fg;
return (B | bbb | ffff);
}
short CursorColor(int fg)
{
switch (7 & fg)
{ /* RGB */
case 0: /* 000 */
return (COLOR_BLACK);
case 1: /* 001 */
return (COLOR_BLUE);
case 2: /* 010 */
return (COLOR_GREEN);
case 3: /* 011 */
return (COLOR_CYAN);
case 4: /* 100 */
return (COLOR_RED);
case 5: /* 101 */
return (COLOR_MAGENTA);
case 6: /* 110 */
return (COLOR_YELLOW);
case 7: /* 111 */
return (COLOR_WHITE);
}
}
} // namespace
namespace wescore
{
void NColors::InitColors()
{
if (has_colors() != FALSE)
start_color();
else
std::cerr << "Your terminal does not support color" << std::endl;
int fg, bg;
int colorpair;
for (bg = 0; bg <= 7; bg++)
{
for (fg = 0; fg <= 7; fg++)
{
colorpair = ColorNum(fg, bg);
init_pair(colorpair, CursorColor(fg), CursorColor(bg));
}
}
}
void NColors::SetColor(int fg, int bg)
{
// set the color pair (ColorNum) and bold/bright (A_BOLD)
attron(COLOR_PAIR(ColorNum(fg, bg)));
if (IsBold(fg))
attron(A_BOLD);
}
void NColors::UnsetColor(int fg, int bg)
{
// unset the color pair (ColorNum) and bold/bright (A_BOLD)
attroff(COLOR_PAIR(ColorNum(fg, bg)));
if (IsBold(fg))
attroff(A_BOLD);
}
void NColors::WSetColor(WINDOW *win, int fg, int bg)
{
// set the color pair (ColorNum) and bold/bright (A_BOLD)
wattron(win, COLOR_PAIR(ColorNum(fg, bg)));
if (IsBold(fg))
wattron(win, A_BOLD);
}
void NColors::WUnsetColor(WINDOW *win, int fg, int bg)
{
// unset the color pair (ColorNum) and bold/bright (A_BOLD)
wattroff(win, COLOR_PAIR(ColorNum(fg, bg)));
if (IsBold(fg))
wattroff(win, A_BOLD);
}
} // namespace wescore

View File

@@ -1,41 +0,0 @@
/*
* nshapers.cpp
*
* Created on: Jun 20, 2019 06:21
* Description:
*
* Copyright (c) 2019 Ruixiang Du (rdu)
*/
#include "monitor/nshapes.hpp"
namespace wescore
{
void NShapes::DrawRectangle(int tl_y, int tl_x, int br_y, int br_x)
{
for (int i = tl_y; i <= br_y; ++i)
{
mvprintw(i, tl_x, "|");
mvprintw(i, br_x, "|");
}
for (int i = tl_x; i <= br_x; ++i)
{
mvprintw(tl_y, i, "-");
mvprintw(br_y, i, "-");
}
}
void NShapes::WDrawRectangle(WINDOW *win, int tl_y, int tl_x, int br_y, int br_x)
{
for (int i = tl_y; i <= br_y; ++i)
{
mvwprintw(win, i, tl_x, "|");
mvwprintw(win, i, br_x, "|");
}
for (int i = tl_x; i <= br_x; ++i)
{
mvwprintw(win, tl_y, i, "-");
mvwprintw(win, br_y, i, "-");
}
}
} // namespace wescore

View File

@@ -1,655 +0,0 @@
/*
* scout_monitor.cpp
*
* Created on: Jun 12, 2019 01:19
* Description:
*
* Copyright (c) 2019 Ruixiang Du (rdu)
*/
/*
* Coordinate System:
*
* o --------------------> x
* |
* |
* |
* |
* |
* |
* v
* y
*/
#include "monitor/scout_monitor.hpp"
#include <cmath>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <chrono>
#include <cstdint>
#include <ratio>
#include <thread>
#include "monitor/nshapes.hpp"
#include "monitor/ncolors.hpp"
namespace
{
// reference: https://thispointer.com/c-convert-double-to-string-and-manage-precision-scientific-notation/
std::string ConvertFloatToString(double vel, int digit_num = 3)
{
std::ostringstream streamObj;
streamObj << std::fixed;
streamObj << std::setprecision(digit_num);
streamObj << vel;
return streamObj.str();
}
// source: https://github.com/rxdu/stopwatch
struct StopWatch
{
using Clock = std::chrono::high_resolution_clock;
using time_point = typename Clock::time_point;
using duration = typename Clock::duration;
StopWatch() { tic_point = Clock::now(); };
time_point tic_point;
void tic()
{
tic_point = Clock::now();
};
double toc()
{
return std::chrono::duration_cast<std::chrono::microseconds>(Clock::now() - tic_point).count() / 1000000.0;
};
// for different precisions
double stoc()
{
return std::chrono::duration_cast<std::chrono::seconds>(Clock::now() - tic_point).count();
};
double mtoc()
{
return std::chrono::duration_cast<std::chrono::milliseconds>(Clock::now() - tic_point).count();
};
double utoc()
{
return std::chrono::duration_cast<std::chrono::microseconds>(Clock::now() - tic_point).count();
};
double ntoc()
{
return std::chrono::duration_cast<std::chrono::nanoseconds>(Clock::now() - tic_point).count();
};
// you have to call tic() before calling this function
void sleep_until_ms(int64_t period_ms)
{
int64_t duration = period_ms - std::chrono::duration_cast<std::chrono::milliseconds>(Clock::now() - tic_point).count();
if (duration > 0)
std::this_thread::sleep_for(std::chrono::milliseconds(duration));
};
void sleep_until_us(int64_t period_us)
{
int64_t duration = period_us - std::chrono::duration_cast<std::chrono::microseconds>(Clock::now() - tic_point).count();
if (duration > 0)
std::this_thread::sleep_for(std::chrono::microseconds(duration));
};
};
} // namespace
namespace wescore
{
ScoutMonitor::ScoutMonitor()
{
// init ncurses
initscr();
// raw();
cbreak();
noecho();
nonl();
curs_set(FALSE);
intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
CalcDimensions();
// setup sub-windows
body_info_win_ = newwin(bi_win_sy_, bi_win_sx_, bi_origin_y_, bi_origin_x_);
system_info_win_ = newwin(si_win_sy_, si_win_sx_, si_origin_y_, si_origin_x_);
scout_state_.linear_velocity = 0;
scout_state_.angular_velocity = 0;
NColors::InitColors();
}
ScoutMonitor::~ScoutMonitor()
{
delwin(body_info_win_);
delwin(system_info_win_);
endwin();
}
void ScoutMonitor::UpdateAll()
{
ClearAll();
CalcDimensions();
if (resizing_detected_)
HandleResizing();
UpdateScoutBodyInfo();
UpdateScoutSystemInfo();
}
void ScoutMonitor::SetTestStateData()
{
scout_state_.base_state = BASE_STATE_NORMAL;
scout_state_.battery_voltage = 28.5;
scout_state_.linear_velocity = 1.234;
scout_state_.angular_velocity = -0.6853;
// scout_state_.fault_code |= FAULT_MOTOR_DRV_OVERHEAT_W;
// scout_state_.fault_code |= FAULT_MOTOR_OVERCURRENT_W;
// scout_state_.fault_code |= FAULT_MOTOR_DRV_OVERHEAT_F;
// scout_state_.fault_code |= FAULT_MOTOR_OVERCURRENT_F;
// scout_state_.fault_code |= FAULT_BAT_UNDER_VOL_W;
// scout_state_.fault_code |= FAULT_BAT_UNDER_VOL_F;
scout_state_.fault_code = 0x0000;
// scout_state_.fault_code = 0xffff;
// scout_state_.front_light_state.mode = CONST_ON;
scout_state_.front_light_state.mode = LIGHT_MODE_CUSTOM;
scout_state_.front_light_state.custom_value = 50;
scout_state_.rear_light_state.mode = LIGHT_MODE_CONST_ON;
scout_state_.motor_states[0].current = 10.1;
scout_state_.motor_states[0].rpm = 2000;
scout_state_.motor_states[0].temperature = 35;
scout_state_.motor_states[1].current = 10.1;
scout_state_.motor_states[1].rpm = 2000;
scout_state_.motor_states[1].temperature = 35;
scout_state_.motor_states[2].current = 10.1;
scout_state_.motor_states[2].rpm = 2000;
scout_state_.motor_states[2].temperature = 35;
scout_state_.motor_states[3].current = 10.1;
scout_state_.motor_states[3].rpm = 2000;
scout_state_.motor_states[3].temperature = 35;
}
void ScoutMonitor::Run(std::string device_name, int32_t baud_rate)
{
if (device_name != "")
test_mode_ = false;
if (test_mode_)
SetTestStateData();
else
scout_base_.Connect(device_name, baud_rate);
StopWatch sw;
while (keep_running_)
{
// label starting point of iteration
sw.tic();
// query for latest robot state
if (!test_mode_)
scout_state_ = scout_base_.GetScoutState();
// update window contents
UpdateAll();
// manage window refresh rate
sw.sleep_until_ms(100);
}
}
void ScoutMonitor::CalcDimensions()
{
int sy, sx;
getmaxyx(stdscr, sy, sx);
if (sy != term_sy_ || sx != term_sx_)
{
resizing_detected_ = true;
term_sy_ = sy;
term_sx_ = sx;
bi_win_sy_ = term_sy_;
bi_win_sx_ = term_sx_ * 15 / 24;
bi_origin_y_ = 0;
bi_origin_x_ = 0;
si_win_sy_ = term_sy_;
si_win_sx_ = term_sx_ * 9 / 24;
si_origin_y_ = 0;
si_origin_x_ = bi_win_sx_;
}
}
void ScoutMonitor::HandleResizing()
{
delwin(body_info_win_);
delwin(system_info_win_);
body_info_win_ = newwin(bi_win_sy_, bi_win_sx_, bi_origin_y_, bi_origin_x_);
system_info_win_ = newwin(si_win_sy_, si_win_sx_, si_origin_y_, si_origin_x_);
resizing_detected_ = false;
}
void ScoutMonitor::ClearAll()
{
wclear(body_info_win_);
wclear(system_info_win_);
}
void ScoutMonitor::ShowVehicleState(int y, int x)
{
// show linear velocity
const int linear_axis_x = x + vehicle_fp_offset_x_;
const int linear_axis_tip_y = y + 2;
const int linear_axis_origin_y = linear_axis_tip_y + linear_axis_length_;
const int linear_axis_negative_y = linear_axis_origin_y + linear_axis_length_ + 1;
mvwprintw(body_info_win_, linear_axis_tip_y - 1, linear_axis_x, "^");
for (int i = linear_axis_tip_y; i < linear_axis_origin_y; ++i)
mvwprintw(body_info_win_, i, linear_axis_x, "-");
mvwprintw(body_info_win_, linear_axis_origin_y, linear_axis_x, "x");
for (int i = linear_axis_origin_y + 1; i < linear_axis_negative_y; ++i)
mvwprintw(body_info_win_, i, linear_axis_x, "-");
mvwprintw(body_info_win_, linear_axis_negative_y, linear_axis_x, "v");
double linear_percentage = scout_state_.linear_velocity / ScoutMotionCmd::max_linear_velocity;
int linear_bars = std::abs(static_cast<int>(linear_percentage * 5)) + 1;
if (std::abs(scout_state_.linear_velocity) < 0.001)
linear_bars = 0;
if (linear_bars > 5)
linear_bars = 5;
if (scout_state_.linear_velocity > 0)
{
for (int i = linear_axis_origin_y - linear_bars; i < linear_axis_origin_y; ++i)
{
NColors::WSetColor(body_info_win_, NColors::BLACK, NColors::CYAN);
mvwprintw(body_info_win_, i, linear_axis_x, "-");
NColors::WUnsetColor(body_info_win_, NColors::BLACK, NColors::CYAN);
}
}
else if (scout_state_.linear_velocity < 0)
{
for (int i = linear_axis_origin_y + linear_bars; i > linear_axis_origin_y; --i)
{
NColors::WSetColor(body_info_win_, NColors::BLACK, NColors::CYAN);
mvwprintw(body_info_win_, i, linear_axis_x, "-");
NColors::WUnsetColor(body_info_win_, NColors::BLACK, NColors::CYAN);
}
}
// show angular velocity
const int angular_axis_y = linear_axis_origin_y;
const int angular_axis_origin_x = linear_axis_x;
const int angular_axis_positive_x = angular_axis_origin_x + angular_axis_length_ + 1;
const int angular_axis_negative_x = angular_axis_origin_x - angular_axis_length_;
mvwprintw(body_info_win_, angular_axis_y, angular_axis_negative_x - 1, "<");
for (int i = angular_axis_negative_x; i < angular_axis_origin_x; ++i)
mvwprintw(body_info_win_, angular_axis_y, i, "-");
mvwprintw(body_info_win_, linear_axis_origin_y, linear_axis_x, "x");
for (int i = angular_axis_origin_x + 1; i < angular_axis_positive_x; ++i)
mvwprintw(body_info_win_, angular_axis_y, i, "-");
mvwprintw(body_info_win_, angular_axis_y, angular_axis_positive_x, ">");
double angular_percentage = scout_state_.angular_velocity / ScoutMotionCmd::max_angular_velocity;
int angular_bars = std::abs(static_cast<int>(angular_percentage * 5)) + 1;
if (std::abs(scout_state_.angular_velocity) < 0.001)
angular_bars = 0;
if (angular_bars > 5)
angular_bars = 5;
if (scout_state_.angular_velocity < 0)
{
for (int i = angular_axis_origin_x + angular_bars; i > angular_axis_origin_x; --i)
{
NColors::WSetColor(body_info_win_, NColors::BLACK, NColors::MAGENTA);
mvwprintw(body_info_win_, angular_axis_y, i, "-");
NColors::WUnsetColor(body_info_win_, NColors::BLACK, NColors::MAGENTA);
}
}
else if (scout_state_.angular_velocity > 0)
{
for (int i = angular_axis_origin_x - angular_bars; i < angular_axis_origin_x; ++i)
{
NColors::WSetColor(body_info_win_, NColors::BLACK, NColors::MAGENTA);
mvwprintw(body_info_win_, angular_axis_y, i, "-");
NColors::WUnsetColor(body_info_win_, NColors::BLACK, NColors::MAGENTA);
}
}
// show velocity values
std::string linear_vel_str = "linear : " + ConvertFloatToString(scout_state_.linear_velocity);
mvwprintw(body_info_win_, linear_axis_negative_y + 2, angular_axis_negative_x - 2, linear_vel_str.c_str());
std::string angular_vel_str = "angular: " + ConvertFloatToString(scout_state_.angular_velocity);
mvwprintw(body_info_win_, linear_axis_negative_y + 3, angular_axis_negative_x - 2, angular_vel_str.c_str());
// show vehicle base
NShapes::WDrawRectangle(body_info_win_, linear_axis_tip_y - 2, angular_axis_negative_x - 4,
linear_axis_negative_y + 4, angular_axis_positive_x + 3);
// show vehicle wheels
NShapes::WDrawRectangle(body_info_win_, linear_axis_tip_y - 1, angular_axis_negative_x - 9,
linear_axis_tip_y + 4, angular_axis_negative_x - 5);
NShapes::WDrawRectangle(body_info_win_, linear_axis_negative_y - 2, angular_axis_negative_x - 9,
linear_axis_negative_y + 3, angular_axis_negative_x - 5);
NShapes::WDrawRectangle(body_info_win_, linear_axis_tip_y - 1, angular_axis_positive_x + 4,
linear_axis_tip_y + 4, angular_axis_positive_x + 8);
NShapes::WDrawRectangle(body_info_win_, linear_axis_negative_y - 2, angular_axis_positive_x + 4,
linear_axis_negative_y + 3, angular_axis_positive_x + 8);
// front right motor
ShowMotorInfo(linear_axis_tip_y - 1, angular_axis_positive_x + 4, scout_state_.motor_states[0].current,
scout_state_.motor_states[0].rpm, scout_state_.motor_states[0].temperature, true);
// front left motor
ShowMotorInfo(linear_axis_tip_y - 1, angular_axis_negative_x - 9, scout_state_.motor_states[1].current,
scout_state_.motor_states[1].rpm, scout_state_.motor_states[1].temperature, false);
// rear left motor
ShowMotorInfo(linear_axis_negative_y - 2, angular_axis_negative_x - 9, scout_state_.motor_states[2].current,
scout_state_.motor_states[2].rpm, scout_state_.motor_states[2].temperature, false);
// rear right motor
ShowMotorInfo(linear_axis_negative_y - 2, angular_axis_positive_x + 4, scout_state_.motor_states[3].current,
scout_state_.motor_states[3].rpm, scout_state_.motor_states[3].temperature, true);
// show vehicle lights
std::string front_mode_str = "Mode: ";
if (scout_state_.front_light_state.mode == LIGHT_MODE_CONST_ON)
front_mode_str += "ON";
else if (scout_state_.front_light_state.mode == LIGHT_MODE_CONST_OFF)
front_mode_str += "OFF";
else if (scout_state_.front_light_state.mode == LIGHT_MODE_BREATH)
front_mode_str += "BREATH";
else if (scout_state_.front_light_state.mode == LIGHT_MODE_CUSTOM)
front_mode_str += "CUSTOM";
mvwprintw(body_info_win_, linear_axis_tip_y - 4, angular_axis_origin_x - 13, front_mode_str.c_str());
std::string front_custom_str = "Custom: " + ConvertFloatToString(scout_state_.front_light_state.custom_value, 0);
mvwprintw(body_info_win_, linear_axis_tip_y - 4, angular_axis_origin_x + 3, front_custom_str.c_str());
if (scout_state_.front_light_state.mode != LIGHT_MODE_CONST_OFF &&
!(scout_state_.front_light_state.mode == LIGHT_MODE_CUSTOM && scout_state_.front_light_state.custom_value == 0))
{
NColors::WSetColor(body_info_win_, NColors::BRIGHT_YELLOW);
for (int i = angular_axis_origin_x - 5; i < angular_axis_origin_x - 1; ++i)
mvwprintw(body_info_win_, linear_axis_tip_y - 3, i, "v");
mvwprintw(body_info_win_, linear_axis_tip_y - 3, angular_axis_origin_x, "v");
for (int i = angular_axis_origin_x + 2; i <= angular_axis_origin_x + 5; ++i)
mvwprintw(body_info_win_, linear_axis_tip_y - 3, i, "v");
NColors::WUnsetColor(body_info_win_, NColors::BRIGHT_YELLOW);
}
std::string rear_mode_str = "Mode: ";
if (scout_state_.rear_light_state.mode == LIGHT_MODE_CONST_ON)
rear_mode_str += "ON";
else if (scout_state_.rear_light_state.mode == LIGHT_MODE_CONST_OFF)
rear_mode_str += "OFF";
else if (scout_state_.rear_light_state.mode == LIGHT_MODE_BREATH)
rear_mode_str += "BREATH";
else if (scout_state_.rear_light_state.mode == LIGHT_MODE_CUSTOM)
rear_mode_str += "CUSTOM";
mvwprintw(body_info_win_, linear_axis_negative_y + 6, angular_axis_origin_x - 13, rear_mode_str.c_str());
std::string rear_custom_str = "Custom: " + ConvertFloatToString(scout_state_.rear_light_state.custom_value, 0);
mvwprintw(body_info_win_, linear_axis_negative_y + 6, angular_axis_origin_x + 3, rear_custom_str.c_str());
if (scout_state_.rear_light_state.mode != LIGHT_MODE_CONST_OFF &&
!(scout_state_.rear_light_state.mode == LIGHT_MODE_CUSTOM && scout_state_.rear_light_state.custom_value == 0))
{
NColors::WSetColor(body_info_win_, NColors::BRIGHT_RED);
for (int i = angular_axis_origin_x - 5; i < angular_axis_origin_x - 1; ++i)
mvwprintw(body_info_win_, linear_axis_negative_y + 5, i, "^");
mvwprintw(body_info_win_, linear_axis_negative_y + 5, angular_axis_origin_x, "^");
for (int i = angular_axis_origin_x + 2; i <= angular_axis_origin_x + 5; ++i)
mvwprintw(body_info_win_, linear_axis_negative_y + 5, i, "^");
NColors::WUnsetColor(body_info_win_, NColors::BRIGHT_RED);
}
}
void ScoutMonitor::UpdateScoutBodyInfo()
{
// for (int i = 0; i < bi_win_sx_; i++)
// mvwprintw(body_info_win_, bi_win_sy_ - 1, i, "-");
ShowVehicleState(bi_win_sy_ / 2 - vehicle_fp_offset_y_, bi_win_sx_ / 2 - vehicle_fp_offset_x_);
wrefresh(body_info_win_);
}
void ScoutMonitor::UpdateScoutSystemInfo()
{
for (int i = 0; i < si_win_sy_; i++)
mvwprintw(system_info_win_, i, 0, "|");
const int state_title_col = (si_win_sx_ - 24) / 2;
const int state_value_col = state_title_col + 20;
const int state_div_col = state_value_col - 2;
// system state
const int sec1 = static_cast<int>(std::round((si_win_sy_ - 20) / 2.0));
ShowStatusItemName(sec1, state_title_col, "System state");
if (scout_state_.base_state == BASE_STATE_NORMAL)
{
NColors::WSetColor(system_info_win_, NColors::GREEN);
mvwprintw(system_info_win_, sec1, state_value_col, "NORMAL");
NColors::WUnsetColor(system_info_win_, NColors::GREEN);
}
else if (scout_state_.base_state == BASE_STATE_ESTOP)
{
NColors::WSetColor(system_info_win_, NColors::YELLOW);
mvwprintw(system_info_win_, sec1, state_value_col, "ESTOP");
NColors::WUnsetColor(system_info_win_, NColors::YELLOW);
}
else if (scout_state_.base_state == BASE_STATE_EXCEPTION)
{
NColors::WSetColor(system_info_win_, NColors::RED);
mvwprintw(system_info_win_, sec1, state_value_col, "EXCEPT");
NColors::WUnsetColor(system_info_win_, NColors::RED);
}
// control mode
ShowStatusItemName(sec1 + 1, state_title_col, "Control mode");
if (scout_state_.control_mode == CTRL_MODE_REMOTE)
mvwprintw(system_info_win_, sec1 + 1, state_value_col, "REMOTE");
else if (scout_state_.control_mode == CTRL_MODE_CMD_CAN)
mvwprintw(system_info_win_, sec1 + 1, state_value_col, "CMD");
else if (scout_state_.control_mode == CTRL_MODE_CMD_UART)
mvwprintw(system_info_win_, sec1 + 1, state_value_col, "CMD");
// mvwprintw(system_info_win_, sec1 + 1, state_value_col, std::to_string(scout_state_.control_mode).c_str());
// battery voltage
ShowStatusItemName(sec1 + 2, state_title_col, "Battery voltage");
std::string bat_vol_str = ConvertFloatToString(scout_state_.battery_voltage, 1) + " v";
mvwprintw(system_info_win_, sec1 + 2, state_value_col, bat_vol_str.c_str());
const int fault_col_1 = state_value_col;
const int fault_col_2 = fault_col_1 + 2;
const int fault_col_3 = fault_col_2 + 2;
const int sec2 = sec1 + 4;
mvwprintw(system_info_win_, sec2, state_title_col, "System faults");
// motor driver over heat;
ShowStatusItemName(sec2 + 1, state_title_col, "-Drv over-heat");
if ((scout_state_.fault_code & FAULT_MOTOR_DRV_OVERHEAT_W) == 0 &&
(scout_state_.fault_code & FAULT_MOTOR_DRV_OVERHEAT_F) == 0)
{
NColors::WSetColor(system_info_win_, NColors::GREEN);
mvwprintw(system_info_win_, sec2 + 1, fault_col_1, "N");
NColors::WUnsetColor(system_info_win_, NColors::GREEN);
}
else
{
if (scout_state_.fault_code & FAULT_MOTOR_DRV_OVERHEAT_W)
{
NColors::WSetColor(system_info_win_, NColors::YELLOW);
mvwprintw(system_info_win_, sec2 + 1, fault_col_2, "W");
NColors::WUnsetColor(system_info_win_, NColors::YELLOW);
}
if (scout_state_.fault_code & FAULT_MOTOR_DRV_OVERHEAT_F)
{
NColors::WSetColor(system_info_win_, NColors::RED);
mvwprintw(system_info_win_, sec2 + 1, fault_col_3, "P");
NColors::WUnsetColor(system_info_win_, NColors::RED);
}
}
// motor driver over current
ShowStatusItemName(sec2 + 2, state_title_col, "-Mt over-current");
if ((scout_state_.fault_code & FAULT_MOTOR_OVERCURRENT_W) == 0 &&
(scout_state_.fault_code & FAULT_MOTOR_OVERCURRENT_F) == 0)
{
NColors::WSetColor(system_info_win_, NColors::GREEN);
mvwprintw(system_info_win_, sec2 + 2, fault_col_1, "N");
NColors::WUnsetColor(system_info_win_, NColors::GREEN);
}
else
{
if (scout_state_.fault_code & FAULT_MOTOR_OVERCURRENT_W)
{
NColors::WSetColor(system_info_win_, NColors::YELLOW);
mvwprintw(system_info_win_, sec2 + 2, fault_col_2, "W");
NColors::WUnsetColor(system_info_win_, NColors::YELLOW);
}
if (scout_state_.fault_code & FAULT_MOTOR_OVERCURRENT_F)
{
NColors::WSetColor(system_info_win_, NColors::RED);
mvwprintw(system_info_win_, sec2 + 2, fault_col_3, "P");
NColors::WUnsetColor(system_info_win_, NColors::RED);
}
}
// battery under voltage
ShowStatusItemName(sec2 + 3, state_title_col, "-Bat under volt");
if ((scout_state_.fault_code & FAULT_BAT_UNDER_VOL_W) == 0 &&
(scout_state_.fault_code & FAULT_BAT_UNDER_VOL_F) == 0)
{
NColors::WSetColor(system_info_win_, NColors::GREEN);
mvwprintw(system_info_win_, sec2 + 3, fault_col_1, "N");
NColors::WUnsetColor(system_info_win_, NColors::GREEN);
}
else
{
if (scout_state_.fault_code & FAULT_BAT_UNDER_VOL_W)
{
NColors::WSetColor(system_info_win_, NColors::YELLOW);
mvwprintw(system_info_win_, sec2 + 3, fault_col_2, "W");
NColors::WUnsetColor(system_info_win_, NColors::YELLOW);
}
if (scout_state_.fault_code & FAULT_BAT_UNDER_VOL_F)
{
NColors::WSetColor(system_info_win_, NColors::RED);
mvwprintw(system_info_win_, sec2 + 3, fault_col_3, "F");
NColors::WUnsetColor(system_info_win_, NColors::RED);
}
}
// battery over voltage
ShowStatusItemName(sec2 + 4, state_title_col, "-Bat over volt");
ShowFault(sec2 + 4, fault_col_1, (scout_state_.fault_code & FAULT_BAT_OVER_VOL_F) == 0);
const int sec3 = sec2 + 6;
mvwprintw(system_info_win_, sec3, state_title_col, "Comm faults");
// CAN cmd checksum
ShowStatusItemName(sec3 + 1, state_title_col, "-CAN cmd checksum");
ShowFault(sec3 + 1, fault_col_1, (scout_state_.fault_code & FAULT_CAN_CHECKSUM_ERROR) == 0);
// motor comm
ShowStatusItemName(sec3 + 2, state_title_col, "-Motor 1 comm");
ShowFault(sec3 + 2, fault_col_1, (scout_state_.fault_code & FAULT_MOTOR1_COMM_F) == 0);
ShowStatusItemName(sec3 + 3, state_title_col, "-Motor 2 comm");
ShowFault(sec3 + 3, fault_col_1, (scout_state_.fault_code & FAULT_MOTOR2_COMM_F) == 0);
ShowStatusItemName(sec3 + 4, state_title_col, "-Motor 3 comm");
ShowFault(sec3 + 4, fault_col_1, (scout_state_.fault_code & FAULT_MOTOR3_COMM_F) == 0);
ShowStatusItemName(sec3 + 5, state_title_col, "-Motor 4 comm");
ShowFault(sec3 + 5, fault_col_1, (scout_state_.fault_code & FAULT_MOTOR4_COMM_F) == 0);
const int sec4 = sec3 + 8;
NColors::WSetColor(system_info_win_, NColors::GREEN);
mvwprintw(system_info_win_, sec4, state_title_col + 1, "N: Normal");
NColors::WUnsetColor(system_info_win_, NColors::GREEN);
NColors::WSetColor(system_info_win_, NColors::YELLOW);
mvwprintw(system_info_win_, sec4, state_title_col + 12, "W: Warning");
NColors::WUnsetColor(system_info_win_, NColors::YELLOW);
NColors::WSetColor(system_info_win_, NColors::RED);
mvwprintw(system_info_win_, sec4 + 1, state_title_col + 1, "F: Fault P: Protection");
NColors::WUnsetColor(system_info_win_, NColors::RED);
wrefresh(system_info_win_);
}
void ScoutMonitor::ShowStatusItemName(int y, int x, std::string name)
{
const int state_value_col = x + 20;
const int state_div_col = state_value_col - 2;
mvwprintw(system_info_win_, y, x, name.c_str());
mvwprintw(system_info_win_, y, state_div_col, ":");
}
void ScoutMonitor::ShowFault(int y, int x, bool no_fault)
{
const int fault_col_1 = x;
const int fault_col_2 = x + 2;
const int fault_col_3 = fault_col_2 + 2;
if (no_fault)
{
NColors::WSetColor(system_info_win_, NColors::GREEN);
mvwprintw(system_info_win_, y, fault_col_1, "N");
NColors::WUnsetColor(system_info_win_, NColors::GREEN);
}
else
{
NColors::WSetColor(system_info_win_, NColors::RED);
mvwprintw(system_info_win_, y, fault_col_3, "F");
NColors::WUnsetColor(system_info_win_, NColors::RED);
}
}
// (y,x): position of the top left point of corresponding wheel
void ScoutMonitor::ShowMotorInfo(int y, int x, double cur, int rpm, int temp, bool is_right)
{
int col_title = x;
if (is_right)
col_title += 6;
else
col_title -= 9;
std::string cur_str = "CUR:" + ConvertFloatToString(cur, 1);
mvwprintw(body_info_win_, y + 1, col_title, cur_str.c_str());
std::string rpm_str = "RPM:" + ConvertFloatToString(rpm, 0);
mvwprintw(body_info_win_, y + 2, col_title, rpm_str.c_str());
std::string temp_str = "TMP:" + ConvertFloatToString(temp, 0);
mvwprintw(body_info_win_, y + 3, col_title, temp_str.c_str());
}
} // namespace wescore

View File

@@ -1,15 +0,0 @@
# Add executables
add_executable(test_scout_monitor test_scout_monitor.cpp)
target_link_libraries(test_scout_monitor monitor)
add_executable(test_scout_monitor_virtual test_scout_monitor_virtual.cpp)
target_link_libraries(test_scout_monitor_virtual monitor)
# add_executable(test_ncurses test_ncurses.cpp)
# target_link_libraries(test_ncurses monitor)
# add_executable(test_ncolor test_ncolor.c)
# target_link_libraries(test_ncolor monitor)
# add_executable(test_ncolor2 test_ncolor2.cpp)
# target_link_libraries(test_ncolor2 monitor)

View File

@@ -1,158 +0,0 @@
/* color-demo.c */
// source: https://www.linuxjournal.com/content/about-ncurses-colors-0
#include <curses.h>
#include <stdio.h>
#include <stdlib.h>
int is_bold(int fg);
void init_colorpairs(void);
short curs_color(int fg);
int colornum(int fg, int bg);
void setcolor(int fg, int bg);
void unsetcolor(int fg, int bg);
void init_colorpairs(void)
{
int fg, bg;
int colorpair;
for (bg = 0; bg <= 7; bg++)
{
for (fg = 0; fg <= 7; fg++)
{
colorpair = colornum(fg, bg);
init_pair(colorpair, curs_color(fg), curs_color(bg));
}
}
}
short curs_color(int fg)
{
switch (7 & fg)
{ /* RGB */
case 0: /* 000 */
return (COLOR_BLACK);
case 1: /* 001 */
return (COLOR_BLUE);
case 2: /* 010 */
return (COLOR_GREEN);
case 3: /* 011 */
return (COLOR_CYAN);
case 4: /* 100 */
return (COLOR_RED);
case 5: /* 101 */
return (COLOR_MAGENTA);
case 6: /* 110 */
return (COLOR_YELLOW);
case 7: /* 111 */
return (COLOR_WHITE);
}
}
int colornum(int fg, int bg)
{
int B, bbb, ffff;
B = 1 << 7;
bbb = (7 & bg) << 4;
ffff = 7 & fg;
return (B | bbb | ffff);
}
void setcolor(int fg, int bg)
{
/* set the color pair (colornum) and bold/bright (A_BOLD) */
attron(COLOR_PAIR(colornum(fg, bg)));
if (is_bold(fg))
{
attron(A_BOLD);
}
}
void unsetcolor(int fg, int bg)
{
/* unset the color pair (colornum) and
bold/bright (A_BOLD) */
attroff(COLOR_PAIR(colornum(fg, bg)));
if (is_bold(fg))
{
attroff(A_BOLD);
}
}
int is_bold(int fg)
{
/* return the intensity bit */
int i;
i = 1 << 3;
return (i & fg);
}
int main(void)
{
int fg, bg;
/* initialize curses */
initscr();
keypad(stdscr, TRUE);
cbreak();
noecho();
/* initialize colors */
if (has_colors() == FALSE)
{
endwin();
puts("Your terminal does not support color");
exit(1);
}
start_color();
init_colorpairs();
/* draw test pattern */
if ((LINES < 24) || (COLS < 80))
{
endwin();
puts("Your terminal needs to be at least 80x24");
exit(2);
}
mvaddstr(0, 35, "COLOR DEMO");
mvaddstr(2, 0, "low intensity text colors (0-7)");
mvaddstr(12, 0, "high intensity text colors (8-15)");
for (bg = 0; bg <= 7; bg++)
{
for (fg = 0; fg <= 7; fg++)
{
setcolor(fg, bg);
mvaddstr(fg + 3, bg * 10, "...test...");
unsetcolor(fg, bg);
}
for (fg = 8; fg <= 15; fg++)
{
setcolor(fg, bg);
mvaddstr(fg + 5, bg * 10, "...test...");
unsetcolor(fg, bg);
}
}
mvaddstr(LINES - 1, 0, "press any key to quit");
refresh();
getch();
endwin();
exit(0);
}

View File

@@ -1,65 +0,0 @@
#include "monitor/ncolors.hpp"
using namespace wescore;
int main(void)
{
int fg, bg;
/* initialize curses */
initscr();
keypad(stdscr, TRUE);
cbreak();
noecho();
/* initialize colors */
if (has_colors() == FALSE)
{
endwin();
puts("Your terminal does not support color");
return 1;
}
NColors::InitColors();
/* draw test pattern */
if ((LINES < 24) || (COLS < 80))
{
endwin();
puts("Your terminal needs to be at least 80x24");
return 2;
}
mvaddstr(0, 35, "COLOR DEMO");
mvaddstr(2, 0, "low intensity text colors (0-7)");
mvaddstr(12, 0, "high intensity text colors (8-15)");
for (bg = 0; bg <= 7; bg++)
{
for (fg = 0; fg <= 7; fg++)
{
NColors::SetColor(fg, bg);
mvaddstr(fg + 3, bg * 10, "...test...");
NColors::UnsetColor(fg, bg);
}
for (fg = 8; fg <= 15; fg++)
{
NColors::SetColor(fg, bg);
mvaddstr(fg + 5, bg * 10, "...test...");
NColors::UnsetColor(fg, bg);
}
}
mvaddstr(LINES - 1, 0, "press any key to quit");
refresh();
getch();
endwin();
return 0;
}

View File

@@ -1,118 +0,0 @@
#include <panel.h>
#include <string.h>
#define NLINES 10
#define NCOLS 40
void init_wins(WINDOW **wins, int n);
void win_show(WINDOW *win, char *label, int label_color);
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
int main()
{ WINDOW *my_wins[3];
PANEL *my_panels[3];
PANEL *top;
int ch;
/* Initialize curses */
initscr();
start_color();
cbreak();
noecho();
keypad(stdscr, TRUE);
/* Initialize all the colors */
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_BLUE, COLOR_BLACK);
init_pair(4, COLOR_CYAN, COLOR_BLACK);
init_wins(my_wins, 3);
/* Attach a panel to each window */ /* Order is bottom up */
my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */
my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */
my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */
/* Set up the user pointers to the next panel */
set_panel_userptr(my_panels[0], my_panels[1]);
set_panel_userptr(my_panels[1], my_panels[2]);
set_panel_userptr(my_panels[2], my_panels[0]);
/* Update the stacking order. 2nd panel will be on top */
update_panels();
/* Show it on the screen */
attron(COLOR_PAIR(4));
mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)");
attroff(COLOR_PAIR(4));
doupdate();
top = my_panels[2];
while((ch = getch()) != KEY_F(1))
{ switch(ch)
{ case 9:
top = (PANEL *)panel_userptr(top);
top_panel(top);
break;
}
update_panels();
doupdate();
}
endwin();
return 0;
}
/* Put all the windows */
void init_wins(WINDOW **wins, int n)
{ int x, y, i;
char label[80];
y = 2;
x = 10;
for(i = 0; i < n; ++i)
{ wins[i] = newwin(NLINES, NCOLS, y, x);
sprintf(label, "Window Number %d", i + 1);
win_show(wins[i], label, i + 1);
y += 3;
x += 7;
}
}
/* Show the window with a border and a label */
void win_show(WINDOW *win, char *label, int label_color)
{ int startx, starty, height, width;
getbegyx(win, starty, startx);
getmaxyx(win, height, width);
box(win, 0, 0);
mvwaddch(win, 2, 0, ACS_LTEE);
mvwhline(win, 2, 1, ACS_HLINE, width - 2);
mvwaddch(win, 2, width - 1, ACS_RTEE);
print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));
}
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
{ int length, x, y;
float temp;
if(win == NULL)
win = stdscr;
getyx(win, y, x);
if(startx != 0)
x = startx;
if(starty != 0)
y = starty;
if(width == 0)
width = 80;
length = strlen(string);
temp = (width - length)/ 2;
x = startx + (int)temp;
wattron(win, color);
mvwprintw(win, y, x, "%s", string);
wattroff(win, color);
refresh();
}

View File

@@ -1,33 +0,0 @@
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <iostream>
#include "monitor/scout_monitor.hpp"
using namespace wescore;
ScoutMonitor monitor;
void SignalHandler(int s)
{
printf("Caught signal %d\n", s);
monitor.Terminate();
exit(1);
}
int main(int argc, char **argv)
{
struct sigaction sigIntHandler;
sigIntHandler.sa_handler = SignalHandler;
sigemptyset(&sigIntHandler.sa_mask);
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
std::cout << "scout monitor started" << std::endl;
monitor.Run("can1");
return 0;
}

View File

@@ -1,33 +0,0 @@
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <iostream>
#include "monitor/scout_monitor.hpp"
using namespace wescore;
ScoutMonitor monitor;
void SignalHandler(int s)
{
printf("Caught signal %d\n", s);
monitor.Terminate();
exit(1);
}
int main(int argc, char **argv)
{
struct sigaction sigIntHandler;
sigIntHandler.sa_handler = SignalHandler;
sigemptyset(&sigIntHandler.sa_mask);
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
std::cout << "scout monitor started" << std::endl;
monitor.Run();
return 0;
}

View File

@@ -1,3 +0,0 @@
# Add source directories
add_subdirectory(async_io)
add_subdirectory(scout_protocol)

View File

@@ -1,22 +0,0 @@
# Dependency libraries
# find_package(LIB_NAME REQUIRED)
# Add libraries
set(ASYNC_IO_LIB_SRC
src/async_serial.cpp
src/async_can.cpp
src/asyncio_utils.cpp
)
add_library(asyncio STATIC ${ASYNC_IO_LIB_SRC})
set_target_properties(asyncio PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(asyncio PUBLIC "-DASIO_ENABLE_OLD_SERVICES -DASIO_HAS_POSIX_STREAM_DESCRIPTOR")
target_link_libraries(asyncio asio pthread)
target_include_directories(asyncio PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
# Add executables
if(BUILD_TESTS)
add_subdirectory(tests)
endif()

View File

@@ -1,12 +0,0 @@
# Add executables
add_executable(test_aserial test_aserial.cpp)
target_link_libraries(test_aserial asyncio)
add_executable(test_aserial_comm test_aserial_comm.cpp)
target_link_libraries(test_aserial_comm asyncio)
add_executable(test_asio_can test_asio_can.cpp)
target_link_libraries(test_asio_can asio pthread)
add_executable(test_acan test_acan.cpp)
target_link_libraries(test_acan asyncio)

View File

@@ -1,60 +0,0 @@
#include <iostream>
#include "async_io/async_can.hpp"
using namespace wescore;
void parse_buffer(uint8_t *buf, const size_t bufsize, size_t bytes_received)
{
std::cout << "parser called" << std::endl;
// mavlink::mavlink_status_t status;
// mavlink::mavlink_message_t message;
for (; bytes_received > 0; bytes_received--)
{
auto c = *buf++;
// // based on mavlink_parse_char()
// auto msg_received = static_cast<Framing>(mavlink::mavlink_frame_char_buffer(&m_buffer, &m_status, c, &message, &status));
// if (msg_received == Framing::bad_crc || msg_received == Framing::bad_signature) {
// mavlink::_mav_parse_error(&m_status);
// m_status.msg_received = mavlink::MAVLINK_FRAMING_INCOMPLETE;
// m_status.parse_state = mavlink::MAVLINK_PARSE_STATE_IDLE;
// if (c == MAVLINK_STX) {
// m_status.parse_state = mavlink::MAVLINK_PARSE_STATE_GOT_STX;
// m_buffer.len = 0;
// mavlink::mavlink_start_checksum(&m_buffer);
// }
// }
// if (msg_received != Framing::incomplete) {
// log_recv(pfx, message, msg_received);
// if (message_received_cb)
// message_received_cb(&message, msg_received);
// }
}
}
int main(int argc, char *argv[])
{
std::shared_ptr<ASyncCAN> canbus = std::make_shared<ASyncCAN>("can1");
// canbus->set_receive_callback(parse_buffer);
// if (canbus->is_open())
// std::cout << "can bus connected" << std::endl;
struct can_frame frame;
frame.can_id = 0x123;
frame.can_dlc = 2;
frame.data[0] = 0x11;
frame.data[1] = 0x23;
while (1)
{
// canbus->send_bytes(data, 3);
canbus->send_frame(frame);
sleep(1);
}
}

View File

@@ -1,42 +0,0 @@
/*
* test_interface.cpp
*
* Created on: Dec 25, 2016
* Author: rdu
*/
#include <iostream>
#include "async_io/async_serial.hpp"
using namespace wescore;
void parse_buffer(uint8_t *buf, const size_t bufsize, size_t bytes_received)
{
std::cout << "parser called" << std::endl;
for (; bytes_received > 0; bytes_received--)
{
auto c = *buf++;
}
}
int main(int argc, char *argv[])
{
// ASyncSerial::Ptr serial = ASyncSerial::open_url("/dev/ttyUSB0:115200");
std::shared_ptr<ASyncSerial> serial = std::make_shared<ASyncSerial>("/dev/ttyO5", 115200);
serial->set_receive_callback(parse_buffer);
if (serial->is_open())
std::cout << "serial port opened" << std::endl;
uint8_t data[8] = {'a','b','c'};
while (1)
{
// serial->send_bytes(data, 3);
sleep(1);
}
}

View File

@@ -1,82 +0,0 @@
/*
* test_interface.cpp
*
* Created on: Dec 25, 2016
* Author: rdu
*/
#include <iostream>
#include "async_io/async_serial.hpp"
using namespace wescore;
void parse_buffer(uint8_t *buf, const size_t bufsize, size_t bytes_received)
{
// std::cout << "parser called" << std::endl;
// for (int i = 0; i < bytes_received; ++i)
// {
// // auto c = *buf++;
// std::cout << std::hex << static_cast<int>(buf[i]) << std::dec << " ";
// }
if (bytes_received > 2)
{
for (int i = 0; i < bytes_received - 1; ++i)
{
uint8_t first = buf[i];
uint8_t second = buf[i + 1];
if (first == 0xB5 && second == 0x62)
std::cout << "- start bytes found" << std::endl;
// std::cout << std::hex << static_cast<int>(buf[i]) << std::dec << " ";
}
}
}
int main(int argc, char *argv[])
{
std::string device_name;
int baud;
if (argc == 3)
{
device_name = {argv[1]};
baud = std::stoi(argv[2]);
std::cout << "Specified device: " << device_name << ", baud: " << baud << std::endl;
}
else
{
std::cout << "Usage: test_aserial_comm <interface> <baud>" << std::endl
<< "Example: ./test_aserial_comm /dev/ttyUSB0 115200" << std::endl;
return -1;
}
std::shared_ptr<ASyncSerial> serial = std::make_shared<ASyncSerial>(device_name, baud);
serial->set_receive_callback(parse_buffer);
if (serial->is_open())
std::cout << "serial port opened" << std::endl;
uint8_t data[8] = {'a', 'b', 'c'};
int count = 0;
uint8_t idx = 0;
const unsigned baudrates[] = {9600, 57600, 115200};
while (1)
{
// serial->send_bytes(data, 3);
if (++count == 15)
{
count = 0;
std::cout << "----------------------------------------" << std::endl;
std::cout << "change baud rate to " << baudrates[idx % 3] << std::endl;
std::cout << "----------------------------------------" << std::endl;
serial->set_baud(baudrates[idx % 3]);
idx++;
}
sleep(1);
}
}

View File

@@ -1,79 +0,0 @@
// source: https://stackoverflow.com/questions/10467178/boostasio-over-socketcan
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <iostream>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/can.h>
#include <linux/can/raw.h>
#define ASIO_ENABLE_OLD_SERVICES
#define ASIO_HAS_POSIX_STREAM_DESCRIPTOR
#include "asio.hpp"
#include <functional>
#include "asio/posix/basic_stream_descriptor.hpp"
void data_send(void)
{
std::cout << "omg sent" << std::endl;
}
void data_rec(struct can_frame &rec_frame,
asio::posix::basic_stream_descriptor<> &stream)
{
std::cout << std::hex << rec_frame.can_id << " ";
for (int i = 0; i < rec_frame.can_dlc; i++)
{
std::cout << std::hex << int(rec_frame.data[i]) << " ";
}
std::cout << std::dec << std::endl;
stream.async_read_some(
asio::buffer(&rec_frame, sizeof(rec_frame)),
std::bind(data_rec, std::ref(rec_frame), std::ref(stream)));
}
int main(void)
{
struct sockaddr_can addr;
struct can_frame frame;
struct can_frame rec_frame;
struct ifreq ifr;
int natsock = socket(PF_CAN, SOCK_RAW, CAN_RAW);
strcpy(ifr.ifr_name, "can1");
ioctl(natsock, SIOCGIFINDEX, &ifr);
addr.can_family = AF_CAN;
addr.can_ifindex = ifr.ifr_ifindex;
if (bind(natsock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
{
perror("Error in socket bind");
return -2;
}
frame.can_id = 0x123;
frame.can_dlc = 2;
frame.data[0] = 0x11;
frame.data[1] = 0x23;
asio::io_service ios;
asio::posix::basic_stream_descriptor<> stream(ios);
stream.assign(natsock);
stream.async_write_some(asio::buffer(&frame, sizeof(frame)),
std::bind(data_send));
stream.async_read_some(
asio::buffer(&rec_frame, sizeof(rec_frame)),
std::bind(data_rec, std::ref(rec_frame), std::ref(stream)));
ios.run();
}

View File

@@ -1,12 +0,0 @@
## Add libraries
set(SCOUT_PROTOCOL_SRC
src/scout_can_parser.c
src/scout_uart_parser.c
)
add_library(scout_protocol STATIC ${SCOUT_PROTOCOL_SRC})
set_target_properties(scout_protocol PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(scout_protocol PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
$<INSTALL_INTERFACE:include>
PRIVATE src)

View File

@@ -1,3 +0,0 @@
## AgileX Protocol
This module is implemented in C, designed for exchanging information with AgileX mobile bases.

View File

@@ -1,17 +0,0 @@
## Add libraries
set(SCOUT_BASE_SRC
src/scout_base.cpp
)
add_library(scoutbase STATIC ${SCOUT_BASE_SRC})
set_target_properties(scoutbase PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(scoutbase asyncio scout_protocol)
target_include_directories(scoutbase PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
$<INSTALL_INTERFACE:include>
PRIVATE src)
## Add executables
if(BUILD_TESTS)
add_subdirectory(tests)
endif()

View File

@@ -1,16 +0,0 @@
# Dependency libraries
#find_package(LIBRARY_NAME REQUIRED)
# tests
add_executable(test_scout_base test_scout_base.cpp)
target_link_libraries(test_scout_base scoutbase)
# add_executable(test_scout_serial test_scout_serial.cpp)
# target_link_libraries(test_scout_serial scoutbase)
# add_executable(test_can_msg test_can_msg.cpp)
# target_link_libraries(test_can_msg scoutbase)
# add_executable(test_serial_parser test_serial_parser.cpp)
# target_link_libraries(test_serial_parser scoutbase)

View File

@@ -1,39 +0,0 @@
#include <iostream>
#include "scout_base/details/scout_can_parser.hpp"
using namespace wescore;
void print_msg(uint8_t data[8])
{
for (int i = 0; i < 8; ++i)
std::cout << std::hex << static_cast<int>(data[i]) << " ";
std::cout << std::dec << std::endl;
}
int main()
{
MotionControlMessage msg;
msg.msg.cmd.control_mode = CTRL_MODE_CMD_CAN;
msg.msg.cmd.fault_clear_flag = FAULT_CLR_NONE;
msg.msg.cmd.linear_velocity_cmd = 10;
msg.msg.cmd.angular_velocity_cmd = 0;
msg.msg.cmd.reserved0 = 0;
msg.msg.cmd.reserved1 = 0;
msg.msg.cmd.count = 0;
msg.msg.cmd.checksum = ScoutCANParser::Agilex_CANMsgChecksum(ScoutCANParser::CAN_MSG_MOTION_CONTROL_CMD_ID, msg.msg.raw, msg.len);
print_msg(msg.msg.raw);
LightControlMessage msg2;
msg2.msg.cmd.light_ctrl_enable = LIGHT_DISABLE_CTRL;
msg2.msg.cmd.front_light_mode = LIGHT_MODE_CONST_ON;
msg2.msg.cmd.front_light_custom = 0;
msg2.msg.cmd.rear_light_mode = LIGHT_MODE_CONST_ON;
msg2.msg.cmd.rear_light_custom = 0;
msg2.msg.cmd.reserved0 = 0;
msg2.msg.cmd.count = 0;
msg2.msg.cmd.checksum = ScoutCANParser::Agilex_CANMsgChecksum(ScoutCANParser::CAN_MSG_LIGHT_CONTROL_CMD_ID, msg2.msg.raw, msg2.len);
print_msg(msg2.msg.raw);
return 0;
}

View File

@@ -1,69 +0,0 @@
#include <unistd.h>
#include <thread>
#include <mutex>
#include <functional>
#include <string>
#include <iostream>
#include <chrono>
#include <cmath>
#include "scout_base/scout_base.hpp"
#define TEST_WITHOUT_SERIAL_HARDWARE
using namespace wescore;
int main(int argc, char **argv)
{
std::string device_name;
int32_t baud_rate = 0;
if (argc == 2)
{
device_name = {argv[1]};
std::cout << "Specified CAN: " << device_name << std::endl;
}
else if (argc == 3)
{
device_name = {argv[1]};
baud_rate = std::stol(argv[2]);
std::cout << "Specified serial: " << device_name << "@" << baud_rate << std::endl;
}
else
{
std::cout << "Usage: app_scout_monitor <interface>" << std::endl
<< "Example 1: ./app_scout_monitor can1"
<< "Example 2: ./app_scout_monitor /dev/ttyUSB0 115200" << std::endl;
return -1;
}
ScoutBase scout;
scout.Connect(device_name, baud_rate);
scout.SetLightCommand({ScoutLightCmd::LightMode::CONST_ON, 0, ScoutLightCmd::LightMode::CONST_ON, 0});
int count = 0;
while (true)
{
scout.SetMotionCommand(0.5, 0.2);
if(count == 10)
{
// scout.SetLightCommand({ScoutLightCmd::LightMode::LIGHT_MODE_CONST_OFF, 0, ScoutLightCmd::LightMode::LIGHT_MODE_CONST_OFF, 0});
scout.DisableLightCmdControl();
}
auto state = scout.GetScoutState();
std::cout << "-------------------------------" << std::endl;
std::cout << "control mode: " << static_cast<int>(state.control_mode) << " , base state: " << static_cast<int>(state.base_state) << std::endl;
std::cout << "battery voltage: " << state.battery_voltage << std::endl;
std::cout << "velocity (linear, angular): " << state.linear_velocity << ", " << state.angular_velocity << std::endl;
std::cout << "-------------------------------" << std::endl;
sleep(1);
++count;
}
return 0;
}

View File

@@ -1,45 +0,0 @@
#include <iostream>
#include "scout_base/details/scout_serial_parser.hpp"
using namespace wescore;
#include "scout_base/scout_base.hpp"
#define TEST_WITHOUT_SERIAL_HARDWARE
using namespace wescore;
int main(int argc, char **argv)
{
ScoutBase scout;
// scout.ConfigureCANBus("can1");
scout.Connect("/dev/ttyUSB0", 115200);
// scout.StartCmdThread(10);
// scout.SetLightCommand({ScoutLightCmd::LightMode::CONST_ON, 0, ScoutLightCmd::LightMode::CONST_ON, 0});
int count = 0;
while (true)
{
// scout.SetMotionCommand(0.5, 0.2);
// if(count == 10)
// {
// // scout.SetLightCommand({ScoutLightCmd::LightMode::LIGHT_MODE_CONST_OFF, 0, ScoutLightCmd::LightMode::LIGHT_MODE_CONST_OFF, 0});
// scout.DisableLightCmdControl();
// }
auto state = scout.GetScoutState();
std::cout << "-------------------------------" << std::endl;
std::cout << "control mode: " << static_cast<int>(state.control_mode) << " , base state: " << static_cast<int>(state.base_state) << std::endl;
std::cout << "battery voltage: " << state.battery_voltage << std::endl;
std::cout << "velocity (linear, angular): " << state.linear_velocity << ", " << state.angular_velocity << std::endl;
std::cout << "-------------------------------" << std::endl;
sleep(1);
++count;
}
return 0;
}

View File

@@ -1,51 +0,0 @@
#include <iostream>
#include "scout_base/details/scout_serial_parser.hpp"
using namespace wescore;
void print_msg(uint8_t data[8])
{
for (int i = 0; i < 8; ++i)
std::cout << std::hex << static_cast<int>(data[i]) << " ";
std::cout << std::dec << std::endl;
}
uint8_t calc_checksum(uint8_t *buf, uint8_t len)
{
uint8_t checksum = 0;
for (int i = 0; i < len; ++i)
checksum ^= buf[i];
return checksum;
}
int main()
{
uint8_t frame_data[16];
// SOF
frame_data[0] = 0x5a;
frame_data[1] = 0xa5;
// Frame len, type, ID
frame_data[2] = 0x0a;
frame_data[3] = 0xaa;
frame_data[4] = 0x01;
// Frame payload
frame_data[5] = 0;
frame_data[6] = 1;
frame_data[7] = 2;
frame_data[8] = 3;
frame_data[9] = 4;
frame_data[10] = 5;
// Frame count, checksum
frame_data[11] = 1;
frame_data[12] = calc_checksum(frame_data, 12);
ScoutSerialParser parser;
parser.ParseBuffer(frame_data, 7 + 6);
return 0;
}

View File

@@ -1,6 +0,0 @@
## Add sub source directories
add_subdirectory(asio)
if(BUILD_TESTS)
add_subdirectory(googletest)
endif()

View File

@@ -1,9 +0,0 @@
cmake_minimum_required(VERSION 3.0)
project(asio)
# ascent library
add_library(asio INTERFACE)
target_compile_definitions(asio INTERFACE "-DASIO_STANDALONE")
target_include_directories(asio INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

View File

@@ -1,4 +0,0 @@
Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -1,5 +0,0 @@
See doc/index.html for information on:
- External dependencies
- Using asio
- Supported platforms
- How to build the tests and examples

View File

@@ -1,23 +0,0 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@@ -1,19 +0,0 @@
AUTOMAKE_OPTIONS = foreign dist-bzip2 dist-zip
SUBDIRS = include src
MAINTAINERCLEANFILES = \
$(srcdir)/aclocal.m4 \
$(srcdir)/configure \
$(srcdir)/config.guess \
$(srcdir)/config.sub \
$(srcdir)/depcomp \
$(srcdir)/install-sh \
$(srcdir)/missing \
$(srcdir)/mkinstalldirs \
$(srcdir)/Makefile.in \
asio-*.tar.gz
EXTRA_DIST = \
LICENSE_1_0.txt \
doc

View File

@@ -1,778 +0,0 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in COPYING INSTALL README compile \
config.guess config.sub depcomp install-sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).zip
GZIP_ENV = --best
DIST_TARGETS = dist-bzip2 dist-gzip dist-zip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign dist-bzip2 dist-zip
SUBDIRS = include src
MAINTAINERCLEANFILES = \
$(srcdir)/aclocal.m4 \
$(srcdir)/configure \
$(srcdir)/config.guess \
$(srcdir)/config.sub \
$(srcdir)/depcomp \
$(srcdir)/install-sh \
$(srcdir)/missing \
$(srcdir)/mkinstalldirs \
$(srcdir)/Makefile.in \
asio-*.tar.gz
EXTRA_DIST = \
LICENSE_1_0.txt \
doc
all: all-recursive
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__post_remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(am__recursive_targets) install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -1,4 +0,0 @@
asio version 1.12.1
Released Sunday, 15 April 2018.
See doc/index.html for API documentation and a tutorial.

File diff suppressed because it is too large Load Diff

View File

@@ -1,343 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-03-05.13; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
# Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,186 +0,0 @@
AC_INIT(asio, [1.12.1])
AC_CONFIG_SRCDIR(include/asio.hpp)
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE([tar-ustar])
AC_CANONICAL_HOST
AM_PROG_CC_C_O
AC_PROG_CXX
AC_LANG(C++)
AC_PROG_RANLIB
AC_DEFINE(_REENTRANT, [1], [Define this])
AC_ARG_WITH(boost,
AC_HELP_STRING([--with-boost=DIR],[location of boost distribution]),
[
if test "${withval}" = no; then
STANDALONE="yes"
else
CPPFLAGS="$CPPFLAGS -I${withval} -DBOOST_CHRONO_HEADER_ONLY -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING"
LIBS="$LIBS -L${withval}/stage/lib"
fi
],
[
BOOSTDIR=`ls -1d ../boost_*_*_*/ 2>/dev/null | sort -t "_" -k 2nr -k 3nr -k 4nr | head -n 1 | sed -e 's/\/$//'`
if test "${BOOSTDIR}" != ""; then
BOOSTDIR="`pwd`/${BOOSTDIR}"
if test -d "${BOOSTDIR}"; then
echo "using automatically detected boost from ${BOOSTDIR}"
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR} -DBOOST_CHRONO_HEADER_ONLY -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING"
LIBS="$LIBS -L${BOOSTDIR}/stage/lib"
fi
fi
])
AC_ARG_ENABLE(separate-compilation,
[ --enable-separate-compilation separate compilation of asio source],
[
SEPARATE_COMPILATION=yes
])
AC_ARG_ENABLE(boost-coroutine,
[ --enable-boost-coroutine use Boost.Coroutine to implement stackful coroutines],
[
HAVE_BOOST_COROUTINE=yes
])
if test "$STANDALONE" != yes; then
AC_CHECK_HEADER([boost/noncopyable.hpp],,
[
echo "Can't find boost headers. Please check the location of the boost"
echo "distribution and rerun configure using the --with-boost=DIR option."
echo "Alternatively, run with --without-boost to enable standalone build."
exit 1
],[])
fi
AC_ARG_WITH(openssl,
AC_HELP_STRING([--with-openssl=DIR],[location of openssl]),
[
CPPFLAGS="$CPPFLAGS -I${withval}/include"
LIBS="$LIBS -L${withval}/lib"
],[])
AC_CHECK_HEADER([openssl/ssl.h],,
[
OPENSSL_FOUND=no
],[])
if test x$OPENSSL_FOUND != xno; then
LIBS="$LIBS -lssl -lcrypto"
fi
AM_CONDITIONAL(HAVE_OPENSSL,test x$OPENSSL_FOUND != xno)
WINDOWS=no
case $host in
*-*-linux*)
CXXFLAGS="$CXXFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
LIBS="$LIBS -lrt"
;;
*-*-solaris*)
if test "$GXX" = yes; then
CXXFLAGS="$CXXFLAGS -D_PTHREADS"
else
# We'll assume Sun's CC.
CXXFLAGS="$CXXFLAGS -mt"
fi
LIBS="$LIBS -lsocket -lnsl -lpthread"
;;
*-*-mingw32*)
CXXFLAGS="$CXXFLAGS -mthreads"
LDFLAGS="$LDFLAGS -mthreads"
LIBS="$LIBS -lws2_32 -lmswsock"
WINDOWS=yes
;;
*-*-mingw64*)
CXXFLAGS="$CXXFLAGS -mthreads"
LDFLAGS="$LDFLAGS -mthreads"
LIBS="$LIBS -lws2_32 -lmswsock"
WINDOWS=yes
;;
*-pc-cygwin*)
CXXFLAGS="$CXXFLAGS -D__USE_W32_SOCKETS -D_WIN32_WINNT=0x0501"
LIBS="$LIBS -lws2_32 -lmswsock"
WINDOWS=yes
;;
*-apple-darwin*)
CXXFLAGS="$CXXFLAGS"
LDFLAGS="$LDFLAGS"
;;
*-*-freebsd*)
CXXFLAGS="$CXXFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
;;
*-*-netbsd*)
CXXFLAGS="$CXXFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
;;
esac
if test "$GXX" = yes; then
CXXFLAGS="$CXXFLAGS -ftemplate-depth-256"
fi
if test "$STANDALONE" = yes; then
CPPFLAGS="$CPPFLAGS -DASIO_STANDALONE"
fi
if test "$SEPARATE_COMPILATION" = yes; then
CPPFLAGS="$CPPFLAGS -DASIO_SEPARATE_COMPILATION"
fi
AC_MSG_CHECKING([whether C++11 is enabled])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#if __cplusplus < 201103L]]
[[#error C++11 not available]]
[[#endif]])],
[AC_MSG_RESULT([yes])
HAVE_CXX11=yes;],
[AC_MSG_RESULT([no])
HAVE_CXX11=no;])
AC_MSG_CHECKING([whether C++14 is enabled])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#if __cplusplus < 201402L]]
[[#error C++14 not available]]
[[#endif]])],
[AC_MSG_RESULT([yes])
HAVE_CXX14=yes;],
[AC_MSG_RESULT([no])
HAVE_CXX14=no;])
if test "$GXX" = yes; then
if test "$STANDALONE" = yes; then
if test "$HAVE_CXX11" = no; then
HAVE_CXX11=yes
CPPFLAGS="-std=c++0x $CPPFLAGS"
fi
fi
fi
AM_CONDITIONAL(STANDALONE,test x$STANDALONE = xyes)
AM_CONDITIONAL(SEPARATE_COMPILATION,test x$SEPARATE_COMPILATION = xyes)
AM_CONDITIONAL(HAVE_BOOST_COROUTINE,test x$HAVE_BOOST_COROUTINE = xyes)
AM_CONDITIONAL(WINDOWS_TARGET,test x$WINDOWS != xno)
AM_CONDITIONAL(HAVE_CXX11,test x$HAVE_CXX11 = xyes)
AM_CONDITIONAL(HAVE_CXX14,test x$HAVE_CXX14 = xyes)
AC_OUTPUT([
Makefile
include/Makefile
src/Makefile
src/tests/Makefile
src/examples/cpp03/Makefile
src/examples/cpp11/Makefile
src/examples/cpp14/Makefile
src/examples/cpp17/Makefile])

View File

@@ -1,708 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2012-03-27.16; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# A tabulation character.
tab=' '
# A newline character.
nl='
'
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' "$nl" < "$tmpdepfile" |
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependent.h'.
# Do two passes, one to just change these to
# '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
# However on
# $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\':
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
# tcc 0.9.26 (FIXME still under development at the moment of writing)
# will emit a similar output, but also prepend the continuation lines
# with horizontal tabulation characters.
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form 'foo.o: dependent.h',
# or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
# Do two passes, one to just change these to
# '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
< "$tmpdepfile" > "$depfile"
sed '
s/[ '"$tab"'][ '"$tab"']*/ /g
s/^ *//
s/ *\\*$//
s/^[^:]*: *//
/^$/d
/:$/d
s/$/ :/
' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test "$stat" = 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' "$nl" < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -1,54 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Examples</title>
<link rel="stylesheet" href="../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../index.html" title="Asio">
<link rel="up" href="../index.html" title="Asio">
<link rel="prev" href="tutorial/boost_bind.html" title="boost::bind">
<link rel="next" href="examples/cpp03_examples.html" title="C++03 Examples">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="tutorial/boost_bind.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="examples/cpp03_examples.html"><img src="../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="asio.examples"></a><a class="link" href="examples.html" title="Examples">Examples</a>
</h2></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a class="link" href="examples/cpp03_examples.html" title="C++03 Examples">C++03 Examples</a>: Illustrates
the use of Asio using only C++03 language and library features. Where necessary,
the examples make use of selected Boost C++ libraries.
</li>
<li class="listitem">
<a class="link" href="examples/cpp11_examples.html" title="C++11 Examples">C++11 Examples</a>: Contains
a limited set of the C++03 Asio examples, updated to use only C++11 library
and language facilities. These examples do not make direct use of Boost
C++ libraries. To show the changes between C++03 and C++11, these examples
include a diff between the C++03 and C++11 versions.
</li>
<li class="listitem">
<a class="link" href="examples/cpp17_examples.html" title="C++17 Examples">C++17 Examples</a>: Selected
examples illustrating C++17 usage in conjunction with Technical Specifications.
</li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="tutorial/boost_bind.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="examples/cpp03_examples.html"><img src="../next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -1,635 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>C++03 Examples</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../index.html" title="Asio">
<link rel="up" href="../examples.html" title="Examples">
<link rel="prev" href="../examples.html" title="Examples">
<link rel="next" href="cpp11_examples.html" title="C++11 Examples">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp11_examples.html"><img src="../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="asio.examples.cpp03_examples"></a><a class="link" href="cpp03_examples.html" title="C++03 Examples">C++03 Examples</a>
</h3></div></div></div>
<h5>
<a name="asio.examples.cpp03_examples.h0"></a>
<span><a name="asio.examples.cpp03_examples.allocation"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.allocation">Allocation</a>
</h5>
<p>
This example shows how to customise the allocation of memory associated with
asynchronous operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/allocation/server.cpp" target="_top">../src/examples/cpp03/allocation/server.cpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h1"></a>
<span><a name="asio.examples.cpp03_examples.buffers"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.buffers">Buffers</a>
</h5>
<p>
This example demonstrates how to create reference counted buffers that can
be used with socket read and write operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/buffers/reference_counted.cpp" target="_top">../src/examples/cpp03/buffers/reference_counted.cpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h2"></a>
<span><a name="asio.examples.cpp03_examples.chat"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.chat">Chat</a>
</h5>
<p>
This example implements a chat server and client. The programs use a custom
protocol with a fixed length message header and variable length message body.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/chat/chat_message.hpp" target="_top">../src/examples/cpp03/chat/chat_message.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/chat/chat_client.cpp" target="_top">../src/examples/cpp03/chat/chat_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/chat/chat_server.cpp" target="_top">../src/examples/cpp03/chat/chat_server.cpp</a>
</li>
</ul></div>
<p>
The following POSIX-specific chat client demonstrates how to use the <a class="link" href="../reference/posix__stream_descriptor.html" title="posix::stream_descriptor">posix::stream_descriptor</a>
class to perform console input and output.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/chat/posix_chat_client.cpp" target="_top">../src/examples/cpp03/chat/posix_chat_client.cpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h3"></a>
<span><a name="asio.examples.cpp03_examples.echo"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.echo">Echo</a>
</h5>
<p>
A collection of simple clients and servers, showing the use of both synchronous
and asynchronous operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/echo/async_tcp_echo_server.cpp" target="_top">../src/examples/cpp03/echo/async_tcp_echo_server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/echo/async_udp_echo_server.cpp" target="_top">../src/examples/cpp03/echo/async_udp_echo_server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/echo/blocking_tcp_echo_client.cpp" target="_top">../src/examples/cpp03/echo/blocking_tcp_echo_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/echo/blocking_tcp_echo_server.cpp" target="_top">../src/examples/cpp03/echo/blocking_tcp_echo_server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/echo/blocking_udp_echo_client.cpp" target="_top">../src/examples/cpp03/echo/blocking_udp_echo_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/echo/blocking_udp_echo_server.cpp" target="_top">../src/examples/cpp03/echo/blocking_udp_echo_server.cpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h4"></a>
<span><a name="asio.examples.cpp03_examples.fork"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.fork">Fork</a>
</h5>
<p>
These POSIX-specific examples show how to use Asio in conjunction with the
<code class="computeroutput">fork()</code> system call. The first example illustrates the steps
required to start a daemon process:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/fork/daemon.cpp" target="_top">../src/examples/cpp03/fork/daemon.cpp</a>
</li></ul></div>
<p>
The second example demonstrates how it is possible to fork a process from
within a completion handler.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/fork/process_per_connection.cpp" target="_top">../src/examples/cpp03/fork/process_per_connection.cpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h5"></a>
<span><a name="asio.examples.cpp03_examples.http_client"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_client">HTTP
Client</a>
</h5>
<p>
Example programs implementing simple HTTP 1.0 clients. These examples show
how to use the <a class="link" href="../reference/read_until.html" title="read_until">read_until</a>
and <a class="link" href="../reference/async_read_until.html" title="async_read_until">async_read_until</a>
functions.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/http/client/sync_client.cpp" target="_top">../src/examples/cpp03/http/client/sync_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/client/async_client.cpp" target="_top">../src/examples/cpp03/http/client/async_client.cpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h6"></a>
<span><a name="asio.examples.cpp03_examples.http_server"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_server">HTTP
Server</a>
</h5>
<p>
This example illustrates the use of asio in a simple single-threaded server
implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown
by cancelling all outstanding asynchronous operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/connection.cpp" target="_top">../src/examples/cpp03/http/server/connection.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/connection.hpp" target="_top">../src/examples/cpp03/http/server/connection.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/connection_manager.cpp" target="_top">../src/examples/cpp03/http/server/connection_manager.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/connection_manager.hpp" target="_top">../src/examples/cpp03/http/server/connection_manager.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/header.hpp" target="_top">../src/examples/cpp03/http/server/header.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/main.cpp" target="_top">../src/examples/cpp03/http/server/main.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/mime_types.cpp" target="_top">../src/examples/cpp03/http/server/mime_types.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/mime_types.hpp" target="_top">../src/examples/cpp03/http/server/mime_types.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/reply.cpp" target="_top">../src/examples/cpp03/http/server/reply.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/reply.hpp" target="_top">../src/examples/cpp03/http/server/reply.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/request.hpp" target="_top">../src/examples/cpp03/http/server/request.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/request_handler.cpp" target="_top">../src/examples/cpp03/http/server/request_handler.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/request_handler.hpp" target="_top">../src/examples/cpp03/http/server/request_handler.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/request_parser.cpp" target="_top">../src/examples/cpp03/http/server/request_parser.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/request_parser.hpp" target="_top">../src/examples/cpp03/http/server/request_parser.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/server.cpp" target="_top">../src/examples/cpp03/http/server/server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server/server.hpp" target="_top">../src/examples/cpp03/http/server/server.hpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h7"></a>
<span><a name="asio.examples.cpp03_examples.http_server_2"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_server_2">HTTP
Server 2</a>
</h5>
<p>
An HTTP server using an io_context-per-CPU design.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/connection.cpp" target="_top">../src/examples/cpp03/http/server2/connection.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/connection.hpp" target="_top">../src/examples/cpp03/http/server2/connection.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/header.hpp" target="_top">../src/examples/cpp03/http/server2/header.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/io_context_pool.cpp" target="_top">../src/examples/cpp03/http/server2/io_context_pool.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/io_context_pool.hpp" target="_top">../src/examples/cpp03/http/server2/io_context_pool.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/main.cpp" target="_top">../src/examples/cpp03/http/server2/main.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/mime_types.cpp" target="_top">../src/examples/cpp03/http/server2/mime_types.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/mime_types.hpp" target="_top">../src/examples/cpp03/http/server2/mime_types.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/reply.cpp" target="_top">../src/examples/cpp03/http/server2/reply.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/reply.hpp" target="_top">../src/examples/cpp03/http/server2/reply.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/request.hpp" target="_top">../src/examples/cpp03/http/server2/request.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/request_handler.cpp" target="_top">../src/examples/cpp03/http/server2/request_handler.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/request_handler.hpp" target="_top">../src/examples/cpp03/http/server2/request_handler.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/request_parser.cpp" target="_top">../src/examples/cpp03/http/server2/request_parser.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/request_parser.hpp" target="_top">../src/examples/cpp03/http/server2/request_parser.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/server.cpp" target="_top">../src/examples/cpp03/http/server2/server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server2/server.hpp" target="_top">../src/examples/cpp03/http/server2/server.hpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h8"></a>
<span><a name="asio.examples.cpp03_examples.http_server_3"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_server_3">HTTP
Server 3</a>
</h5>
<p>
An HTTP server using a single io_context and a thread pool calling <code class="computeroutput">io_context::run()</code>.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/connection.cpp" target="_top">../src/examples/cpp03/http/server3/connection.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/connection.hpp" target="_top">../src/examples/cpp03/http/server3/connection.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/header.hpp" target="_top">../src/examples/cpp03/http/server3/header.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/main.cpp" target="_top">../src/examples/cpp03/http/server3/main.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/mime_types.cpp" target="_top">../src/examples/cpp03/http/server3/mime_types.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/mime_types.hpp" target="_top">../src/examples/cpp03/http/server3/mime_types.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/reply.cpp" target="_top">../src/examples/cpp03/http/server3/reply.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/reply.hpp" target="_top">../src/examples/cpp03/http/server3/reply.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/request.hpp" target="_top">../src/examples/cpp03/http/server3/request.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/request_handler.cpp" target="_top">../src/examples/cpp03/http/server3/request_handler.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/request_handler.hpp" target="_top">../src/examples/cpp03/http/server3/request_handler.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/request_parser.cpp" target="_top">../src/examples/cpp03/http/server3/request_parser.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/request_parser.hpp" target="_top">../src/examples/cpp03/http/server3/request_parser.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/server.cpp" target="_top">../src/examples/cpp03/http/server3/server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server3/server.hpp" target="_top">../src/examples/cpp03/http/server3/server.hpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h9"></a>
<span><a name="asio.examples.cpp03_examples.http_server_4"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.http_server_4">HTTP
Server 4</a>
</h5>
<p>
A single-threaded HTTP server implemented using stackless coroutines.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/file_handler.cpp" target="_top">../src/examples/cpp03/http/server4/file_handler.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/file_handler.hpp" target="_top">../src/examples/cpp03/http/server4/file_handler.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/header.hpp" target="_top">../src/examples/cpp03/http/server4/header.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/main.cpp" target="_top">../src/examples/cpp03/http/server4/main.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/mime_types.cpp" target="_top">../src/examples/cpp03/http/server4/mime_types.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/mime_types.hpp" target="_top">../src/examples/cpp03/http/server4/mime_types.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/reply.cpp" target="_top">../src/examples/cpp03/http/server4/reply.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/reply.hpp" target="_top">../src/examples/cpp03/http/server4/reply.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/request.hpp" target="_top">../src/examples/cpp03/http/server4/request.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/request_parser.cpp" target="_top">../src/examples/cpp03/http/server4/request_parser.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/request_parser.hpp" target="_top">../src/examples/cpp03/http/server4/request_parser.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/server.cpp" target="_top">../src/examples/cpp03/http/server4/server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/http/server4/server.hpp" target="_top">../src/examples/cpp03/http/server4/server.hpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h10"></a>
<span><a name="asio.examples.cpp03_examples.icmp"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.icmp">ICMP</a>
</h5>
<p>
This example shows how to use raw sockets with ICMP to ping a remote host.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/icmp/ping.cpp" target="_top">../src/examples/cpp03/icmp/ping.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/icmp/ipv4_header.hpp" target="_top">../src/examples/cpp03/icmp/ipv4_header.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/icmp/icmp_header.hpp" target="_top">../src/examples/cpp03/icmp/icmp_header.hpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h11"></a>
<span><a name="asio.examples.cpp03_examples.invocation"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.invocation">Invocation</a>
</h5>
<p>
This example shows how to customise handler invocation. Completion handlers
are added to a priority queue rather than executed immediately.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/invocation/prioritised_handlers.cpp" target="_top">../src/examples/cpp03/invocation/prioritised_handlers.cpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h12"></a>
<span><a name="asio.examples.cpp03_examples.iostreams"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.iostreams">Iostreams</a>
</h5>
<p>
Two examples showing how to use <a class="link" href="../reference/ip__tcp/iostream.html" title="ip::tcp::iostream">ip::tcp::iostream</a>.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/iostreams/daytime_client.cpp" target="_top">../src/examples/cpp03/iostreams/daytime_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/iostreams/daytime_server.cpp" target="_top">../src/examples/cpp03/iostreams/daytime_server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/iostreams/http_client.cpp" target="_top">../src/examples/cpp03/iostreams/http_client.cpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h13"></a>
<span><a name="asio.examples.cpp03_examples.multicast"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.multicast">Multicast</a>
</h5>
<p>
An example showing the use of multicast to transmit packets to a group of
subscribers.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/multicast/receiver.cpp" target="_top">../src/examples/cpp03/multicast/receiver.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/multicast/sender.cpp" target="_top">../src/examples/cpp03/multicast/sender.cpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h14"></a>
<span><a name="asio.examples.cpp03_examples.serialization"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.serialization">Serialization</a>
</h5>
<p>
This example shows how Boost.Serialization can be used with asio to encode
and decode structures for transmission over a socket.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/serialization/client.cpp" target="_top">../src/examples/cpp03/serialization/client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/serialization/connection.hpp" target="_top">../src/examples/cpp03/serialization/connection.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/serialization/server.cpp" target="_top">../src/examples/cpp03/serialization/server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/serialization/stock.hpp" target="_top">../src/examples/cpp03/serialization/stock.hpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h15"></a>
<span><a name="asio.examples.cpp03_examples.services"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.services">Services</a>
</h5>
<p>
This example demonstrates how to integrate custom functionality (in this
case, for logging) into asio's <a class="link" href="../reference/io_context.html" title="io_context">io_context</a>,
and how to use a custom service with <a class="link" href="../reference/basic_stream_socket.html" title="basic_stream_socket">basic_stream_socket&lt;&gt;</a>.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/services/basic_logger.hpp" target="_top">../src/examples/cpp03/services/basic_logger.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/services/daytime_client.cpp" target="_top">../src/examples/cpp03/services/daytime_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/services/logger.hpp" target="_top">../src/examples/cpp03/services/logger.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/services/logger_service.cpp" target="_top">../src/examples/cpp03/services/logger_service.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/services/logger_service.hpp" target="_top">../src/examples/cpp03/services/logger_service.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/services/stream_socket_service.hpp" target="_top">../src/examples/cpp03/services/stream_socket_service.hpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h16"></a>
<span><a name="asio.examples.cpp03_examples.socks_4"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.socks_4">SOCKS
4</a>
</h5>
<p>
Example client program implementing the SOCKS 4 protocol for communication
via a proxy.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/socks4/sync_client.cpp" target="_top">../src/examples/cpp03/socks4/sync_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/socks4/socks4.hpp" target="_top">../src/examples/cpp03/socks4/socks4.hpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h17"></a>
<span><a name="asio.examples.cpp03_examples.ssl"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.ssl">SSL</a>
</h5>
<p>
Example client and server programs showing the use of the <a class="link" href="../reference/ssl__stream.html" title="ssl::stream">ssl::stream&lt;&gt;</a>
template with asynchronous operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/ssl/client.cpp" target="_top">../src/examples/cpp03/ssl/client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/ssl/server.cpp" target="_top">../src/examples/cpp03/ssl/server.cpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h18"></a>
<span><a name="asio.examples.cpp03_examples.timeouts"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.timeouts">Timeouts</a>
</h5>
<p>
A collection of examples showing how to cancel long running asynchronous
operations after a period of time.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/timeouts/async_tcp_client.cpp" target="_top">../src/examples/cpp03/timeouts/async_tcp_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/timeouts/blocking_tcp_client.cpp" target="_top">../src/examples/cpp03/timeouts/blocking_tcp_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/timeouts/blocking_token_tcp_client.cpp" target="_top">../src/examples/cpp03/timeouts/blocking_token_tcp_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/timeouts/blocking_udp_client.cpp" target="_top">../src/examples/cpp03/timeouts/blocking_udp_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/timeouts/server.cpp" target="_top">../src/examples/cpp03/timeouts/server.cpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h19"></a>
<span><a name="asio.examples.cpp03_examples.timers"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.timers">Timers</a>
</h5>
<p>
Example showing how to customise basic_waitable_timer using a different clock
type.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/timers/time_t_timer.cpp" target="_top">../src/examples/cpp03/timers/time_t_timer.cpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h20"></a>
<span><a name="asio.examples.cpp03_examples.porthopper"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.porthopper">Porthopper</a>
</h5>
<p>
Example illustrating mixed synchronous and asynchronous operations, and how
to use Boost.Lambda with Asio.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/porthopper/protocol.hpp" target="_top">../src/examples/cpp03/porthopper/protocol.hpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/porthopper/client.cpp" target="_top">../src/examples/cpp03/porthopper/client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/porthopper/server.cpp" target="_top">../src/examples/cpp03/porthopper/server.cpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h21"></a>
<span><a name="asio.examples.cpp03_examples.nonblocking"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.nonblocking">Nonblocking</a>
</h5>
<p>
Example demonstrating reactor-style operations for integrating a third-party
library that wants to perform the I/O operations itself.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/nonblocking/third_party_lib.cpp" target="_top">../src/examples/cpp03/nonblocking/third_party_lib.cpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h22"></a>
<span><a name="asio.examples.cpp03_examples.spawn"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.spawn">Spawn</a>
</h5>
<p>
Example of using the asio::spawn() function, a wrapper around the <a href="http://www.boost.org/doc/libs/release/libs/coroutine/index.html" target="_top">Boost.Coroutine</a>
library, to implement a chain of asynchronous operations using stackful coroutines.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/spawn/echo_server.cpp" target="_top">../src/examples/cpp03/spawn/echo_server.cpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h23"></a>
<span><a name="asio.examples.cpp03_examples.unix_domain_sockets"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.unix_domain_sockets">UNIX
Domain Sockets</a>
</h5>
<p>
Examples showing how to use UNIX domain (local) sockets.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp03/local/connect_pair.cpp" target="_top">../src/examples/cpp03/local/connect_pair.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/local/iostream_client.cpp" target="_top">../src/examples/cpp03/local/iostream_client.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/local/stream_server.cpp" target="_top">../src/examples/cpp03/local/stream_server.cpp</a>
</li>
<li class="listitem">
<a href="../../../src/examples/cpp03/local/stream_client.cpp" target="_top">../src/examples/cpp03/local/stream_client.cpp</a>
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp03_examples.h24"></a>
<span><a name="asio.examples.cpp03_examples.windows"></a></span><a class="link" href="cpp03_examples.html#asio.examples.cpp03_examples.windows">Windows</a>
</h5>
<p>
An example showing how to use the Windows-specific function <code class="computeroutput">TransmitFile</code>
with Asio.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp03/windows/transmit_file.cpp" target="_top">../src/examples/cpp03/windows/transmit_file.cpp</a>
</li></ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp11_examples.html"><img src="../../next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -1,326 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>C++11 Examples</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../index.html" title="Asio">
<link rel="up" href="../examples.html" title="Examples">
<link rel="prev" href="cpp03_examples.html" title="C++03 Examples">
<link rel="next" href="cpp17_examples.html" title="C++17 Examples">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="cpp03_examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp17_examples.html"><img src="../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="asio.examples.cpp11_examples"></a><a class="link" href="cpp11_examples.html" title="C++11 Examples">C++11 Examples</a>
</h3></div></div></div>
<h5>
<a name="asio.examples.cpp11_examples.h0"></a>
<span><a name="asio.examples.cpp11_examples.allocation"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.allocation">Allocation</a>
</h5>
<p>
This example shows how to customise the allocation of memory associated with
asynchronous operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp11/allocation/server.cpp" target="_top">../src/examples/cpp11/allocation/server.cpp</a>
(<a href="../../examples/diffs/allocation/server.cpp.html" target="_top">diff to C++03</a>)
</li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h1"></a>
<span><a name="asio.examples.cpp11_examples.buffers"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.buffers">Buffers</a>
</h5>
<p>
This example demonstrates how to create reference counted buffers that can
be used with socket read and write operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp11/buffers/reference_counted.cpp" target="_top">../src/examples/cpp11/buffers/reference_counted.cpp</a>
(<a href="../../examples/diffs/buffers/reference_counted.cpp.html" target="_top">diff
to C++03</a>)
</li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h2"></a>
<span><a name="asio.examples.cpp11_examples.chat"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.chat">Chat</a>
</h5>
<p>
This example implements a chat server and client. The programs use a custom
protocol with a fixed length message header and variable length message body.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp11/chat/chat_message.hpp" target="_top">../src/examples/cpp11/chat/chat_message.hpp</a>
(<a href="../../examples/diffs/chat/chat_message.hpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/chat/chat_client.cpp" target="_top">../src/examples/cpp11/chat/chat_client.cpp</a>
(<a href="../../examples/diffs/chat/chat_client.cpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/chat/chat_server.cpp" target="_top">../src/examples/cpp11/chat/chat_server.cpp</a>
(<a href="../../examples/diffs/chat/chat_server.cpp.html" target="_top">diff to C++03</a>)
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h3"></a>
<span><a name="asio.examples.cpp11_examples.echo"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.echo">Echo</a>
</h5>
<p>
A collection of simple clients and servers, showing the use of both synchronous
and asynchronous operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp11/echo/async_tcp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/async_tcp_echo_server.cpp</a>
(<a href="../../examples/diffs/echo/async_tcp_echo_server.cpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/echo/async_udp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/async_udp_echo_server.cpp</a>
(<a href="../../examples/diffs/echo/async_udp_echo_server.cpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/echo/blocking_tcp_echo_client.cpp" target="_top">../src/examples/cpp11/echo/blocking_tcp_echo_client.cpp</a>
(<a href="../../examples/diffs/echo/blocking_tcp_echo_client.cpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/echo/blocking_tcp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/blocking_tcp_echo_server.cpp</a>
(<a href="../../examples/diffs/echo/blocking_tcp_echo_server.cpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/echo/blocking_udp_echo_client.cpp" target="_top">../src/examples/cpp11/echo/blocking_udp_echo_client.cpp</a>
(<a href="../../examples/diffs/echo/blocking_udp_echo_client.cpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/echo/blocking_udp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/blocking_udp_echo_server.cpp</a>
(<a href="../../examples/diffs/echo/blocking_udp_echo_server.cpp.html" target="_top">diff
to C++03</a>)
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h4"></a>
<span><a name="asio.examples.cpp11_examples.fork"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.fork">Fork</a>
</h5>
<p>
These POSIX-specific examples show how to use Asio in conjunction with the
<code class="computeroutput">fork()</code> system call. The first example illustrates the steps
required to start a daemon process:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp11/fork/daemon.cpp" target="_top">../src/examples/cpp11/fork/daemon.cpp</a>
(<a href="../../examples/diffs/fork/daemon.cpp.html" target="_top">diff to C++03</a>)
</li></ul></div>
<p>
The second example demonstrates how it is possible to fork a process from
within a completion handler.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp11/fork/process_per_connection.cpp" target="_top">../src/examples/cpp11/fork/process_per_connection.cpp</a>
(<a href="../../examples/diffs/fork/process_per_connection.cpp.html" target="_top">diff
to C++03</a>)
</li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h5"></a>
<span><a name="asio.examples.cpp11_examples.futures"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.futures">Futures</a>
</h5>
<p>
This example demonstrates how to use std::future in conjunction with Asio's
asynchronous operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp11/futures/daytime_client.cpp" target="_top">../src/examples/cpp11/futures/daytime_client.cpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h6"></a>
<span><a name="asio.examples.cpp11_examples.handler_tracking"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.handler_tracking">Handler
Tracking</a>
</h5>
<p>
This example shows how to implement custom handler tracking.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp11/handler_tracking/custom_tracking.hpp" target="_top">../src/examples/cpp11/handler_tracking/custom_tracking.hpp</a>
</li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h7"></a>
<span><a name="asio.examples.cpp11_examples.http_server"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.http_server">HTTP
Server</a>
</h5>
<p>
This example illustrates the use of asio in a simple single-threaded server
implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown
by cancelling all outstanding asynchronous operations.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/connection.cpp" target="_top">../src/examples/cpp11/http/server/connection.cpp</a>
(<a href="../../examples/diffs/http/server/connection.cpp.html" target="_top">diff to
C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/connection.hpp" target="_top">../src/examples/cpp11/http/server/connection.hpp</a>
(<a href="../../examples/diffs/http/server/connection.hpp.html" target="_top">diff to
C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/connection_manager.cpp" target="_top">../src/examples/cpp11/http/server/connection_manager.cpp</a>
(<a href="../../examples/diffs/http/server/connection_manager.cpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/connection_manager.hpp" target="_top">../src/examples/cpp11/http/server/connection_manager.hpp</a>
(<a href="../../examples/diffs/http/server/connection_manager.hpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/header.hpp" target="_top">../src/examples/cpp11/http/server/header.hpp</a>
(<a href="../../examples/diffs/http/server/header.hpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/main.cpp" target="_top">../src/examples/cpp11/http/server/main.cpp</a>
(<a href="../../examples/diffs/http/server/main.cpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/mime_types.cpp" target="_top">../src/examples/cpp11/http/server/mime_types.cpp</a>
(<a href="../../examples/diffs/http/server/mime_types.cpp.html" target="_top">diff to
C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/mime_types.hpp" target="_top">../src/examples/cpp11/http/server/mime_types.hpp</a>
(<a href="../../examples/diffs/http/server/mime_types.hpp.html" target="_top">diff to
C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/reply.cpp" target="_top">../src/examples/cpp11/http/server/reply.cpp</a>
(<a href="../../examples/diffs/http/server/reply.cpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/reply.hpp" target="_top">../src/examples/cpp11/http/server/reply.hpp</a>
(<a href="../../examples/diffs/http/server/reply.hpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/request.hpp" target="_top">../src/examples/cpp11/http/server/request.hpp</a>
(<a href="../../examples/diffs/http/server/request.hpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/request_handler.cpp" target="_top">../src/examples/cpp11/http/server/request_handler.cpp</a>
(<a href="../../examples/diffs/http/server/request_handler.cpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/request_handler.hpp" target="_top">../src/examples/cpp11/http/server/request_handler.hpp</a>
(<a href="../../examples/diffs/http/server/request_handler.hpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/request_parser.cpp" target="_top">../src/examples/cpp11/http/server/request_parser.cpp</a>
(<a href="../../examples/diffs/http/server/request_parser.cpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/request_parser.hpp" target="_top">../src/examples/cpp11/http/server/request_parser.hpp</a>
(<a href="../../examples/diffs/http/server/request_parser.hpp.html" target="_top">diff
to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/server.cpp" target="_top">../src/examples/cpp11/http/server/server.cpp</a>
(<a href="../../examples/diffs/http/server/server.cpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/http/server/server.hpp" target="_top">../src/examples/cpp11/http/server/server.hpp</a>
(<a href="../../examples/diffs/http/server/server.hpp.html" target="_top">diff to C++03</a>)
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h8"></a>
<span><a name="asio.examples.cpp11_examples.multicast"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.multicast">Multicast</a>
</h5>
<p>
An example showing the use of multicast to transmit packets to a group of
subscribers.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp11/multicast/receiver.cpp" target="_top">../src/examples/cpp11/multicast/receiver.cpp</a>
(<a href="../../examples/diffs/multicast/receiver.cpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/multicast/sender.cpp" target="_top">../src/examples/cpp11/multicast/sender.cpp</a>
(<a href="../../examples/diffs/multicast/sender.cpp.html" target="_top">diff to C++03</a>)
</li>
</ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h9"></a>
<span><a name="asio.examples.cpp11_examples.nonblocking"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.nonblocking">Nonblocking</a>
</h5>
<p>
Example demonstrating reactor-style operations for integrating a third-party
library that wants to perform the I/O operations itself.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp11/nonblocking/third_party_lib.cpp" target="_top">../src/examples/cpp11/nonblocking/third_party_lib.cpp</a>
(<a href="../../examples/diffs/nonblocking/third_party_lib.cpp.html" target="_top">diff
to C++03</a>)
</li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h10"></a>
<span><a name="asio.examples.cpp11_examples.spawn"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.spawn">Spawn</a>
</h5>
<p>
Example of using the asio::spawn() function, a wrapper around the <a href="http://www.boost.org/doc/libs/release/libs/coroutine/index.html" target="_top">Boost.Coroutine</a>
library, to implement a chain of asynchronous operations using stackful coroutines.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a href="../../../src/examples/cpp11/spawn/echo_server.cpp" target="_top">../src/examples/cpp11/spawn/echo_server.cpp</a>
(<a href="../../examples/diffs/spawn/echo_server.cpp.html" target="_top">diff to C++03</a>)
</li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h11"></a>
<span><a name="asio.examples.cpp11_examples.unix_domain_sockets"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.unix_domain_sockets">UNIX
Domain Sockets</a>
</h5>
<p>
Examples showing how to use UNIX domain (local) sockets.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../../../src/examples/cpp11/local/connect_pair.cpp" target="_top">../src/examples/cpp11/local/connect_pair.cpp</a>
(<a href="../../examples/diffs/local/connect_pair.cpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/local/iostream_client.cpp" target="_top">../src/examples/cpp11/local/iostream_client.cpp</a>
(<a href="../../examples/diffs/local/iostream_client.cpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/local/stream_server.cpp" target="_top">../src/examples/cpp11/local/stream_server.cpp</a>
(<a href="../../examples/diffs/local/stream_server.cpp.html" target="_top">diff to C++03</a>)
</li>
<li class="listitem">
<a href="../../../src/examples/cpp11/local/stream_client.cpp" target="_top">../src/examples/cpp11/local/stream_client.cpp</a>
(<a href="../../examples/diffs/local/stream_client.cpp.html" target="_top">diff to C++03</a>)
</li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="cpp03_examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="cpp17_examples.html"><img src="../../next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -1,62 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>C++17 Examples</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../index.html" title="Asio">
<link rel="up" href="../examples.html" title="Examples">
<link rel="prev" href="cpp11_examples.html" title="C++11 Examples">
<link rel="next" href="../reference.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="cpp11_examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="asio.examples.cpp17_examples"></a><a class="link" href="cpp17_examples.html" title="C++17 Examples">C++17 Examples</a>
</h3></div></div></div>
<h5>
<a name="asio.examples.cpp17_examples.h0"></a>
<span><a name="asio.examples.cpp17_examples.coroutines_ts_support"></a></span><a class="link" href="cpp17_examples.html#asio.examples.cpp17_examples.coroutines_ts_support">Coroutines
TS Support</a>
</h5>
<p>
Examples showing how to implement a chain of asynchronous operations using
the Coroutines TS.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a href="../example/cpp17/coroutines_ts/echo_server.cpp" target="_top">asio/example/cpp17/coroutines_ts/echo_server.cpp</a>
</li>
<li class="listitem">
<a href="../example/cpp17/coroutines_ts/refactored_echo_server.cpp" target="_top">asio/example/cpp17/coroutines_ts/refactored_echo_server.cpp</a>
</li>
<li class="listitem">
<a href="../example/cpp17/coroutines_ts/double_buffered_echo_server.cpp" target="_top">asio/example/cpp17/coroutines_ts/double_buffered_echo_server.cpp</a>
</li>
<li class="listitem">
<a href="../example/cpp17/coroutines_ts/chat_server.cpp" target="_top">asio/example/cpp17/coroutines_ts/chat_server.cpp</a>
</li>
<li class="listitem">
<a href="../example/cpp17/coroutines_ts/range_based_for.cpp" target="_top">asio/example/cpp17/coroutines_ts/range_based_for.cpp</a>
</li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="cpp11_examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../next.png" alt="Next"></a>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,155 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Overview</title>
<link rel="stylesheet" href="../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../index.html" title="Asio">
<link rel="up" href="../index.html" title="Asio">
<link rel="prev" href="../index.html" title="Asio">
<link rel="next" href="overview/rationale.html" title="Rationale">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../index.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="overview/rationale.html"><img src="../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="asio.overview"></a><a class="link" href="overview.html" title="Overview">Overview</a>
</h2></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a class="link" href="overview/rationale.html" title="Rationale">Rationale</a>
</li>
<li class="listitem">
<a class="link" href="overview/core.html" title="Core Concepts and Functionality">Core Concepts and Functionality</a>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
<a class="link" href="overview/core/basics.html" title="Basic Asio Anatomy">Basic Asio Anatomy</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/async.html" title="The Proactor Design Pattern: Concurrency Without Threads">The Proactor Design Pattern:
Concurrency Without Threads</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/threads.html" title="Threads and Asio">Threads and Asio</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/strands.html" title="Strands: Use Threads Without Explicit Locking">Strands: Use Threads Without
Explicit Locking</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/buffers.html" title="Buffers">Buffers</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/streams.html" title="Streams, Short Reads and Short Writes">Streams, Short Reads and
Short Writes</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/reactor.html" title="Reactor-Style Operations">Reactor-Style Operations</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/line_based.html" title="Line-Based Operations">Line-Based Operations</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/allocation.html" title="Custom Memory Allocation">Custom Memory Allocation</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/handler_tracking.html" title="Handler Tracking">Handler Tracking</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/concurrency_hint.html" title="Concurrency Hints">Concurrency Hints</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/coroutine.html" title="Stackless Coroutines">Stackless Coroutines</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/spawn.html" title="Stackful Coroutines">Stackful Coroutines</a>
</li>
<li class="listitem">
<a class="link" href="overview/core/coroutines_ts.html" title="Coroutines TS Support (experimental)">Coroutines TS Support
(experimental)</a>
</li>
</ul></div>
</li>
<li class="listitem">
<a class="link" href="overview/networking.html" title="Networking">Networking</a>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
<a class="link" href="overview/networking/protocols.html" title="TCP, UDP and ICMP">TCP, UDP and ICMP</a>
</li>
<li class="listitem">
<a class="link" href="overview/networking/other_protocols.html" title="Support for Other Protocols">Support
for Other Protocols</a>
</li>
<li class="listitem">
<a class="link" href="overview/networking/iostreams.html" title="Socket Iostreams">Socket Iostreams</a>
</li>
<li class="listitem">
<a class="link" href="overview/networking/bsd_sockets.html" title="The BSD Socket API and Asio">The BSD Socket
API and Asio</a>
</li>
</ul></div>
</li>
<li class="listitem">
<a class="link" href="overview/timers.html" title="Timers">Timers</a>
</li>
<li class="listitem">
<a class="link" href="overview/serial_ports.html" title="Serial Ports">Serial Ports</a>
</li>
<li class="listitem">
<a class="link" href="overview/signals.html" title="Signal Handling">Signal Handling</a>
</li>
<li class="listitem">
<a class="link" href="overview/posix.html" title="POSIX-Specific Functionality">POSIX-Specific Functionality</a>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
<a class="link" href="overview/posix/local.html" title="UNIX Domain Sockets">UNIX Domain Sockets</a>
</li>
<li class="listitem">
<a class="link" href="overview/posix/stream_descriptor.html" title="Stream-Oriented File Descriptors">Stream-Oriented
File Descriptors</a>
</li>
</ul></div>
</li>
<li class="listitem">
<a class="link" href="overview/windows.html" title="Windows-Specific Functionality">Windows-Specific Functionality</a>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
<a class="link" href="overview/windows/stream_handle.html" title="Stream-Oriented HANDLEs">Stream-Oriented
HANDLEs</a>
</li>
<li class="listitem">
<a class="link" href="overview/windows/random_access_handle.html" title="Random-Access HANDLEs">Random-Access
HANDLEs</a>
</li>
</ul></div>
</li>
<li class="listitem">
<a class="link" href="overview/ssl.html" title="SSL">SSL</a>
</li>
<li class="listitem">
<a class="link" href="overview/cpp2011.html" title="C++ 2011 Support">C++ 2011 Support</a>
</li>
<li class="listitem">
<a class="link" href="overview/implementation.html" title="Platform-Specific Implementation Notes">Platform-Specific Implementation
Notes</a>
</li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../index.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="overview/rationale.html"><img src="../next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -1,84 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Core Concepts and Functionality</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../index.html" title="Asio">
<link rel="up" href="../overview.html" title="Overview">
<link rel="prev" href="rationale.html" title="Rationale">
<link rel="next" href="core/basics.html" title="Basic Asio Anatomy">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="rationale.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="core/basics.html"><img src="../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="asio.overview.core"></a><a class="link" href="core.html" title="Core Concepts and Functionality">Core Concepts and Functionality</a>
</h3></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<a class="link" href="core/basics.html" title="Basic Asio Anatomy">Basic Asio Anatomy</a>
</li>
<li class="listitem">
<a class="link" href="core/async.html" title="The Proactor Design Pattern: Concurrency Without Threads">The Proactor Design Pattern:
Concurrency Without Threads</a>
</li>
<li class="listitem">
<a class="link" href="core/threads.html" title="Threads and Asio">Threads and Asio</a>
</li>
<li class="listitem">
<a class="link" href="core/strands.html" title="Strands: Use Threads Without Explicit Locking">Strands: Use Threads Without
Explicit Locking</a>
</li>
<li class="listitem">
<a class="link" href="core/buffers.html" title="Buffers">Buffers</a>
</li>
<li class="listitem">
<a class="link" href="core/streams.html" title="Streams, Short Reads and Short Writes">Streams, Short Reads and Short
Writes</a>
</li>
<li class="listitem">
<a class="link" href="core/reactor.html" title="Reactor-Style Operations">Reactor-Style Operations</a>
</li>
<li class="listitem">
<a class="link" href="core/line_based.html" title="Line-Based Operations">Line-Based Operations</a>
</li>
<li class="listitem">
<a class="link" href="core/allocation.html" title="Custom Memory Allocation">Custom Memory Allocation</a>
</li>
<li class="listitem">
<a class="link" href="core/handler_tracking.html" title="Handler Tracking">Handler Tracking</a>
</li>
<li class="listitem">
<a class="link" href="core/concurrency_hint.html" title="Concurrency Hints">Concurrency Hints</a>
</li>
<li class="listitem">
<a class="link" href="core/coroutine.html" title="Stackless Coroutines">Stackless Coroutines</a>
</li>
<li class="listitem">
<a class="link" href="core/spawn.html" title="Stackful Coroutines">Stackful Coroutines</a>
</li>
<li class="listitem">
<a class="link" href="core/coroutines_ts.html" title="Coroutines TS Support (experimental)">Coroutines TS Support
(experimental)</a>
</li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="rationale.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="core/basics.html"><img src="../../next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -1,135 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Custom Memory Allocation</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="Asio">
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
<link rel="prev" href="line_based.html" title="Line-Based Operations">
<link rel="next" href="handler_tracking.html" title="Handler Tracking">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="line_based.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="handler_tracking.html"><img src="../../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="asio.overview.core.allocation"></a><a class="link" href="allocation.html" title="Custom Memory Allocation">Custom Memory Allocation</a>
</h4></div></div></div>
<p>
Many asynchronous operations need to allocate an object to store state
associated with the operation. For example, a Win32 implementation needs
<code class="computeroutput"><span class="identifier">OVERLAPPED</span></code>-derived objects
to pass to Win32 API functions.
</p>
<p>
Furthermore, programs typically contain easily identifiable chains of asynchronous
operations. A half duplex protocol implementation (e.g. an HTTP server)
would have a single chain of operations per client (receives followed by
sends). A full duplex protocol implementation would have two chains executing
in parallel. Programs should be able to leverage this knowledge to reuse
memory for all asynchronous operations in a chain.
</p>
<p>
Given a copy of a user-defined <code class="computeroutput"><span class="identifier">Handler</span></code>
object <code class="computeroutput"><span class="identifier">h</span></code>, if the implementation
needs to allocate memory associated with that handler it will obtain an
allocator using the <code class="computeroutput"><span class="identifier">get_associated_allocator</span></code>
function. For example:
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">associated_allocator_t</span><span class="special">&lt;</span><span class="identifier">Handler</span><span class="special">&gt;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">get_associated_allocator</span><span class="special">(</span><span class="identifier">h</span><span class="special">);</span>
</pre>
<p>
The associated allocator must satisfy the standard Allocator requirements.
</p>
<p>
By default, handlers use the standard allocator (which is implemented in
terms of <code class="computeroutput"><span class="special">::</span><span class="keyword">operator</span>
<span class="keyword">new</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="special">::</span><span class="keyword">operator</span>
<span class="keyword">delete</span><span class="special">()</span></code>).
The allocator may be customised for a particular handler type by specifying
a nested type <code class="computeroutput"><span class="identifier">allocator_type</span></code>
and member function <code class="computeroutput"><span class="identifier">get_allocator</span><span class="special">()</span></code>:
</p>
<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">my_handler</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="comment">// Custom implementation of Allocator type requirements.</span>
<span class="keyword">typedef</span> <span class="identifier">my_allocator</span> <span class="identifier">allocator_type</span><span class="special">;</span>
<span class="comment">// Return a custom allocator implementation.</span>
<span class="identifier">allocator_type</span> <span class="identifier">get_allocator</span><span class="special">()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">my_allocator</span><span class="special">();</span>
<span class="special">}</span>
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()()</span> <span class="special">{</span> <span class="special">...</span> <span class="special">}</span>
<span class="special">};</span>
</pre>
<p>
In more complex cases, the <code class="computeroutput"><span class="identifier">associated_allocator</span></code>
template may be partially specialised directly:
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">asio</span> <span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Allocator</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">associated_allocator</span><span class="special">&lt;</span><span class="identifier">my_handler</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span>
<span class="special">{</span>
<span class="comment">// Custom implementation of Allocator type requirements.</span>
<span class="keyword">typedef</span> <span class="identifier">my_allocator</span> <span class="identifier">type</span><span class="special">;</span>
<span class="comment">// Return a custom allocator implementation.</span>
<span class="keyword">static</span> <span class="identifier">type</span> <span class="identifier">get</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">my_handler</span><span class="special">&amp;,</span>
<span class="keyword">const</span> <span class="identifier">Allocator</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">Allocator</span><span class="special">())</span> <span class="keyword">noexcept</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">my_allocator</span><span class="special">();</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="special">}</span> <span class="comment">// namespace asio</span>
</pre>
<p>
The implementation guarantees that the deallocation will occur before the
associated handler is invoked, which means the memory is ready to be reused
for any new asynchronous operations started by the handler.
</p>
<p>
The custom memory allocation functions may be called from any user-created
thread that is calling a library function. The implementation guarantees
that, for the asynchronous operations included the library, the implementation
will not make concurrent calls to the memory allocation functions for that
handler. The implementation will insert appropriate memory barriers to
ensure correct memory visibility should allocation functions need to be
called from different threads.
</p>
<h6>
<a name="asio.overview.core.allocation.h0"></a>
<span><a name="asio.overview.core.allocation.see_also"></a></span><a class="link" href="allocation.html#asio.overview.core.allocation.see_also">See
Also</a>
</h6>
<p>
<a class="link" href="../../reference/associated_allocator.html" title="associated_allocator">associated_allocator</a>,
<a class="link" href="../../reference/get_associated_allocator.html" title="get_associated_allocator">get_associated_allocator</a>,
<a class="link" href="../../examples/cpp03_examples.html#asio.examples.cpp03_examples.allocation">custom memory allocation
example (C++03)</a>, <a class="link" href="../../examples/cpp11_examples.html#asio.examples.cpp11_examples.allocation">custom
memory allocation example (C++11)</a>.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="line_based.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="handler_tracking.html"><img src="../../../next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -1,279 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>The Proactor Design Pattern: Concurrency Without Threads</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="Asio">
<link rel="up" href="../core.html" title="Core Concepts and Functionality">
<link rel="prev" href="basics.html" title="Basic Asio Anatomy">
<link rel="next" href="threads.html" title="Threads and Asio">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="basics.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="threads.html"><img src="../../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="asio.overview.core.async"></a><a class="link" href="async.html" title="The Proactor Design Pattern: Concurrency Without Threads">The Proactor Design Pattern:
Concurrency Without Threads</a>
</h4></div></div></div>
<p>
The Asio library offers side-by-side support for synchronous and asynchronous
operations. The asynchronous support is based on the Proactor design pattern
<a class="link" href="async.html#asio.overview.core.async.references">[POSA2]</a>. The
advantages and disadvantages of this approach, when compared to a synchronous-only
or Reactor approach, are outlined below.
</p>
<h6>
<a name="asio.overview.core.async.h0"></a>
<span><a name="asio.overview.core.async.proactor_and_asio"></a></span><a class="link" href="async.html#asio.overview.core.async.proactor_and_asio">Proactor
and Asio</a>
</h6>
<p>
Let us examine how the Proactor design pattern is implemented in Asio,
without reference to platform-specific details.
</p>
<p>
<span class="inlinemediaobject"><img src="../../../proactor.png" alt="proactor"></span>
</p>
<p>
<span class="bold"><strong>Proactor design pattern (adapted from [POSA2])</strong></span>
</p>
<p>
&#8212; Asynchronous Operation
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Defines an operation that is executed asynchronously, such as an asynchronous
read or write on a socket.
</p></blockquote></div>
<p>
&#8212; Asynchronous Operation Processor
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Executes asynchronous operations and queues events on a completion event
queue when operations complete. From a high-level point of view, internal
services like <code class="computeroutput"><span class="identifier">reactive_socket_service</span></code>
are asynchronous operation processors.
</p></blockquote></div>
<p>
&#8212; Completion Event Queue
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Buffers completion events until they are dequeued by an asynchronous
event demultiplexer.
</p></blockquote></div>
<p>
&#8212; Completion Handler
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Processes the result of an asynchronous operation. These are function
objects, often created using <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code>.
</p></blockquote></div>
<p>
&#8212; Asynchronous Event Demultiplexer
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Blocks waiting for events to occur on the completion event queue, and
returns a completed event to its caller.
</p></blockquote></div>
<p>
&#8212; Proactor
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Calls the asynchronous event demultiplexer to dequeue events, and dispatches
the completion handler (i.e. invokes the function object) associated
with the event. This abstraction is represented by the <code class="computeroutput"><span class="identifier">io_context</span></code> class.
</p></blockquote></div>
<p>
&#8212; Initiator
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Application-specific code that starts asynchronous operations. The initiator
interacts with an asynchronous operation processor via a high-level interface
such as <code class="computeroutput"><span class="identifier">basic_stream_socket</span></code>,
which in turn delegates to a service like <code class="computeroutput"><span class="identifier">reactive_socket_service</span></code>.
</p></blockquote></div>
<h6>
<a name="asio.overview.core.async.h1"></a>
<span><a name="asio.overview.core.async.implementation_using_reactor"></a></span><a class="link" href="async.html#asio.overview.core.async.implementation_using_reactor">Implementation
Using Reactor</a>
</h6>
<p>
On many platforms, Asio implements the Proactor design pattern in terms
of a Reactor, such as <code class="computeroutput"><span class="identifier">select</span></code>,
<code class="computeroutput"><span class="identifier">epoll</span></code> or <code class="computeroutput"><span class="identifier">kqueue</span></code>. This implementation approach
corresponds to the Proactor design pattern as follows:
</p>
<p>
&#8212; Asynchronous Operation Processor
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
A reactor implemented using <code class="computeroutput"><span class="identifier">select</span></code>,
<code class="computeroutput"><span class="identifier">epoll</span></code> or <code class="computeroutput"><span class="identifier">kqueue</span></code>. When the reactor indicates
that the resource is ready to perform the operation, the processor executes
the asynchronous operation and enqueues the associated completion handler
on the completion event queue.
</p></blockquote></div>
<p>
&#8212; Completion Event Queue
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
A linked list of completion handlers (i.e. function objects).
</p></blockquote></div>
<p>
&#8212; Asynchronous Event Demultiplexer
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
This is implemented by waiting on an event or condition variable until
a completion handler is available in the completion event queue.
</p></blockquote></div>
<h6>
<a name="asio.overview.core.async.h2"></a>
<span><a name="asio.overview.core.async.implementation_using_windows_overlapped_i_o"></a></span><a class="link" href="async.html#asio.overview.core.async.implementation_using_windows_overlapped_i_o">Implementation
Using Windows Overlapped I/O</a>
</h6>
<p>
On Windows NT, 2000 and XP, Asio takes advantage of overlapped I/O to provide
an efficient implementation of the Proactor design pattern. This implementation
approach corresponds to the Proactor design pattern as follows:
</p>
<p>
&#8212; Asynchronous Operation Processor
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
This is implemented by the operating system. Operations are initiated
by calling an overlapped function such as <code class="computeroutput"><span class="identifier">AcceptEx</span></code>.
</p></blockquote></div>
<p>
&#8212; Completion Event Queue
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
This is implemented by the operating system, and is associated with an
I/O completion port. There is one I/O completion port for each <code class="computeroutput"><span class="identifier">io_context</span></code> instance.
</p></blockquote></div>
<p>
&#8212; Asynchronous Event Demultiplexer
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Called by Asio to dequeue events and their associated completion handlers.
</p></blockquote></div>
<h6>
<a name="asio.overview.core.async.h3"></a>
<span><a name="asio.overview.core.async.advantages"></a></span><a class="link" href="async.html#asio.overview.core.async.advantages">Advantages</a>
</h6>
<p>
&#8212; Portability.
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Many operating systems offer a native asynchronous I/O API (such as overlapped
I/O on <span class="emphasis"><em>Windows</em></span>) as the preferred option for developing
high performance network applications. The library may be implemented
in terms of native asynchronous I/O. However, if native support is not
available, the library may also be implemented using synchronous event
demultiplexors that typify the Reactor pattern, such as <span class="emphasis"><em>POSIX</em></span>
<code class="computeroutput"><span class="identifier">select</span><span class="special">()</span></code>.
</p></blockquote></div>
<p>
&#8212; Decoupling threading from concurrency.
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Long-duration operations are performed asynchronously by the implementation
on behalf of the application. Consequently applications do not need to
spawn many threads in order to increase concurrency.
</p></blockquote></div>
<p>
&#8212; Performance and scalability.
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Implementation strategies such as thread-per-connection (which a synchronous-only
approach would require) can degrade system performance, due to increased
context switching, synchronisation and data movement among CPUs. With
asynchronous operations it is possible to avoid the cost of context switching
by minimising the number of operating system threads &#8212; typically a limited
resource &#8212; and only activating the logical threads of control that have
events to process.
</p></blockquote></div>
<p>
&#8212; Simplified application synchronisation.
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Asynchronous operation completion handlers can be written as though they
exist in a single-threaded environment, and so application logic can
be developed with little or no concern for synchronisation issues.
</p></blockquote></div>
<p>
&#8212; Function composition.
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Function composition refers to the implementation of functions to provide
a higher-level operation, such as sending a message in a particular format.
Each function is implemented in terms of multiple calls to lower-level
read or write operations.
</p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
For example, consider a protocol where each message consists of a fixed-length
header followed by a variable length body, where the length of the body
is specified in the header. A hypothetical read_message operation could
be implemented using two lower-level reads, the first to receive the
header and, once the length is known, the second to receive the body.
</p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
To compose functions in an asynchronous model, asynchronous operations
can be chained together. That is, a completion handler for one operation
can initiate the next. Starting the first call in the chain can be encapsulated
so that the caller need not be aware that the higher-level operation
is implemented as a chain of asynchronous operations.
</p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
The ability to compose new operations in this way simplifies the development
of higher levels of abstraction above a networking library, such as functions
to support a specific protocol.
</p></blockquote></div>
<h6>
<a name="asio.overview.core.async.h4"></a>
<span><a name="asio.overview.core.async.disadvantages"></a></span><a class="link" href="async.html#asio.overview.core.async.disadvantages">Disadvantages</a>
</h6>
<p>
&#8212; Program complexity.
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
It is more difficult to develop applications using asynchronous mechanisms
due to the separation in time and space between operation initiation
and completion. Applications may also be harder to debug due to the inverted
flow of control.
</p></blockquote></div>
<p>
&#8212; Memory usage.
</p>
<div class="blockquote"><blockquote class="blockquote"><p>
Buffer space must be committed for the duration of a read or write operation,
which may continue indefinitely, and a separate buffer is required for
each concurrent operation. The Reactor pattern, on the other hand, does
not require buffer space until a socket is ready for reading or writing.
</p></blockquote></div>
<h6>
<a name="asio.overview.core.async.h5"></a>
<span><a name="asio.overview.core.async.references"></a></span><a class="link" href="async.html#asio.overview.core.async.references">References</a>
</h6>
<p>
[POSA2] D. Schmidt et al, <span class="emphasis"><em>Pattern Oriented Software Architecture,
Volume 2</em></span>. Wiley, 2000.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="basics.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="threads.html"><img src="../../../next.png" alt="Next"></a>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More