.buffalloc Method


Allocates buffer memory as previously requested by "buffrq" methods of individual objects (such as ser.rxbuffrq).





See Also:

sys.totalbuffpages, sys.freebuffpages


Call this method after requesting all buffers you need through methods like ser.txbuffrq and sock.cmdbuffrq.

This method takes a significant amount of time (hundreds of milliseconds) to execute, during which time the device cannot receive network packets, serial data, etc. For certain interfaces like serial ports, some incoming data could be lost.

Buffer (re)allocation for a specific object will only work if the corresponding object or part of the object to which this buffer belongs is idle. "Part" refers to a particular serial port of the ser. object or a particular socket of the sock. object, for example, to which the buffer you are trying to change belongs. "Idle" means different things for different objects: ser.enabled = 0 — NO for a serial port, sock.statesimple =  0 — PL_SSTS_CLOSED for a socket, etc.

.buffalloc Method