-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First public commit (version 2.1.16308)
- Loading branch information
1 parent
57066b4
commit 0848965
Showing
15 changed files
with
2,390 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/**************************************************************************/ | ||
/*! | ||
@file BaseDefinitions.h | ||
@author Sebastien Warin (http://sebastien.warin.fr) | ||
@version 2.1.16296 | ||
@section LICENSE | ||
Constellation License Agreement | ||
Copyright (c) 2015-2016, Sebastien Warin | ||
All rights reserved. | ||
By receiving, opening the file package, and/or using Constellation 1.8("Software") | ||
containing this software, you agree that this End User User License Agreement(EULA) | ||
is a legally binding and valid contract and agree to be bound by it. | ||
You agree to abide by the intellectual property laws and all of the terms and | ||
conditions of this Agreement. | ||
http://www.myconstellation.io/license.txt | ||
*/ | ||
/**************************************************************************/ | ||
|
||
#ifndef _CONSTELLATION_DEFINITIONS_ | ||
#define _CONSTELLATION_DEFINITIONS_ | ||
|
||
#define HTTP_OK 200 | ||
#define HTTP_NO_CONTENT 204 | ||
|
||
#define WILDCARD "*" | ||
|
||
#define MESSAGE_CALLBACK_SIGNATURE void (*msgCallback)(JsonObject&) | ||
#define MESSAGE_CALLBACK_WCONTEXT_SIGNATURE void (*msgCallbackWithContext)(JsonObject&, MessageContext) | ||
#define STATEOBJECT_CALLBACK_SIGNATURE void (*soCallback)(JsonObject&) | ||
|
||
enum ScopeType : uint8_t { | ||
None = 0, | ||
Group = 1, | ||
Package = 2, | ||
Sentinel = 3, | ||
Other = 4, | ||
All = 5 | ||
}; | ||
|
||
enum LogLevel : uint8_t { | ||
LevelNone = 0, | ||
LevelInfo = 1, | ||
LevelWarn = 2, | ||
LevelError = 3 | ||
}; | ||
|
||
enum SenderType : uint8_t { | ||
ConsumerHub = 0, | ||
ConsumerHttp = 1, | ||
ConstellationHub = 2, | ||
ConstellationHttp = 3 | ||
}; | ||
|
||
enum DescriptorType : uint8_t { | ||
MessageCallbackType = 1, | ||
StateObjectType = 2 | ||
}; | ||
|
||
enum DebugMode : uint8_t { | ||
Off = 0, | ||
Error = 1, | ||
Info = 2, | ||
Debug = 3, | ||
Trace = 4 | ||
}; | ||
|
||
typedef struct { | ||
SenderType type; | ||
const char* friendlyName; | ||
const char* connectionId; | ||
} MessageSender; | ||
|
||
typedef struct { | ||
const char* sagaId; | ||
bool isSaga; | ||
const char* messageKey; | ||
MessageSender sender; | ||
ScopeType scope; | ||
} MessageContext; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/**************************************************************************/ | ||
/*! | ||
@file BufferedPrint.h | ||
@author Benoît Blanchon (https://github.com/bblanchon/ArduinoJson) | ||
@section LICENSE | ||
Copyright Benoit Blanchon 2014-2016 | ||
MIT License | ||
Arduino JSON library | ||
https://github.com/bblanchon/ArduinoJson | ||
*/ | ||
/**************************************************************************/ | ||
|
||
#ifndef _BUFFERED_PRINT_ | ||
#define _BUFFERED_PRINT_ | ||
|
||
#include <Client.h> | ||
|
||
template <size_t CAPACITY> | ||
class BufferedPrint : public Print { | ||
public: | ||
BufferedPrint(Print& destination) : _destination(destination), _size(0) {} | ||
|
||
~BufferedPrint() { flush(); } | ||
|
||
virtual size_t write(uint8_t c) { | ||
_buffer[_size++] = c; | ||
|
||
if (_size + 1 == CAPACITY) { | ||
flush(); | ||
} | ||
} | ||
|
||
void flush() { | ||
_buffer[_size] = '\0'; | ||
_destination.print(_buffer); | ||
_size = 0; | ||
if(_debug && Serial) { | ||
Serial.print(_buffer); | ||
} | ||
} | ||
|
||
void setDebug(bool debug) { | ||
_debug = debug; | ||
} | ||
|
||
private: | ||
Print& _destination; | ||
size_t _size; | ||
char _buffer[CAPACITY]; | ||
bool _debug; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.