Skip to content

Commit

Permalink
A few __forceinline changes, HttpRequestAuth code into header
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Feb 18, 2019
1 parent 3e1bbfc commit ccf1165
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Sming/SmingCore/HardwareTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class HardwareTimer
* @retval bool True if timer started
* @note Timer starts and will run for configured period then stop
*/
bool __forceinline IRAM_ATTR startOnce()
__forceinline bool IRAM_ATTR startOnce()
{
return start(false);
}
Expand Down Expand Up @@ -126,7 +126,7 @@ class HardwareTimer
/** @brief Call timer callback
* @note Calls the timer callback function
*/
void __forceinline IRAM_ATTR call()
__forceinline void IRAM_ATTR call()
{
if(callback) {
callback();
Expand Down
16 changes: 0 additions & 16 deletions Sming/SmingCore/Network/Http/HttpRequestAuth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,13 @@
#include "HttpRequest.h"
#include "../Services/WebHelpers/base64.h"

HttpBasicAuth::HttpBasicAuth(const String& username, const String& password)
{
this->username = username;
this->password = password;
}

// Basic Auth
void HttpBasicAuth::setRequest(HttpRequest* request)
{
request->headers[HTTP_HEADER_AUTHORIZATION] = F("Basic ") + base64_encode(username + ':' + password);
}

// Digest Auth
HttpDigestAuth::HttpDigestAuth(const String& username, const String& password)
{
this->username = username;
this->password = password;
}

void HttpDigestAuth::setRequest(HttpRequest* request)
{
this->request = request;
}

void HttpDigestAuth::setResponse(HttpResponse* response)
{
Expand Down
26 changes: 18 additions & 8 deletions Sming/SmingCore/Network/Http/HttpRequestAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,25 @@ class HttpRequest;
class AuthAdapter
{
public:
virtual void setRequest(HttpRequest* request) = 0;

__forceinline virtual void setResponse(HttpResponse* response)
virtual ~AuthAdapter()
{
return;
}

virtual ~AuthAdapter()
virtual void setRequest(HttpRequest* request) = 0;

virtual void setResponse(HttpResponse* response)
{
}
};

class HttpBasicAuth : public AuthAdapter
{
public:
HttpBasicAuth(const String& username, const String& password);
HttpBasicAuth(const String& username, const String& password)
{
this->username = username;
this->password = password;
}

void setRequest(HttpRequest* request);

Expand All @@ -47,9 +50,16 @@ class HttpBasicAuth : public AuthAdapter
class HttpDigestAuth : public AuthAdapter
{
public:
HttpDigestAuth(const String& username, const String& password);
HttpDigestAuth(const String& username, const String& password)
{
this->username = username;
this->password = password;
}

void setRequest(HttpRequest* request);
void setRequest(HttpRequest* request)
{
this->request = request;
}

void setResponse(HttpResponse* response);

Expand Down
2 changes: 1 addition & 1 deletion Sming/SmingCore/Network/TcpConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class TcpConnection

int write(IDataSourceStream* stream);

__forceinline uint16_t getAvailableWriteSize()
uint16_t getAvailableWriteSize()
{
return (canSend && tcp) ? tcp_sndbuf(tcp) : 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Sming/SmingCore/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Timer
/** @brief Start one-shot timer running
* @note Will start timer and trigger once after configured duration.
*/
void __forceinline IRAM_ATTR startOnce()
__forceinline void IRAM_ATTR startOnce()
{
start(false);
}
Expand Down

0 comments on commit ccf1165

Please sign in to comment.