Skip to content

Commit 1a66a76

Browse files
committed
Renamed from Pachube to Cosm
1 parent d094b42 commit 1a66a76

File tree

15 files changed

+126
-128
lines changed

15 files changed

+126
-128
lines changed

Cosm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
#include <CosmDatastream.h>
3+
#include <CosmFeed.h>
4+
#include <CosmClient.h>
5+

PachubeClient.cpp renamed to CosmClient.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
#include <Pachube.h>
1+
#include <Cosm.h>
22
#include <HttpClient.h>
33
#include <CountingStream.h>
44

5-
PachubeClient::PachubeClient(Client& aClient)
5+
CosmClient::CosmClient(Client& aClient)
66
: _client(aClient)
77
{
88
}
99

10-
int PachubeClient::put(PachubeFeed& aFeed, const char* aApiKey)
10+
int CosmClient::put(CosmFeed& aFeed, const char* aApiKey)
1111
{
1212
HttpClient http(_client);
1313
char path[30];
1414
buildPath(path, aFeed.id(), "json");
1515
http.beginRequest();
16-
int ret = http.put("api.pachube.com", path);
16+
int ret = http.put("api.cosm.com", path);
1717
if (ret == 0)
1818
{
19-
http.sendHeader("X-PachubeApiKey", aApiKey);
19+
http.sendHeader("X-CosmApiKey", aApiKey);
2020

2121
CountingStream countingStream; // Used to work out how long that data will be
2222
for (int i =kCalculateDataLength; i <= kSendData; i++)
@@ -55,7 +55,7 @@ int PachubeClient::put(PachubeFeed& aFeed, const char* aApiKey)
5555
return ret;
5656
}
5757

58-
void PachubeClient::buildPath(char* aDest, unsigned long aFeedId, const char* aFormat)
58+
void CosmClient::buildPath(char* aDest, unsigned long aFeedId, const char* aFormat)
5959
{
6060
char idstr[12];
6161
strcpy(aDest, "/v2/feeds/");
@@ -67,16 +67,16 @@ void PachubeClient::buildPath(char* aDest, unsigned long aFeedId, const char* aF
6767
strcat(aDest, aFormat);
6868
}
6969

70-
int PachubeClient::get(PachubeFeed& aFeed, const char* aApiKey)
70+
int CosmClient::get(CosmFeed& aFeed, const char* aApiKey)
7171
{
7272
HttpClient http(_client);
7373
char path[30];
7474
buildPath(path, aFeed.id(), "csv");
7575
http.beginRequest();
76-
int ret = http.get("api.pachube.com", path);
76+
int ret = http.get("api.cosm.com", path);
7777
if (ret == 0)
7878
{
79-
http.sendHeader("X-PachubeApiKey", aApiKey);
79+
http.sendHeader("X-CosmApiKey", aApiKey);
8080
http.endRequest();
8181

8282
ret = http.responseStatusCode();

CosmClient.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
#ifndef COSMCLIENT_H
3+
#define COSMCLIENT_H
4+
5+
#include <Client.h>
6+
#include <CosmFeed.h>
7+
8+
class CosmClient
9+
{
10+
public:
11+
CosmClient(Client& aClient);
12+
13+
int get(CosmFeed& aFeed, const char* aApiKey);
14+
int put(CosmFeed& aFeed, const char* aApiKey);
15+
16+
protected:
17+
static const int kCalculateDataLength =0;
18+
static const int kSendData =1;
19+
void buildPath(char* aDest, unsigned long aFeedId, const char* aFormat);
20+
21+
Client& _client;
22+
};
23+
24+
#endif

PachubeDatastream.cpp renamed to CosmDatastream.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
#include <PachubeDatastream.h>
1+
#include <CosmDatastream.h>
22

3-
Datastream::Datastream(String& aId, int aType)
3+
CosmDatastream::CosmDatastream(String& aId, int aType)
44
: _idType(DATASTREAM_STRING), _valueType(aType), _idString(aId)
55
{
66
}
77

8-
Datastream::Datastream(char* aIdBuffer, int aIdBufferSize, int aType)
8+
CosmDatastream::CosmDatastream(char* aIdBuffer, int aIdBufferSize, int aType)
99
: _idType(DATASTREAM_BUFFER), _valueType(aType), _idString(), _valueString()
1010
{
1111
_idBuffer._buffer = aIdBuffer;
1212
_idBuffer._bufferSize = aIdBufferSize;
1313
}
1414

15-
Datastream::Datastream(char* aIdBuffer, int aIdBufferSize, int aType, char* aValueBuffer, int aValueBufferSize)
15+
CosmDatastream::CosmDatastream(char* aIdBuffer, int aIdBufferSize, int aType, char* aValueBuffer, int aValueBufferSize)
1616
: _idType(DATASTREAM_BUFFER), _valueType(aType)
1717
{
1818
_idBuffer._buffer = aIdBuffer;
@@ -21,7 +21,7 @@ Datastream::Datastream(char* aIdBuffer, int aIdBufferSize, int aType, char* aVal
2121
_value._valueBuffer._bufferSize = aValueBufferSize;
2222
}
2323

24-
int Datastream::updateValue(Stream& aStream)
24+
int CosmDatastream::updateValue(Stream& aStream)
2525
{
2626
switch (_valueType)
2727
{
@@ -43,39 +43,39 @@ int Datastream::updateValue(Stream& aStream)
4343
};
4444
}
4545

46-
void Datastream::setInt(int aValue)
46+
void CosmDatastream::setInt(int aValue)
4747
{
4848
if (_valueType == DATASTREAM_INT)
4949
{
5050
_value._valueInt = aValue;
5151
}
5252
}
5353

54-
void Datastream::setFloat(float aValue)
54+
void CosmDatastream::setFloat(float aValue)
5555
{
5656
if (_valueType == DATASTREAM_FLOAT)
5757
{
5858
_value._valueFloat = aValue;
5959
}
6060
}
6161

62-
void Datastream::setString(String& aValue)
62+
void CosmDatastream::setString(String& aValue)
6363
{
6464
if (_valueType == DATASTREAM_STRING)
6565
{
6666
_valueString = aValue;
6767
}
6868
}
6969

70-
void Datastream::setBuffer(const char* aBuffer)
70+
void CosmDatastream::setBuffer(const char* aBuffer)
7171
{
7272
if (_valueType == DATASTREAM_BUFFER)
7373
{
7474
strncpy(_value._valueBuffer._buffer, aBuffer, _value._valueBuffer._bufferSize);
7575
}
7676
}
7777

78-
int Datastream::getInt()
78+
int CosmDatastream::getInt()
7979
{
8080
if (_valueType == DATASTREAM_INT)
8181
{
@@ -87,7 +87,7 @@ int Datastream::getInt()
8787
}
8888
}
8989

90-
float Datastream::getFloat()
90+
float CosmDatastream::getFloat()
9191
{
9292
if (_valueType == DATASTREAM_FLOAT)
9393
{
@@ -99,12 +99,12 @@ float Datastream::getFloat()
9999
}
100100
}
101101

102-
String& Datastream::getString()
102+
String& CosmDatastream::getString()
103103
{
104104
return _valueString;
105105
}
106106

107-
char* Datastream::getBuffer()
107+
char* CosmDatastream::getBuffer()
108108
{
109109
if (_valueType == DATASTREAM_BUFFER)
110110
{
@@ -116,7 +116,7 @@ char* Datastream::getBuffer()
116116
}
117117
}
118118

119-
size_t Datastream::printTo(Print& aPrint) const
119+
size_t CosmDatastream::printTo(Print& aPrint) const
120120
{
121121
size_t count =0;
122122
count += aPrint.print("{ \"id\" : \"");

PachubeDatastream.h renamed to CosmDatastream.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef PACHUBE_DATASTREAM_H
2-
#define PACHUBE_DATASTREAM_H
1+
#ifndef COSM_DATASTREAM_H
2+
#define COSM_DATASTREAM_H
33

44
#include <Stream.h>
55
#include <Printable.h>
@@ -9,18 +9,18 @@
99
#define DATASTREAM_INT 2
1010
#define DATASTREAM_FLOAT 3
1111

12-
class Datastream : public Printable {
13-
friend class PachubeClient;
12+
class CosmDatastream : public Printable {
13+
friend class CosmClient;
1414

1515
typedef struct {
1616
char* _buffer;
1717
int _bufferSize;
1818
} tBuffer;
1919
public:
2020

21-
Datastream(String& aId, int aType);
22-
Datastream(char* aIdBuffer, int aIdBufferLength, int aType);
23-
Datastream(char* aIdBuffer, int aIdBufferLength, int aType, char* aValueBuffer, int aValueBufferLength);
21+
CosmDatastream(String& aId, int aType);
22+
CosmDatastream(char* aIdBuffer, int aIdBufferLength, int aType);
23+
CosmDatastream(char* aIdBuffer, int aIdBufferLength, int aType, char* aValueBuffer, int aValueBufferLength);
2424
int updateValue(Stream& aStream);
2525
void setInt(int aValue);
2626
void setFloat(float aValue);

PachubeFeed.cpp renamed to CosmFeed.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#include <Pachube.h>
1+
#include <Cosm.h>
22

3-
PachubeFeed::PachubeFeed(unsigned long aID, Datastream* aDatastreams, int aDatastreamsCount)
3+
CosmFeed::CosmFeed(unsigned long aID, CosmDatastream* aDatastreams, int aDatastreamsCount)
44
: _id(aID), _datastreams(aDatastreams), _datastreamsCount(aDatastreamsCount)
55
{
66
//strcpy(_id, aID);
77
}
88

9-
size_t PachubeFeed::printTo(Print& aPrint) const
9+
size_t CosmFeed::printTo(Print& aPrint) const
1010
{
1111
int len = 0;
1212
len += aPrint.println("{");

CosmFeed.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
#ifndef COSM_FEED_H
3+
#define COSM_FEED_H
4+
5+
#include <Client.h>
6+
#include <CosmDatastream.h>
7+
#include <Printable.h>
8+
9+
class CosmFeed : public Printable
10+
{
11+
public:
12+
CosmFeed(unsigned long aID, CosmDatastream* aDatastreams, int aDatastreamsCount);
13+
14+
virtual size_t printTo(Print&) const;
15+
unsigned long id() { return _id; };
16+
int size() { return _datastreamsCount; };
17+
CosmDatastream& operator[] (unsigned i) { return _datastreams[i]; };
18+
protected:
19+
unsigned long _id;
20+
CosmDatastream* _datastreams;
21+
int _datastreamsCount;
22+
};
23+
24+
#endif
25+

Pachube.h

Lines changed: 0 additions & 5 deletions
This file was deleted.

PachubeClient.h

Lines changed: 0 additions & 24 deletions
This file was deleted.

PachubeFeed.h

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy