Description

size() – returns data pool size (number of variables)
s_getName() – returns the name string of the data pool (see begin())
u32_getMagic() – returns the unique hash key that was generated from the data pool name
end() – stops the data pool sharing its values and deregisters the can-receiver of the data pool

Syntax

myPool.size();
myPool.s_getName();
myPool.u32_getMagic();
myPool.end();

Parameters

none.

Returns

size() returns:
– uint8_t : number of defined variables of this pool

s_getName() returns:
– String : name of the data pool string

u32_getMagic returns:
– uint32_t : unique data pool key ( which normally is not of any interest for the application development)

end() returns: nothing (void)

Example Codes:

The following code example checks the variable status of the data pool and prints them.

#include "Datapool.h"

#define NB_OF_VARIABLES 3
#define POOL_NAME "A_SimplePool_V1_1"
DATAPOOL myPool( &MCAN0, &BOOTLOADER_SETTING, POOL_NAME, NB_OF_VARIABLES );

void setup() {
  while(!Serial);
  myPool.begin();
  Serial.println("Datapool name: " + myPool.s_getName());
  Serial.println("Number of variables: "+String(myPool.size());
  Serial.println("Magic number: "+String(myPool.u32_getMagic());
}

void loop() 
{
  for(int i = 0; i < NB_OF_VARIABLES; i++)
  {
    if( myPool.getVariableStatus(i) == DP_VARIABLE_VALID )
    {
      Serial.println("Var"+String(i)+": "+
         String( myPool.getValue_int32(i) ));
    }
    myPool.setVariableStatus( i, DP_VARIABLE_INVALID );
  }
  delay(2000);
}

Notes and Warnings

Examples can be found in the Arduino IDE menu:
File -> Examples -> Datapool ->

See also

getVariableStatus()
begin()