.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 significant amount of time (100s 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 particular socket of the sock object, etc. to which the buffer you are trying to change belongs. "Idle" means different things for different objects: ser.enabled = 0 — NO for the serial port, sock.statesimple =  0 — PL_SSTS_CLOSED for the socket, etc.