32 for (uint8_t i = 0; i < count; i++) {
41 uint8_t len = pgm_read_byte(&items->
length);
42 if (ix >= len)
return (
NULL);
46 item = (
item_P) pgm_read_word(&vec[ix]);
62 for (uint8_t i = 0; i < count; i++) {
67 if ((nx < count) && (type !=
ITEM_LIST))
return;
71 uint8_t len = pgm_read_byte(&items->
length);
72 if (ix >= len)
return;
76 item = (
item_P) pgm_read_word(&vec[ix]);
93 return (obj->
run(buf, size));
105 size_t size = (size_t) pgm_read_word(&blob->
size);
106 if (
UNLIKELY(size == 0))
return (0);
112 memcpy_P(buf, (
const void*) pgm_read_word(&blob->
value), size);
114 memcpy(buf, (
const void*) pgm_read_word(&blob->
value), size);
116 m_eeprom->
read(buf, (
const void*) pgm_read_word(&blob->
value), size);
133 size_t size = (size_t) pgm_read_word(&blob->
size);
134 if (
UNLIKELY(size == 0))
return (0);
140 memcpy((
void*) pgm_read_word(&blob->
value), buf, size);
142 m_eeprom->
write((
void*) pgm_read_word(&blob->
value), buf, size);
151 outs <<
PSTR(
"item@") << (
void*) item;
153 outs <<
PSTR(
"(NULL)");
156 outs <<
PSTR(
"(type = ");
160 outs <<
PSTR(
"ITEM");
163 outs <<
PSTR(
"ITEM_LIST");
166 outs <<
PSTR(
"ACTION");
169 outs <<
PSTR(
"BLOB");
172 outs <<
PSTR(
"APPL(") << type <<
')';
175 outs <<
PSTR(
", storage = ");
178 outs <<
PSTR(
"SRAM");
181 outs <<
PSTR(
"PROGMEM");
184 outs <<
PSTR(
"EEMEM");
197 if (list ==
NULL)
return (outs);
200 while ((item = iter.
next()) !=
NULL)
201 outs << item <<
endl;
item_P lookup(const uint8_t *path=NULL, size_t count=0)
type_t type
Item type tag(ITEM).
item_vec_P list
Item vector in program memory.
const item_P * item_vec_P
size_t size
Size of object.
static const size_t PATH_MAX
item_t item
Item header(>= BLOB).
const item_list_t * item_list_P
int get_value(blob_P blob, void *buf, size_t len)
virtual int write(void *dest, const void *src, size_t size)
void print(IOStream &outs, const uint8_t *path, size_t count)
virtual int read(void *dest, const void *src, size_t size)
Action * obj
Pointer to action handler instance.
void * value
Pointer to value.
IOStream & endl(IOStream &outs)
static type_t get_type(item_P item)
static str_P get_name(item_P item)
uint8_t length
Item vector length (for boundary checking).
static storage_t get_storage(item_P item)
IOStream & operator<<(IOStream &outs, Registry::item_P item)
static int run(action_P action, void *buf, size_t size)
static bool is_readonly(item_P item)
virtual int run(void *buf, size_t size)=0
item_t item
Item header(ACTION).
int set_value(blob_P blob, const void *buf, size_t len)