Bug report - class Print, function size_t print(const __FlashStringHelper *);


ide version 1.6.12

not sure supposed report sort of thing, here place any.

there appears bug in function size_t print::print(const __flashstringhelper *) such 'prints' first charter of flash string.

i calling print function on object of derived class below.
there no implementation of function print(...) in class assume calling print function in base class.

class udp derived class stream , class stream derived class print (all in arduino\hardware\arduino\avr\cores\arduino)

my receiving windows application receiving first character of string.
but ss changed arduino sketch code use size_t print::write(const char *buffer, size_t size), receiving windows application received full string.

code: [select]
class wifiespudp : public udp {
private:
  uint8_t _sock;  // socket id wiz5100
  uint16_t _port; // local port listen on
 
 
  uint16_t _remoteport;
  char _remotehost[30];


public:
  wifiespudp();  // constructor

  virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. returns 1 if successful, 0 if there no sockets available use
  virtual void stop();  // finish udp socket

  // sending udp packets

  // start building packet send remote host specific in ip , port
  // returns 1 if successful, 0 if there problem supplied ip address or port
  virtual int beginpacket(ipaddress ip, uint16_t port);

  // start building packet send remote host specific in host , port
  // returns 1 if successful, 0 if there problem resolving hostname or port
  virtual int beginpacket(const char *host, uint16_t port);

  // finish off packet , send it
  // returns 1 if packet sent successfully, 0 if there error
  virtual int endpacket();

  // write single byte packet
  virtual size_t write(uint8_t);

  // write size bytes buffer packet
  virtual size_t write(const uint8_t *buffer, size_t size);

  using print::write;

  // start processing next available incoming packet
  // returns size of packet in bytes, or 0 if no packets available
  virtual int parsepacket();

  // number of bytes remaining in current packet
  virtual int available();

  // read single byte current packet
  virtual int read();

  // read len bytes current packet , place them buffer
  // returns number of bytes read, or 0 if none available
  virtual int read(unsigned char* buffer, size_t len);

  // read len characters current packet , place them buffer
  // returns number of characters read, or 0 if none available
  virtual int read(char* buffer, size_t len) { return read((unsigned char*)buffer, len); };

  // return next byte current packet without moving on next byte
  virtual int peek();

  virtual void flush(); // finish reading current packet

  // return ip address of host sent current incoming packet
  virtual ipaddress remoteip();

  // return port of host sent current incoming packet
  virtual uint16_t remoteport();

  void getremoteip(ipaddress &ip);
  uint16_t getremoteport();

  uint8_t getfirstsocket();


  friend class wifiespserver;
};



post code, or better, short example demonstrating this. can guess how using class in sketch. issue in code have written.


Arduino Forum > Using Arduino > Programming Questions > Bug report - class Print, function size_t print(const __FlashStringHelper *);


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor