/// <summary> /// Upload a new telemetry_doc to Habitat. /// </summary> /// <param name="fullsentence">The full, UKHAS style sentence ($$BLA,,,,,*CHECKSUM)</param> public void uploadTelemetry(string fullsentence) { // This should really really really take into account the fact that // if it already exists, we just want to add our receiver details. // BUT, I can't be bothered since we're always going to be the first // ones to upload it since it won't have been transmitted yet // PLUS, if we're not the first person, then we don't really care // about ensuring the system knows we 'received' it too. string type = "payload_telemetry"; string _raw = Utils.base64ify(fullsentence + "\n"); string id = Utils.sha256ify(_raw); string timecreated = Utils.rfc3339(); string timeuploaded = Utils.rfc3339(); var telemetry_doc = new Dictionary <string, object>() { { "type", type }, { "data", new Dictionary <string, object>() { { "_raw", _raw } } }, { "receivers", new Dictionary <string, object>() { { _callsign, new Dictionary <string, object>() { { "time_created", timecreated }, { "time_uploaded", timeuploaded } } } } } }; string json = JsonConvert.SerializeObject(telemetry_doc); couch.uploadDocument(json, id); }