int main() { DLN_RESULT result; DlnConnect("localhost", DLN_DEFAULT_SERVER_PORT); // Check device count uint32_t device_count; result = DlnGetDeviceCount(&device_count); if (!DLN_SUCCEEDED(result)) { std::cout << "Failed to get DLN device count" << std::endl; return -1; } if (device_count != 1) { std::cout << "There should be one and only one DLN device connected. There are " << device_count << std::endl; return -1; } // Try to open our device HDLN handle; result = DlnOpenDevice(0, &handle); if (!DLN_SUCCEEDED(result)) { std::cout << "Failed to open DLN device" << std::endl; return -1; } // Print out some info about our DLN device DLN_VERSION version; uint32_t sn, id; DlnGetVersion(handle, &version); DlnGetDeviceSn(handle, &sn); DlnGetDeviceId(handle, &id); std::cout << "Opened DLN device: " << sn << "\t" << id << std::endl; // Initialize all the things init_i2c(handle); init_analog(handle); // Instantiate the rover controller RoverControl rover(handle); while (true) { rover.update(); } cleanup_analog(handle); DlnCloseHandle(handle); DlnDisconnectAll(); return 0; }
int main() { Dog fido; Dog rover(5); Dog buster(6, 8); Dog yorkie(3, YORKIE); Dog dobbie(4, 20, DOBERMAN); fido.speak(); rover.wagTail(); std::cout << "Yorkie is " << yorkie.getAge() << " years old\n"; std::cout << "Dobbie weighs " << dobbie.getWeight() << " pounds\n"; return 0; }