PS February 11, 2010 09:02AM | Registered: 14 years ago Posts: 16 |
#define MAXDEVICES 10u /* Device identifier of the device we care about, or whatever. */ static const u8 mycod[] = { 0xAAu, 0xBBu, 0xCCu }; /* Return value: negative : device found, print error 0 : no device found / device not found positive : device found and printed (no trailing newline) */ static int print_it(void) { u8 max_cnt, flush; s32 inq_res; struct inquiry_info info[MAXDEVICES]; /* Set up as appropriate, for example: */ max_cnt = MAXDEVICES; flush = ...; inq_res = bte_inquiry(info, max_cnt, flush); /* Check inq_res. I guess it returns the number of devices found, or a negative value in case of error. If it succeeds, search for the device you're interested in based on "cod" or whatever, and print its address. */ if (0 < inq_res) { unsigned devidx; for (devidx = 0u; devidx < (unsigned)inq_res; ++devidx) { if (0 == memcmp(info[devidx].cod, mycod, sizeof mycod)) { const u8 *addr; addr = info[devidx].bdaddr.addr; return fprintf(stdout, "%02x:%02x:%02x:%02x:%02x:%02x", (unsigned)addr[0], (unsigned)addr[1], (unsigned)addr[2], (unsigned)addr[3], (unsigned)addr[4], (unsigned)addr[5]); } } } return 0; }
Re: Some help with my first homebrew wii programs February 12, 2010 10:25AM | Registered: 14 years ago Posts: 379 |
Re: Some help with my first homebrew wii programs February 13, 2010 04:02AM | Registered: 14 years ago Posts: 16 |