Skip to content

Instantly share code, notes, and snippets.

View timgrossmann's full-sized avatar
🌱
Evolve

Tim Großmann timgrossmann

🌱
Evolve
View GitHub Profile

CAP3 Dev Bites Ideas

Funktionen

Vermeide Seiteneffekte (bei Methoden)

Verbessert:

  • Testbarkeit
  • Debugging
  • Refactoring
import todolist_pb2 as TodoList
my_list = TodoList.TodoList()
my_list.owner_id = 1234
# ...
with open("./serializedFile", "wb") as fd:
fd.write(my_list.SerializeToString())
owner_id: 1234
owner_name: "Tim"
todos {
state: TASK_DONE
task: "Test ProtoBuf for Python"
due_date: "31.10.2019"
}
import todolist_pb2 as TodoList
my_list = TodoList.TodoList()
my_list.owner_id = 1234
my_list.owner_name = "Tim"
first_item = my_list.todos.add()
first_item.state = TodoList.TaskState.Value("TASK_DONE")
first_item.task = "Test ProtoBuf for Python"
first_item.due_date = "31.10.2019"
syntax = "proto3";
// Not necessary for Python but should still be declared to avoid name collisions
// in the Protocol Buffers namespace and non-Python languages
package protoblog;
message TodoList {
int32 owner_id = 1;
string owner_name = 2;
repeated string todos = 3;
syntax = "proto3";
// Not necessary for Python but should still be declared to avoid name collisions
// in the Protocol Buffers namespace and non-Python languages
package protoblog;
// Style guide prefers prefixing enum values instead of surrounding
// with an enclosing message
enum TaskState {
TASK_OPEN = 0;
package main;
import platforms.xdk110;
setup net : WLAN {
ssid = "TeamVorto";
authentication = Personal(psk = "****");
}
setup backend : MQTT {
transport = net;
{
"headers": {
"response-required": false
},
"path": "/features/timestamp/properties",
"topic": "com.timgrossmann/pmsm0815/things/twin/commands/modify",
"value": {
"status": {
"timestamp": 1564389756
}
{
"profile_id": {
"status": {
"id": 63
}
},
"ambient": {
"status": {
"unit": "C",
"value": 0.6614805
{
"strator_yoke": {
"status": {
"unit": "C",
"value": 1.6673933
}
},
"strator_tooth": {
"status": {
"unit": "C",