#include <stdio.h>
#ifndef MIN
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
# define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
char password[64] = "Hello World!";
char *getUsage (int usage)
{
static char *free = "FREE";
static char *remote = "REMOTE";
static char *usb = "USB";
static char *config = "CONFIG";
static char *unknown = "UNKNOWN";
switch (usage) {
default: return unknown;
}
}
{
int i;
int channel_count;
char ean[8];
unsigned int serial = 0;
if (status != canOK) {
printf("ERROR: canGetNumberOfChannels failed %d\n", status);
return -1;
}
for (i = 0; (status ==
canOK) && (i < channel_count); i++) {
unsigned int ean_hi = 0;
unsigned int ean_lo = 0;
if (status != canOK) {
printf("ERROR: canCHANNELDATA_CARD_UPC_NO failed: %d\n", status);
return -1;
}
ean_hi = (ean[7] << 24) & 0xFF000000;
ean_hi += (ean[6] << 16) & 0x00FF0000;
ean_hi += (ean[5] << 8) & 0x0000FF00;
ean_hi += ean[4] & 0x000000FF;
ean_lo = (ean[3] << 24) & 0xFF000000;
ean_lo += (ean[2] << 16) & 0x00FF0000;
ean_lo += (ean[1] << 8) & 0x0000FF00;
ean_lo += ean[0] & 0x000000FF;
&serial, sizeof(serial));
if (status != canOK) {
printf("ERROR: canCHANNELDATA_CARD_SERIAL_NO failed: %d\n", status);
return -1;
}
{
return 1;
}
}
return 0;
}
{
char service_text[256];
char addr_buf[22];
int32_t service_state;
int32_t service_sub_state;
printf("--------------------------------------------------------------------------\n");
printf("Device information\n");
printf("FW version: %d.%d.%d\n",
printf(
"Serial: %ld\n", di->
ser_no);
printf(
"Name: %s\n", di->
name);
printf("Password: ");
printf("None\n");
} else {
int i;
if (i == 16) {
printf("\n ");
}
}
printf(" (%02x%02x)\n",
}
printf("IP: %s\n", addr_buf);
printf("Client IP: %s\n", addr_buf);
printf(
"Usage: %s", getUsage(di->
usage));
printf(" - Used by Me!\n");
printf(" - Used by other!\n");
} else {
printf("\n");
}
printf("Alive: %s\n",
sizeof(service_text));
char buf[256];
printf("Service: FAILED - %s\n", buf);
} else if (strncmp(service_text, "Service: ", strlen("Service: ")) == 0) {
printf("Service: %s\n", &service_text[strlen("Service: ")]);
} else {
printf("%s\n", service_text);
}
printf("service_state: %d.%d\n", service_state, service_sub_state);
} else {
printf("service_state: unknown\n");
}
}
{
char buf[256];
uint32_t no_addrs = 0;
uint32_t i;
&no_addrs,
printf("kvrDiscoveryGetDefaultAddresses() FAILED - %s\n", buf);
return status;
}
if (no_addrs <
sizeof(addr_list)/
sizeof(
kvrAddress)) {
printf("ERROR: kvrAddressFromString(%d, 10.0.3.1) failed\n",no_addrs);
} else {
no_addrs++;
}
} else {
printf("NOTE: We don't have room for all devices in addr_list[%zu].\n",
}
for (i=0; i < no_addrs; i++) {
printf("Looking for device using: %s\n", buf);
}
printf("kvrDiscoverySetAddresses() FAILED - %s\n", buf);
return status;
}
return status;
}
{
int devices;
uint32_t delay_ms = 500;
uint32_t timeout_ms = 300;
char buf[256];
printf("kvrDiscoveryStart() FAILED - %s\n", buf);
return status;
}
devices = 0;
while (status ==
kvrOK) {
dumpDeviceInfo(&device_info[devices]);
printf("Unable to set password: %s (%zu)\n", password, strlen(password));
}
devices++;
} else {
printf("kvrDiscoveryGetResults() failed %d\n", status );
}
}
}
printf("Device store failed: %s\n", buf);
}
}
int main (int argc, char *argv[])
{
char buf[256];
if (argc > 1) {
strcpy(password, argv[1]);
}
printf("kvrDiscoveryOpen() FAILED - %s\n", buf);
return status;
}
status = setupBroadcast(handle);
printf("setupBroadcast() FAILED - %s\n", buf);
return status;
}
status = discoverDevices(handle);
printf("discoverDevices() FAILED - %s\n", buf);
return status;
}
return 0;
}