Go to the documentation of this file.
5 #include <gtest/gtest.h>
21 out_type.flags |= EntryType::FLAG_FILE;
22 out_type.flags |= EntryType::FLAG_READABLE;
27 return Error::NOT_FOUND;
38 std::memcpy(out_buffer,
file_data.c_str() + offset, inout_size);
48 return Error::NOT_FOUND;
56 TEST(BasicFileServer, Basic)
71 ASSERT_LE(0, serv.
start());
79 GetInfo::Request get_info_req;
80 get_info_req.path.path =
"test";
82 ASSERT_LE(0, get_info.
call(1, get_info_req));
90 ASSERT_EQ(EntryType::FLAG_FILE | EntryType::FLAG_READABLE,
100 Read::Request read_req;
101 read_req.path.path =
"test";
103 ASSERT_LE(0, read.
call(1, read_req));
131 std::cout <<
"sizeof(uavcan::FileServer): " <<
sizeof(
uavcan::FileServer) << std::endl;
133 ASSERT_LE(0, serv.
start());
protocol::file::EntryType EntryType
virtual int16_t read(const Path &path, const uint64_t offset, uint8_t *out_buffer, uint16_t &inout_size)
static MonotonicDuration fromMSec(int64_t ms)
int call(uavcan::NodeID node_id, const typename DataType::Request &request)
static const std::string file_name
std::unique_ptr< Result > result
protocol::file::Path::FieldTypes::path Path
int spinBoth(uavcan::MonotonicDuration duration)
static GlobalDataTypeRegistry & instance()
static const std::string file_data
virtual int16_t getInfo(const Path &path, uint64_t &out_size, EntryType &out_type)
TEST(BasicFileServer, Basic)