add fields for ratelimit testing
This commit is contained in:
parent
69f3bf1db0
commit
18b33946b5
@ -19,6 +19,7 @@ Blockly.Blocks["sensebox_osem_connection"] = {
|
||||
this.setColour(getColour().sensebox);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.senseBox_osem_connection)
|
||||
.appendField( new Blockly.FieldDropdown([[Blockly.Msg.senseBox_osem_host, "opensensemap.org"], [Blockly.Msg.senseBox_osem_host_testing, "testing.opensensemap.org"]]), "HOST")
|
||||
.appendField("SSL")
|
||||
.appendField(new Blockly.FieldCheckbox(ssl), "SSL");
|
||||
this.appendDummyInput()
|
||||
@ -53,6 +54,10 @@ Blockly.Blocks["sensebox_osem_connection"] = {
|
||||
.setAlign(Blockly.ALIGN_LEFT)
|
||||
.appendField(Blockly.Msg.senseBox_osem_access_token)
|
||||
.appendField(new Blockly.FieldTextInput("access_token"), "access_token");
|
||||
this.appendDummyInput()
|
||||
.setAlign(Blockly.ALIGN_LEFT)
|
||||
.appendField(Blockly.Msg.senseBox_osem_xallowtoken)
|
||||
.appendField(new Blockly.FieldTextInput("ratelimit-token"), "ratelimit-token");
|
||||
this.appendStatementInput("DO")
|
||||
.appendField(Blockly.Msg.senseBox_sensor)
|
||||
.setCheck(null);
|
||||
|
@ -30,6 +30,8 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
|
||||
var box_id = this.getFieldValue("BoxID");
|
||||
var branch = Blockly.Arduino.statementToCode(Block, "DO");
|
||||
var access_token = this.getFieldValue("access_token");
|
||||
var host = this.getFieldValue("HOST");
|
||||
var ratelimit_token = this.getFieldValue("ratelimit-token");
|
||||
var blocks = this.getDescendants();
|
||||
var type = this.getFieldValue("type");
|
||||
var ssl = this.getFieldValue("SSL");
|
||||
@ -50,7 +52,7 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
|
||||
Blockly.Arduino.definitions_["SenseBoxID"] =
|
||||
'const char SENSEBOX_ID [] PROGMEM = "' + box_id + '";';
|
||||
Blockly.Arduino.definitions_["host"] =
|
||||
'const char server [] PROGMEM ="ingress.opensensemap.org";';
|
||||
`const char server [] PROGMEM ="ingress.${host}";`;
|
||||
if (wifi === true) {
|
||||
if (ssl === "TRUE") {
|
||||
Blockly.Arduino.libraries_["library_bearSSL"] =
|
||||
@ -154,7 +156,7 @@ ${
|
||||
if (connected == true) {
|
||||
// construct the HTTP POST request:
|
||||
sprintf_P(buffer,
|
||||
PSTR("POST /boxes/%s/data HTTP/1.1\\nAuthorization: ${access_token}\\nHost: %s\\nContent-Type: "
|
||||
PSTR("POST /boxes/%s/data HTTP/1.1\\nAuthorization: ${access_token}\\nX-Allow-Token: ${ratelimit_token}\\nHost: %s\\nContent-Type: "
|
||||
"text/csv\\nConnection: close\\nContent-Length: %i\\n\\n"),
|
||||
SENSEBOX_ID, server, num_measurements * lengthMultiplikator);
|
||||
// send the HTTP POST request:
|
||||
@ -253,7 +255,7 @@ ${
|
||||
if (connected == true) {
|
||||
// construct the HTTP POST request:
|
||||
sprintf_P(buffer,
|
||||
PSTR("POST /boxes/%s/data HTTP/1.1\\nAuthorization: ${access_token}\\nHost: %s\\nContent-Type: "
|
||||
PSTR("POST /boxes/%s/data HTTP/1.1\\nAuthorization: ${access_token}\\nX-Allow-Token: ${ratelimit_token}\\nHost: %s\\nContent-Type: "
|
||||
"text/csv\\nConnection: close\\nContent-Length: %i\\n\\n"),
|
||||
SENSEBOX_ID, server, num_measurements * lengthMultiplikator);
|
||||
// send the HTTP POST request:
|
||||
|
@ -10,11 +10,12 @@ export const OSEM = {
|
||||
senseBox_send_to_osem: "Sende Messwert an die openSenseMap",
|
||||
senseBox_osem_connection: "Verbinde mit openSenseMap:",
|
||||
senseBox_osem_host: "opensensemap.org",
|
||||
senseBox_osem_host_workshop: "workshop.opensensemap.org",
|
||||
senseBox_osem_host_testing: "testing.opensensemap.org",
|
||||
senseBox_osem_exposure: "Typ",
|
||||
senseBox_osem_stationary: "Stationär",
|
||||
senseBox_osem_mobile: "Mobil",
|
||||
senseBox_osem_access_token: "API Schlüssel",
|
||||
senseBox_osem_xallowtoken: "X-ALLOW-TOKEN",
|
||||
senseBox_send_mobile_to_osem:
|
||||
"Sende Messwert und Standort an die openSenseMap",
|
||||
senseBox_send_mobile_to_osem_tip:
|
||||
|
@ -11,11 +11,12 @@ export const OSEM = {
|
||||
senseBox_send_to_osem: "Send measurement to openSenseMap",
|
||||
senseBox_osem_connection: "Connect to openSenseMap",
|
||||
senseBox_osem_host: "opensensemap.org",
|
||||
senseBox_osem_host_workshop: "workshop.opensensemap.org",
|
||||
senseBox_osem_host_testing: "testing.opensensemap.org",
|
||||
senseBox_osem_exposure: "Type",
|
||||
senseBox_osem_stationary: "Stationary",
|
||||
senseBox_osem_mobile: "Mobile",
|
||||
senseBox_osem_access_token: "API Key",
|
||||
senseBox_osem_xallowtoken: "X-ALLOW-TOKEN",
|
||||
senseBox_send_mobile_to_osem: "Send measurement and location to openSenseMap",
|
||||
senseBox_send_mobile_to_osem_tip: "Send Value and Location to openSenseMap",
|
||||
senseBox_osem_restart: "Restart device if disconnected?",
|
||||
|
Loading…
x
Reference in New Issue
Block a user