@@ -87,9 +87,10 @@ static parser_error_t checkSanity(uint8_t numItems, uint8_t displayIdx) {
8787 return parser_ok ;
8888}
8989
90- parser_error_t page_title (char * outKey , uint16_t outKeyLen , const char * inValue ) {
90+ parser_error_t page_title (const parser_tx_t * txObj , char * outKey , uint16_t outKeyLen , const char * title ,
91+ primitive_t * primitive , parser_context_t * data_context ) {
9192 CHECK_INPUT (outKey );
92- CHECK_INPUT (inValue );
93+ CHECK_INPUT (title );
9394
9495 if (outKeyLen == 0 ) {
9596 return parser_ui_buffer_too_small ;
@@ -99,19 +100,24 @@ parser_error_t page_title(char *outKey, uint16_t outKeyLen, const char *inValue)
99100 MEMZERO (outKey , outKeyLen );
100101
101102 clear_item_title_buffer ();
102- init_item_title_buffer ( inValue );
103-
104- uint8_t items_qty = 0 ;
105- CHECK_ERROR (get_title_item_qty (& items_qty ))
103+ if ( strlen ( title ) > 0 ) {
104+ init_item_title_buffer ( title );
105+ uint8_t items_qty = 0 ;
106+ CHECK_ERROR (get_title_item_qty (& items_qty ))
106107
107- if (items_qty == 0 ) {
108- return parser_ui_item_title_empty ;
109- }
108+ if (items_qty == 0 ) {
109+ return parser_ui_item_title_empty ;
110+ }
110111
111- CHECK_ERROR (create_item_title (items_qty - 1 , items_qty , outKey , outKeyLen ));
112- if (strlen (outKey ) <= 1 && items_qty > 1 ) {
113- MEMZERO (outKey , outKeyLen );
114- CHECK_ERROR (create_item_title (items_qty - 2 , items_qty , outKey , outKeyLen ));
112+ CHECK_ERROR (create_item_title (items_qty - 1 , items_qty , outKey , outKeyLen ));
113+ if (strlen (outKey ) <= 1 && items_qty > 1 ) {
114+ MEMZERO (outKey , outKeyLen );
115+ CHECK_ERROR (create_item_title (items_qty - 2 , items_qty , outKey , outKeyLen ));
116+ }
117+ } else {
118+ char ui_data_buffer [200 ] = {0 };
119+ CHECK_ERROR (render_primitive (data_context , txObj , primitive , ui_data_buffer , sizeof (ui_data_buffer )));
120+ strncpy (outKey , ui_data_buffer , outKeyLen );
115121 }
116122
117123 return parser_ok ;
@@ -194,7 +200,9 @@ parser_error_t parser_getItem(const parser_tx_t *txObj, uint8_t displayIdx, char
194200 CHECK_ERROR (checkSanity (numItems , displayIdx ))
195201 cleanOutput (outKey , outKeyLen , outVal , outValLen );
196202
197- CHECK_ERROR (page_title (outKey , outKeyLen , txObj -> ui_items_new .items [displayIdx ].title ))
203+ CHECK_ERROR (page_title (txObj , outKey , outKeyLen , txObj -> ui_items_new .items [displayIdx ].title ,
204+ & txObj -> ui_items_new .items [displayIdx ].primitive ,
205+ & txObj -> ui_items_new .items [displayIdx ].data_context ))
198206 CHECK_ERROR (page_item (txObj , outVal , outValLen , txObj -> ui_items_new .items [displayIdx ].title ,
199207 & txObj -> ui_items_new .items [displayIdx ].primitive ,
200208 & txObj -> ui_items_new .items [displayIdx ].data_context , pageIdx , pageCount ))
0 commit comments