4#ifndef AUBO_SDK_SOCKET_INTERFACE_H
5#define AUBO_SDK_SOCKET_INTERFACE_H
11#include <aubo/global_config.h>
14namespace common_interface {
69 const std::string &socket_name =
"socket_0");
160 const std::string &socket_name =
"socket_0");
209 const std::string &socket_name =
"socket_0");
257 const std::string &socket_name =
"socket_0");
339 const std::string &socket_name =
"socket_0",
340 const std::string &prefix =
"",
341 const std::string &suffix =
"",
342 bool interpret_escape =
false);
391 const std::string &socket_name =
"socket_0");
520 const std::string &socket_name =
"socket_0");
570 const std::string &socket_name =
"socket_0");
603 const std::string &socket_name =
"socket_0");
bool socketHasConnected(const std::string &socket_name="socket_0")
检测 socket 连接是否成功
int socketClose(const std::string &socket_name="socket_0")
关闭TCP/IP socket 通信 关闭与服务器的 socket 连接。
int socketSendAllString(bool is_check, const std::vector< char > &str, const std::string &socket_name="socket_0")
发送给定char向量中的所有数据到服务器。
int socketReadString(const std::string &variable, const std::string &socket_name="socket_0", const std::string &prefix="", const std::string &suffix="", bool interpret_escape=false)
从socket读取所有数据并将其作为字符串返回。 字节为网络字节序。
int socketReadBinaryInteger(int number, const std::string &variable, const std::string &socket_name="socket_0")
从socket读取指定数量的32位整数。字节为网络字节序。一次最多可读取30个值。 读取到的数字列表(整数列表,长度=number+1)
int socketOpen(const std::string &address, int port, const std::string &socket_name="socket_0")
打开TCP/IP以太网通信socket
int socketReadAsciiFloat(int number, const std::string &variable, const std::string &socket_name="socket_0")
从socket读取指定数量的ASCII格式浮点数。一次最多可读取30个值。 读取到的数字列表(浮点数列表,长度=number+1)
int socketReadByteList(int number, const std::string &variable, const std::string &socket_name="socket_0")
从socket读取指定数量的字节。字节为网络字节序。一次最多可读取30个值。 读取到的数字列表(整数列表,长度=number+1)
int socketSendInt(int value, const std::string &socket_name="socket_0")
发送一个int(int32_t)到服务器 通过socket发送int ,以网络字节序发送。不期望响应。
int socketSendByte(char value, const std::string &socket_name="socket_0")
发送一个字节到服务器 通过socket发送字节<value>,不期望响应。可用于发送特殊ASCII字符;10为换行符,2为文本开始,3为文本结束。
int socketSendLine(const std::string &str, const std::string &socket_name="socket_0")
发送带有换行符的字符串到服务器.
int socketReadAllString(const std::string &variable, const std::string &socket_name="socket_0")
从socket读取所有数据并将其作为char向量返回。
int socketSendString(const std::string &str, const std::string &socket_name="socket_0")
发送字符串到服务器 通过socket以ASCII编码发送字符串<str>,不期望响应。
std::shared_ptr< Socket > SocketPtr