Skip to content

Commit ebb5194

Browse files
committed
added support for writing to bucket directly
1 parent 577c02e commit ebb5194

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=thinger.io
2-
version=2.6.1
2+
version=2.7.1
33
author=Alvaro Luis Bustamante <[email protected]>
44
maintainer=Thinger.io <[email protected]>
55
sentence=Arduino library for the Thinger.io Internet of Things Platform.

src/thinger/thinger.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,26 @@ namespace thinger{
158158
return call_endpoint(endpoint_name, resources_[resource_name]);
159159
}
160160

161+
bool write_bucket(const char* bucket_id, pson& data){
162+
thinger_message message;
163+
message.set_signal_flag(thinger_message::BUCKET_DATA);
164+
message.set_identifier(bucket_id);
165+
message.set_data(data);
166+
return send_message(message);
167+
}
168+
169+
bool write_bucket(const char* bucket_id, thinger_resource& resource){
170+
thinger_message message;
171+
message.set_signal_flag(thinger_message::BUCKET_DATA);
172+
message.set_identifier(bucket_id);
173+
resource.fill_output(message.get_data());
174+
return send_message(message);
175+
}
176+
177+
bool write_bucket(const char* bucket_id, const char* resource_name){
178+
return write_bucket(bucket_id, resources_[resource_name]);
179+
}
180+
161181
/**
162182
* Stream the given resource. This resource should be previously requested by an external process.
163183
* Otherwise, the resource will not be streamed as nothing will be listening for it.

0 commit comments

Comments
 (0)