Merge branch 'master' into dsdl_review

This commit is contained in:
Pavel Kirienko
2015-03-16 23:52:27 +03:00
88 changed files with 667 additions and 240 deletions
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_DATA_TYPE_INFO_PROVIDER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_DATA_TYPE_INFO_PROVIDER_HPP_INCLUDED
#include <uavcan/node/service_server.hpp>
#include <uavcan/util/method_binder.hpp>
@@ -51,3 +52,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_DATA_TYPE_INFO_PROVIDER_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_GLOBAL_TIME_SYNC_MASTER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_GLOBAL_TIME_SYNC_MASTER_HPP_INCLUDED
#include <uavcan/node/publisher.hpp>
#include <uavcan/node/subscriber.hpp>
@@ -92,3 +93,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_GLOBAL_TIME_SYNC_MASTER_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_GLOBAL_TIME_SYNC_SLAVE_HPP_INCLUDED
#define UAVCAN_PROTOCOL_GLOBAL_TIME_SYNC_SLAVE_HPP_INCLUDED
#include <uavcan/node/subscriber.hpp>
#include <uavcan/util/method_binder.hpp>
@@ -103,3 +104,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_GLOBAL_TIME_SYNC_SLAVE_HPP_INCLUDED
+34 -20
View File
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_LOGGER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_LOGGER_HPP_INCLUDED
#include <uavcan/time.hpp>
#include <uavcan/protocol/debug/LogMessage.hpp>
@@ -148,52 +149,52 @@ public:
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
template <typename... Args>
int log(LogLevel level, const char* source, const char* format, Args... args);
int log(LogLevel level, const char* source, const char* format, Args... args) UAVCAN_NOEXCEPT;
template <typename... Args>
inline int logDebug(const char* source, const char* format, Args... args)
inline int logDebug(const char* source, const char* format, Args... args) UAVCAN_NOEXCEPT
{
return log(protocol::debug::LogLevel::DEBUG, source, format, args...);
}
template <typename... Args>
inline int logInfo(const char* source, const char* format, Args... args)
inline int logInfo(const char* source, const char* format, Args... args) UAVCAN_NOEXCEPT
{
return log(protocol::debug::LogLevel::INFO, source, format, args...);
}
template <typename... Args>
inline int logWarning(const char* source, const char* format, Args... args)
inline int logWarning(const char* source, const char* format, Args... args) UAVCAN_NOEXCEPT
{
return log(protocol::debug::LogLevel::WARNING, source, format, args...);
}
template <typename... Args>
inline int logError(const char* source, const char* format, Args... args)
inline int logError(const char* source, const char* format, Args... args) UAVCAN_NOEXCEPT
{
return log(protocol::debug::LogLevel::ERROR, source, format, args...);
}
#else
int log(LogLevel level, const char* source, const char* text);
int log(LogLevel level, const char* source, const char* text) UAVCAN_NOEXCEPT;
int logDebug(const char* source, const char* text)
int logDebug(const char* source, const char* text) UAVCAN_NOEXCEPT
{
return log(protocol::debug::LogLevel::DEBUG, source, text);
}
int logInfo(const char* source, const char* text)
int logInfo(const char* source, const char* text) UAVCAN_NOEXCEPT
{
return log(protocol::debug::LogLevel::INFO, source, text);
}
int logWarning(const char* source, const char* text)
int logWarning(const char* source, const char* text) UAVCAN_NOEXCEPT
{
return log(protocol::debug::LogLevel::WARNING, source, text);
}
int logError(const char* source, const char* text)
int logError(const char* source, const char* text) UAVCAN_NOEXCEPT
{
return log(protocol::debug::LogLevel::ERROR, source, text);
}
@@ -207,20 +208,33 @@ public:
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
template <typename... Args>
int Logger::log(LogLevel level, const char* source, const char* format, Args... args)
int Logger::log(LogLevel level, const char* source, const char* format, Args... args) UAVCAN_NOEXCEPT
{
if (level >= level_ || level >= getExternalSinkLevel())
#if UAVCAN_EXCEPTIONS
try
#endif
{
msg_buf_.level.value = level;
msg_buf_.source = source;
msg_buf_.text.clear();
CharArrayFormatter<typename protocol::debug::LogMessage::FieldTypes::text> formatter(msg_buf_.text);
formatter.write(format, args...);
return log(msg_buf_);
if (level >= level_ || level >= getExternalSinkLevel())
{
msg_buf_.level.value = level;
msg_buf_.source = source;
msg_buf_.text.clear();
CharArrayFormatter<typename protocol::debug::LogMessage::FieldTypes::text> formatter(msg_buf_.text);
formatter.write(format, args...);
return log(msg_buf_);
}
return 0;
}
return 0;
#if UAVCAN_EXCEPTIONS
catch (...)
{
return -ErrFailure;
}
#endif
}
#endif
}
#endif // UAVCAN_PROTOCOL_LOGGER_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_NETWORK_COMPAT_CHECKER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_NETWORK_COMPAT_CHECKER_HPP_INCLUDED
#include <uavcan/util/bitset.hpp>
#include <uavcan/util/method_binder.hpp>
@@ -104,3 +105,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_NETWORK_COMPAT_CHECKER_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_NODE_STATUS_MONITOR_HPP_INCLUDED
#define UAVCAN_PROTOCOL_NODE_STATUS_MONITOR_HPP_INCLUDED
#include <uavcan/util/method_binder.hpp>
#include <uavcan/node/subscriber.hpp>
@@ -128,3 +129,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_NODE_STATUS_MONITOR_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_NODE_STATUS_PROVIDER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_NODE_STATUS_PROVIDER_HPP_INCLUDED
#include <uavcan/node/publisher.hpp>
#include <uavcan/node/subscriber.hpp>
@@ -110,3 +111,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_NODE_STATUS_PROVIDER_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_PANIC_BROADCASTER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_PANIC_BROADCASTER_HPP_INCLUDED
#include <uavcan/node/publisher.hpp>
#include <uavcan/node/timer.hpp>
@@ -31,10 +32,12 @@ public:
}
/**
* Begin broadcasting at the standard interval.
* Begin broadcasting at the standard interval (see BROADCASTING_INTERVAL_MS).
* This method does not block and can't fail.
* @param short_reason Short ASCII string that describes the reason of the panic, 7 characters max.
* If the string exceeds 7 characters, it will be truncated.
*/
void panic(const char* short_reason);
void panic(const char* short_reason_description);
/**
* Stop broadcasting immediately.
@@ -47,3 +50,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_PANIC_BROADCASTER_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_PANIC_LISTENER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_PANIC_LISTENER_HPP_INCLUDED
#include <cassert>
#include <uavcan/debug.hpp>
@@ -123,3 +124,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_PANIC_LISTENER_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_PARAM_SERVER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_PARAM_SERVER_HPP_INCLUDED
#include <uavcan/protocol/param/GetSet.hpp>
#include <uavcan/protocol/param/SaveErase.hpp>
@@ -105,3 +106,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_PARAM_SERVER_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_RESTART_REQUEST_SERVER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_RESTART_REQUEST_SERVER_HPP_INCLUDED
#include <uavcan/node/service_server.hpp>
#include <uavcan/util/method_binder.hpp>
@@ -66,3 +67,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_RESTART_REQUEST_SERVER_HPP_INCLUDED
@@ -2,7 +2,8 @@
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
*/
#pragma once
#ifndef UAVCAN_PROTOCOL_TRANSPORT_STATS_PROVIDER_HPP_INCLUDED
#define UAVCAN_PROTOCOL_TRANSPORT_STATS_PROVIDER_HPP_INCLUDED
#include <uavcan/node/service_server.hpp>
#include <uavcan/util/method_binder.hpp>
@@ -39,3 +40,5 @@ public:
};
}
#endif // UAVCAN_PROTOCOL_TRANSPORT_STATS_PROVIDER_HPP_INCLUDED