void cb_tag_found (const char *tagName, void *user_data) { neardal_tag *tag; errorCode_t ec; printf("---- NFC Tag found\n"); strcpy(TagName,tagName); ec = neardal_get_tag_properties(tagName, &tag); if (ec == NEARDAL_SUCCESS) { dump_tag(tag); neardal_free_tag(tag); } else { printf("Unable to read tag properties. (error:%d)\n", ec); } main_loop_state = tag_found; presence = 1; }
static void dump_info_headers( const char *input, uint length ) /*************************************************************/ { const uint_8 *p; uint_32 abbrev_code; uint_32 abbrev_offset; uint_8 * abbrev; uint_32 tag; uint_32 unit_length; uint_32 tag_offset; const uint_8 *unit_base; info_state state; bool found; p = input; state.addr_size = 0; found = false; while( p - input < length ) { state.cu_header = p - input; unit_length = get_u32( (uint_32 *)p ); unit_base = p + sizeof( uint_32 ); Wdputs( "Length: " ); Puthex( unit_length, 8 ); Wdputslc( "\nVersion: " ); Puthex( get_u16( (uint_16 *)(p + 4) ), 4 ); Wdputslc( "\nAbbrev: " ); abbrev_offset = get_u32( (uint_32 *)(p + 6) ); Puthex( abbrev_offset, 8 ); state.addr_size = *(p + 10); Wdputslc( "\nAddress Size " ); Puthex( *(p + 10), 2 ); Wdputslc( "\n" ); p += 11; while( p - unit_base < unit_length ) { tag_offset = p - input; p = DecodeULEB128( p, &abbrev_code ); if( abbrev_code == 0 ) continue; abbrev = find_abbrev( abbrev_offset, abbrev_code ); if( abbrev == NULL ) { Wdputs( "can't find abbreviation " ); Puthex( abbrev_code, 8 ); Wdputslc( "\n" ); break; } if( p >= input + length ) break; abbrev = DecodeULEB128( abbrev, &tag ); abbrev++; state.abbrev = abbrev; state.p = p; if( tag_offset == 0x59a125 ) { found = true; } if( found ) { Wdputs( "Offset: " ); Puthex( tag_offset, 8 ); Wdputs( " Code: " ); Puthex( abbrev_code, 8 ); Wdputslc( "\n" ); Wdputs( " " ); getTAG( tag ); Wdputslc( "\n" ); if( !dump_tag( &state ) )break; } else { skip_tag( &state ); } p = state.p; } if( found )break; } }