29 return twiddlerReader.
read(b);
51 if (expectTwiddle&&initiative) {
56 Bytes twiddle_buf(twiddle,1);
61 Bytes mlen_buf(mlen,4);
68 int len = NetType::netInt(mlen_buf);
84 int len_scan = scan.
length();
110 cursor = (
char*) &header;
111 remaining =
sizeof(header);
116 if (cursor!=
nullptr) {
117 int allow = remaining;
118 if ((
int)b.
length()<allow) {
121 memcpy(b.
get(),cursor,allow);
142 if (!setInitiative) {
144 setInitiative =
true;
163 std::map<std::string, std::string> kinds;
164 kinds[
"std_msgs/String"] =
"vector string 1 *";
165 kinds[
"std_msgs/Int32"] =
"vector int32 1 *";
166 kinds[
"std_msgs/Float64"] =
"vector float64 1 *";
170 kinds[
"sensor_msgs/Image"] =
"list 4 skip uint32 * skip uint32 * skip uint32 * skip string * >height uint32 * >width uint32 * >encoding string * skip int8 * >step int32 * compute image_params <=[mat] vocab * <translated_encoding vocab * item_vector int32 5 <depth item * <img_size item * <quantum item * <width item * <height item * blob *";
172 kinds[
"test_roscpp/TestStringString"] =
"vector string 1 * --- vector string 1 *";
178 if (std::string(rosname) ==
"") {
181 std::map<std::string, std::string> kinds =
rosToKind();
183 if (kinds.find(rosname)!=kinds.end()) {
184 return kinds[rosname];
190 cmd.
addString(std::string(
"twiddle ") + rosname);
192 port.
write(cmd,resp);
200 if (std::string(rosname)!=
"") {
211 sender?
"sender":
"receiver",
212 reply?
"reply":
"main");
213 std::string str(txt);
215 size_t idx = str.find(
"---");
216 if (idx!=std::string::npos) {
217 str = str.substr(idx+3,str.length());
220 str = std::string(
"skip int32 * ") + str;
222 str = std::string(
"skip int8 * ") + str;
224 return twiddler.
configure(str.c_str(),prompt);
const yarp::os::LogComponent & TCPROSCARRIER()
static char * checkBottle(char *cursor, int &remaining, int ct, int list_tag)
static std::map< std::string, std::string > rosToKind()
void write(const yarp::os::Bytes &b) override
Write a block of bytes to the stream.
static bool configureTwiddler(yarp::wire_rep_utils::WireTwiddler &twiddler, const char *txt, const char *prompt, bool sender, bool reply)
void updateKind(const char *kind, bool sender, bool reply)
A simple collection of objects that can be described and transmitted in a portable way.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
A simple abstraction for a block of bytes.
void clear()
Disassociate object with any data block (deleting block if appropriate).
const Bytes & bytes() const
void allocate(size_t len)
Makes a data block of the specified length that will be deleted if this object is destroyed.
virtual void write(char ch)
Write a single byte to the stream.
A mini-server for network communication.
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
bool addOutput(const std::string &name) override
Add an output connection to the specified port.
bool openFake(const std::string &name)
Start port without making it accessible from the network.
void close() override
Stop port activity.
virtual InputStream & getInputStream()=0
Get an InputStream to read from.
virtual OutputStream & getOutputStream()=0
Get an OutputStream to write to.
virtual std::string asString() const
Get string value.
yarp::conf::ssize_t read(yarp::os::Bytes &b) override
Read a block of data from the stream.
bool configure(const char *txt, const char *prompt)
#define yCError(component,...)
#define yCTrace(component,...)
An interface to the operating system, including Port based communication.