Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1834)

Unified Diff: device/bluetooth/uribeacon/uri_encoder.h

Issue 2014813002: Revert of bluetooth: Remove UriBeacon code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/uribeacon/BUILD.gn ('k') | device/bluetooth/uribeacon/uri_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/uribeacon/uri_encoder.h
diff --git a/device/bluetooth/uribeacon/uri_encoder.h b/device/bluetooth/uribeacon/uri_encoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..6bf092a9079bedcae4ad6ce54f7b78ac179d6d7d
--- /dev/null
+++ b/device/bluetooth/uribeacon/uri_encoder.h
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_URIBEACON_URI_ENCODER_H_
+#define DEVICE_BLUETOOTH_URIBEACON_URI_ENCODER_H_
+
+#include <stdint.h>
+
+#include <string>
+#include <vector>
+
+#include "base/strings/string_piece.h"
+
+namespace device {
+
+// The following functions EncodeUriBeaconUri() and DecodeUriBeaconUri() helps
+// encoding/decoding URI with the UriBeacon encoding.
+//
+// Example usage:
+//
+// std::vector<uint8_t> encoded;
+// EncodeUriBeaconUri("http://web.mit.edu/", encoded)
+// // encoded -> {2, 'w', 'e', 'b', '.', 'm', 'i', 't', 2}
+//
+// const char encodedUri[] = {0, 'u', 'r', 'i', 'b', 'e', 'a', 'c', 'o', 'n',
+// 8};
+// const std::vector<uint8_t> kEncodedUri(encodedUri, encodedUri +
+// sizeof(encodedUri));
+// std::string decoded;
+// DecodeUriBeaconUri(kEncodedUri, decoded)
+// // decoded -> "http://uribeacon.org"
+
+// Encodes the input string using URI encoding described in UriBeacon
+// specifications. |input| must be ASCII characters.
+void EncodeUriBeaconUri(const std::string& input, std::vector<uint8_t>& output);
+
+// Decodes the input string using URI encoding described in UriBeacon
+// specifications.
+void DecodeUriBeaconUri(const std::vector<uint8_t>& input, std::string& output);
+
+} // namespace device
+
+#endif
« no previous file with comments | « device/bluetooth/uribeacon/BUILD.gn ('k') | device/bluetooth/uribeacon/uri_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698