46 if(_pHead ==
nullptr){
85 else if(pItem != _pLast){
114 if(pItem !=
nullptr){
129 if(pItem !=
nullptr){
131 if(pItem->_pCallback !=
nullptr){
132 pItem->_pCallback(pItem->value);
144 Item* pItem = _pHead;
145 while(strcmp(pId, pItem->id) != 0){
147 if(pItem ==
nullptr){
163 return pItem !=
nullptr;
172 return strlen(pId) < LIST_ITEM_LENGTH;
175bool ItemList::isListEmpty(){
176 return _pHead ==
nullptr;
192 if(pItem !=
nullptr){
204 if(Serial && !isListEmpty()){
205 Item* pItem = _pHead;
206 Serial.println(F(
"*********************"));
207 while(pItem !=
nullptr){
208 Serial.print(F(
"LIST ITEM ID: "));
209 Serial.println(pItem->id);
210 Serial.print(F(
"LIST ITEM VALUE: "));
211 Serial.println(pItem->value);
215 Serial.println(F(
"*********************"));
266 id = (
char*) malloc (
sizeof(
char) * (strlen(pSrc) + 1));
267 strncpy(
id, pSrc, strlen(pSrc));
268 id[strlen(pSrc)] =
'\0';
Item * getPointToNextItem()
Get pointer to next object.
void setPointToPrevItem(Item *pItem)
Set pointer to previous object.
void saveId(const char *pSrc)
Save id of an object.
void setPointToNextItem(Item *pItem)
Set pointer to next object.
Item(const char *pId, uint16_t val)
Constructor for nested class Item.
Item * getPointToPrevItem()
Get pointer to next object.
void editItemVal(Item *pItem, uint16_t val)
Edit item value in a list.
bool isIdLenValid(const char *pId)
Check if lingth of id is valid.
bool isInList(Item *pItem)
Check if item is in a list.
void deleteItem(Item *pItem)
Delete item from a list.
Item * findItem(const char *pId)
Find item in a list.
void printData()
Print data from list to serial.
char * editItemId(Item *pItem, const char *pNewId)
Edit item id in a list.
uint16_t getItemVal(Item *pItem)
Get item value.
ItemList()
Empty constructor for the class ItemList.
uint8_t getNumOfItems()
Get number of item in a list.
Item * addItem(const char *pId, uint16_t val)
Add item into a list.
void deleteHead()
Delete head of list.