bool DFListTest::verifyUIntList(DFUIntList &pl, unsigned int check_list[4]) { bool passed = true; DFUIntList::Index idx = nullptr; idx = pl.next(idx); unsigned int i = 0; while (idx != nullptr) { unsigned int val; bool ret = pl.get(idx, val); if (ret == false) { DF_LOG_INFO("get() failed"); passed = false; } if (val != check_list[i]) { DF_LOG_INFO("Expected %c got %c", check_list[i], val); passed = false; } idx = pl.next(idx); ++i; } return passed; }
int start(enum Rotation rotation) { g_dev = new DfHmc9250Wrapper(rotation); if (g_dev == nullptr) { PX4_ERR("failed instantiating DfHmc9250Wrapper object"); return -1; } int ret = g_dev->start(); if (ret != 0) { PX4_ERR("DfHmc9250Wrapper start failed"); return ret; } // Open the MAG sensor DevHandle h; DevMgr::getHandle(MAG_DEVICE_PATH, h); if (!h.isValid()) { DF_LOG_INFO("Error: unable to obtain a valid handle for the receiver at: %s (%d)", MAG_DEVICE_PATH, h.getError()); return -1; } DevMgr::releaseHandle(h); return 0; }
int start() { PX4_ERR("start"); g_dev = new DfISL29501Wrapper(); if (g_dev == nullptr) { PX4_ERR("failed instantiating DfISL29501Wrapper object"); return -1; } int ret = g_dev->start(); if (ret != 0) { PX4_ERR("DfISL29501Wrapper start failed"); return ret; } // Open the range sensor DevHandle h; DevMgr::getHandle(ISL_DEVICE_PATH, h); if (!h.isValid()) { DF_LOG_INFO("Error: unable to obtain a valid handle for the receiver at: %s (%d)", ISL_DEVICE_PATH, h.getError()); return -1; } DevMgr::releaseHandle(h); return 0; }
int start(bool mag_enabled, enum Rotation rotation) { g_dev = new DfLsm9ds1Wrapper(mag_enabled, rotation); if (g_dev == nullptr) { PX4_ERR("failed instantiating DfLsm9ds1Wrapper object"); return -1; } int ret = g_dev->start(); if (ret != 0) { PX4_ERR("DfLsm9ds1Wrapper start failed"); return ret; } // Open the IMU sensor DevHandle h; DevMgr::getHandle(IMU_DEVICE_ACC_GYRO, h); if (!h.isValid()) { DF_LOG_INFO("Error: unable to obtain a valid handle for the receiver at: %s (%d)", IMU_DEVICE_ACC_GYRO, h.getError()); return -1; } DevMgr::releaseHandle(h); DevMgr::getHandle(IMU_DEVICE_MAG, h); if (!h.isValid()) { DF_LOG_INFO("Error: unable to obtain a valid handle for the receiver at: %s (%d)", IMU_DEVICE_MAG, h.getError()); return -1; } DevMgr::releaseHandle(h); return 0; }
bool DFListTest::verifyList(DFPointerList &pl, const char *expectedOrder) { bool passed = true; DFPointerList::Index idx = nullptr; idx = pl.next(idx); unsigned int i = 0; while (idx != nullptr) { const char *val = static_cast<const char *>(pl.get(idx)); if (val[0] != expectedOrder[i]) { DF_LOG_INFO("Expected %c got %c", expectedOrder[i], val[0]); passed = false; } idx = pl.next(idx); ++i; } return passed; }
bool DFListTest::verifyStructList(DFManagedList<testStr> &pl, const char *expectedOrder) { bool passed = true; DFPointerList::Index idx = nullptr; idx = pl.next(idx); unsigned int i = 0; while (idx != nullptr) { testStr *val = pl.get(idx); if (val->msg[0] != expectedOrder[i]) { DF_LOG_INFO("Expected %c got %c", expectedOrder[i], val->msg[0]); passed = false; } idx = pl.next(idx); ++i; } return passed; }