Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"maintainer": true
}
],
"version": "1.7.5",
"version": "1.7.6",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=QuarkTS
version=1.7.5
version=1.7.6
license=MIT
author=J. Camilo Gomez C. <kmilo17pet@gmail.com>
maintainer=J. Camilo Gomez C. <kmilo17pet@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required( VERSION 3.2 )
project( quarkts-cpp
VERSION 1.7.5
VERSION 1.7.6
DESCRIPTION "An open-source OS for small embedded applications"
LANGUAGES CXX )

Expand Down
10 changes: 5 additions & 5 deletions src/QuarkTS.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* @file QuarkTS.h
* @author J. Camilo Gomez C.
* @version 1.7.5
* @version 1.7.6
* @note This file is part of the QuarkTS++ distribution.
* @brief Global inclusion header
**/
Expand Down Expand Up @@ -41,8 +41,8 @@ This file is part of the QuarkTS++ OS distribution.
#ifndef QOS_CPP_H
#define QOS_CPP_H

#define QUARKTS_CPP_VERSION "1.7.5"
#define QUARKTS_CPP_VERNUM ( 175u )
#define QUARKTS_CPP_VERSION "1.7.6"
#define QUARKTS_CPP_VERNUM ( 176u )
#define QUARKTS_CPP_CAPTION "QuarkTS++ OS " QUARKTS_CPP_VERSION

#include "config/config.h"
Expand All @@ -66,7 +66,7 @@ This file is part of the QuarkTS++ OS distribution.

namespace qOS {
namespace build {
constexpr const uint32_t number = 4144;
constexpr const uint32_t number = 4149;
constexpr const char* date = __DATE__;
constexpr const char* time = __TIME__;
constexpr const char* std = "c++11";
Expand All @@ -76,7 +76,7 @@ namespace qOS {
constexpr const uint8_t number = QUARKTS_CPP_VERNUM;
constexpr const uint8_t mayor = 1U;
constexpr const uint8_t minor = 7U;
constexpr const uint8_t rev = 5U;
constexpr const uint8_t rev = 6U;
}
namespace product {
constexpr const char* author = "J. Camilo Gomez C.";
Expand Down
16 changes: 15 additions & 1 deletion src/include/bytebuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace qOS {
/**
* @brief A Byte-sized buffer object
*/
class byteBuffer {
class byteBuffer : private nonCopyable {
private:
volatile byte_t *buffer{ nullptr };
volatile index_t tail{ 0U };
Expand Down Expand Up @@ -96,6 +96,20 @@ namespace qOS {
* @return Number of elements in the byte-sized Buffer.
*/
size_t count( void ) const noexcept;
/**
* @brief Check if the byteBuffer instance has been initialized.
* @return @c true if instance has been initialized
*/
bool isInitialized( void ) const {
return ( nullptr != buffer );
}
/**
* @brief Check if the byteBuffer instance has been initialized.
* @return @c true if instance has been initialized
*/
explicit operator bool() const noexcept {
return isInitialized();
}
};

/** @}*/
Expand Down
29 changes: 27 additions & 2 deletions src/include/cli.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ namespace qOS {
/**
* @brief An AT-Command object
*/
class command : protected node {
class command : protected node, private nonCopyable {
private:
commandCallback_t cmdCallback{ nullptr };
options_t cmdOpt{ 0U };
Expand All @@ -313,10 +313,21 @@ namespace qOS {
/*! @cond */
virtual ~command() {}
/*! @endcond */
/**
* @brief Retrieve the command user-defined parameter.
* @return @c A generic pointer to the user-defined parameter
*/
inline void* getParam( void ) noexcept
{
return param;
}
/**
* @brief Check if the byteBuffer instance has been initialized.
* @return @c true if instance has been initialized
*/
explicit operator bool() const noexcept {
return ( nullptr != Text ) && ( nullptr != cmdCallback );
}
friend class qOS::commandLineInterface;
};
/** @}*/
Expand All @@ -330,7 +341,7 @@ namespace qOS {
* The instance should be initialized using the commandLineInterface::setup()
* method.
*/
class commandLineInterface : protected cli::input {
class commandLineInterface : protected cli::input, private nonCopyable {
private:
list subscribed;
cli::commandHandler handler;
Expand Down Expand Up @@ -462,6 +473,20 @@ namespace qOS {
{
handler.Data = pData;
}
/**
* @brief Check if the CLI instance has been initialized.
* @return @c true if instance has been initialized
*/
bool isInitialized( void ) const {
return ( nullptr != cli::input::storage );
}
/**
* @brief Check if the CLI instance has been initialized.
* @return @c true if instance has been initialized
*/
explicit operator bool() const noexcept {
return isInitialized();
}
friend class cli::commandHandler;
friend class core;
};
Expand Down
7 changes: 7 additions & 0 deletions src/include/coroutine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ namespace qOS {
* @brief Try to execute co::setPosition() statement externally.
*/
void try_set( co::state p ) noexcept;
/**
* @brief Check if the Co-Routine handle is valid.
* @return @c true if handle is valid
*/
explicit operator bool() const noexcept {
return ( nullptr != ctx );
}
friend class co::coContext;
};

Expand Down
20 changes: 16 additions & 4 deletions src/include/fsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ namespace qOS {
#endif

/*! @cond */
class stateHandler {
class stateHandler : private nonCopyable {
protected:
state *StartState{ nullptr };
state *NextState{ nullptr };
Expand All @@ -364,10 +364,8 @@ namespace qOS {
historyMode TransitionHistory{ historyMode::NO_HISTORY };
status Status{ SUCCESS };
signalID Signal{ signalID::SIGNAL_NONE };
stateHandler( stateHandler const& ) = delete; /* not copyable*/
void operator=( stateHandler const& ) = delete; /* not assignable*/
public:
stateHandler() = default;
public:
virtual ~stateHandler() {}
void *SignalData{ nullptr }; /**< The data with which the signal is associated*/
void *Data{ nullptr }; /**< The user storage pointer. If the FSM its running as a task, this will point to the event_t structure*/
Expand Down Expand Up @@ -1032,6 +1030,20 @@ namespace qOS {
* @c false.
*/
bool run( sm::signal_t sig ) noexcept;
/**
* @brief Check if the state machine instance has been initialized.
* @return @c true if instance has been initialized
*/
bool isInitialized( void ) const {
return ( nullptr != top.initState );
}
/**
* @brief Check if the state machine instance has been initialized.
* @return @c true if instance has been initialized
*/
explicit operator bool() const noexcept {
return isInitialized();
}
friend class core;
};
/** @}*/
Expand Down
8 changes: 3 additions & 5 deletions src/include/input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ namespace qOS {
* @param[in] inputChannel The specified channel(pin) number to read.
* @param[in] invert To invert/negate the raw-reading.
*/
digitalChannel( const uint8_t inputChannel, bool invert = false ) : channel( inputChannel ), negate( invert) {}
explicit digitalChannel( const uint8_t inputChannel, bool invert = false ) : channel( inputChannel ), negate( invert) {}
/**
* @brief Get the channel type.
* @return The channel type.
Expand Down Expand Up @@ -453,7 +453,7 @@ namespace qOS {
/**
* @brief The digital input-channel watcher class.
*/
class watcher : protected node {
class watcher : protected node, private nonCopyable {
private:
eventCallback_t exception{ nullptr };
list digitalChannels;
Expand All @@ -462,8 +462,6 @@ namespace qOS {
qOS::duration_t debounceTime{ 100_ms };
digitalReaderFcn_t digitalReader{ nullptr };
analogReaderFcn_t analogReader{ nullptr };
watcher( watcher const& ) = delete;
void operator=( watcher const& ) = delete;
public:
/*! @cond */
virtual ~watcher() {}
Expand All @@ -473,7 +471,7 @@ namespace qOS {
* @param[in] timeDebounce The specified time to bypass the
* bounce of the digital input channels
*/
watcher( const qOS::duration_t dt = 100_ms ) : debounceTime( dt ) {}
explicit watcher( const qOS::duration_t dt = 100_ms ) : debounceTime( dt ) {}
/**
* @brief Constructor for the input-watcher instance
* @param[in] rDigital A pointer to a function that reads the specific
Expand Down
9 changes: 8 additions & 1 deletion src/include/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace qOS {
* @brief The class to interface the OS
* @note Use the predefined os instance
*/
class core final : protected taskEvent {
class core final : protected taskEvent, private nonCopyable {
private:
task idle;
taskFcn_t releaseSchedCallback{ nullptr };
Expand Down Expand Up @@ -452,6 +452,13 @@ namespace qOS {
* @return Returns @c true if success, otherwise returns @c false.
*/
bool remove( input::watcher &w ) noexcept;
/**
* @brief Check if the OS instance has been initialized.
* @return @c true if OS instance has been initialized
*/
explicit operator bool() const noexcept {
return ( 0U == idle.entry );
}
};
/** @brief The predefined instance of the OS kernel interface */
extern core& os; // skipcq: CXX-W2011, CXX-W2009
Expand Down
9 changes: 8 additions & 1 deletion src/include/list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace qOS {
* @brief Get a pointer to the list in which this node is contained.
* @return A pointer to the list container.
*/
inline list* getContainer( void ) noexcept
inline list* getContainer( void ) const noexcept
{
return container;
}
Expand Down Expand Up @@ -249,6 +249,13 @@ namespace qOS {
* @return An iterator to the @a offset of the sequence container.
*/
listIterator from( void *offset ) noexcept;
/**
* @brief Check if the list has items (is non-empty).
* @return @c true if instance has items
*/
explicit operator bool() const noexcept {
return ( nullptr != head );
}
friend class listIterator;
};

Expand Down
2 changes: 1 addition & 1 deletion src/include/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ namespace qOS {
extern const char * const wht;

/*! @cond */
class _logger final {
class _logger final : private nonCopyable {
private:
_logger() = default;
_logger( _logger &other ) = delete;
Expand Down
14 changes: 14 additions & 0 deletions src/include/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ namespace qOS {
* @return The size of the unallocated heap.
*/
size_t getFreeSize( void ) const noexcept;
/**
* @brief Check if the memory pool instance has been initialized.
* @return @c true if instance has been initialized
*/
bool isInitialized( void ) const {
return ( nullptr != poolMemory ) && ( poolMemSize > 0U );
}
/**
* @brief Check if the memory pool instance has been initialized.
* @return @c true if instance has been initialized
*/
explicit operator bool() const noexcept {
return isInitialized();
}
};

/** @}*/
Expand Down
2 changes: 1 addition & 1 deletion src/include/prioqueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace qOS {
};
}

class prioQueue {
class prioQueue : private nonCopyable {
private:
volatile base_t index{ -1 };
void *data{ nullptr };
Expand Down
11 changes: 8 additions & 3 deletions src/include/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace qOS {
* writer and could be statically allocated at compile time or in run-time
* using the memory management extension.
*/
class queue {
class queue : private nonCopyable {
private:
uint8_t *head{ nullptr };
uint8_t *tail{ nullptr };
Expand All @@ -53,8 +53,6 @@ namespace qOS {
void moveReader( void ) noexcept;
void copyDataFromQueue( void * const dst ) noexcept;
void copyDataToQueue( const void *itemToQueue, const queueSendMode xPosition ) noexcept;
queue( queue const& ) = delete;
void operator=( queue const& ) = delete;
public:
queue() = default;
/*! @cond */
Expand Down Expand Up @@ -148,6 +146,13 @@ namespace qOS {
*/
bool isInitialized( void ) const noexcept;
/**
* @brief Check if the queue is already initialized by using queue::setup()
* @return @c true if the queue is initialized, @c false if not.
*/
explicit operator bool() const noexcept {
return isInitialized();
}
/**
* @brief Get the size(in bytes) used for every item in the queue.
* @return The item-size in bytes.
*/
Expand Down
12 changes: 9 additions & 3 deletions src/include/response.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ namespace qOS {
/**
* @brief A Response Handler object.
*/
class response {
class response : private nonCopyable {
private:
char *pattern2Match{ nullptr };
timer timeout;
size_t maxStrLength{ 0U };
size_t patternLength{ 0U };
volatile size_t matchedCount{ 0U };
volatile bool responseReceived{ false };
response( response const& ) = delete;
void operator=( response const& ) = delete;
public:
response() = default;
/*! @cond */
Expand Down Expand Up @@ -75,6 +73,14 @@ namespace qOS {
* @return @c true if the response object is initialized, @c false if not.
*/
bool isInitialized( void ) const noexcept;
/**
* @brief Check if the response object is already initialized by
* using response::setup()
* @return @c true if the response object is initialized, @c false if not.
*/
explicit operator bool() const noexcept {
return isInitialized();
}
};

/** @}*/
Expand Down
Loading
Loading