Esempio n. 1
0
/* Add a byte to the currently assembled packet if there is space
 * if there isn't space, either truncate (ignore) or split the packet.
 */
void UdpBytewiseClass::write(uint8_t b) {
	if(_txIndex>= UDP_TX_PACKET_MAX_SIZE) {
		//buffer is full - we can either truncate the packet or split in two
		switch (_txOverflowStrategy) {
			case UDP_TX_OVERFLOW_SPLIT:
				endPacket();
				beginPacket(_txIp,_txPort);
				//fall through to normal add of byte to buffer below
				break;
			case UDP_TX_OVERFLOW_TRUNCATE:
			default:
				//don't add - just ignore bytes past buffer size
				return;
		}
	}
	_txBuffer[_txIndex++] = b;
}
Esempio n. 2
0
void WiFiUDP::flush()
{
    endPacket();
}
void SLIPEncodedSerial::encode(const uint8_t *buf, int size) {
    beginPacket();
    while (size--)
        encode(*buf++);
    endPacket();
}