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

Unified Diff: components/physical_web/eddystone/eddystone_encoder.h

Issue 2731273004: Add Platform Independent Eddystone Encoder (Closed)
Patch Set: Matts Nits Part 2 Created 3 years, 9 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 | « components/physical_web/eddystone/BUILD.gn ('k') | components/physical_web/eddystone/eddystone_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/physical_web/eddystone/eddystone_encoder.h
diff --git a/components/physical_web/eddystone/eddystone_encoder.h b/components/physical_web/eddystone/eddystone_encoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..9564f11b53b01e4c8269d4f8959ec20cf8f6a375
--- /dev/null
+++ b/components/physical_web/eddystone/eddystone_encoder.h
@@ -0,0 +1,32 @@
+// Copyright 2017 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 COMPONENTS_PHYSICAL_WEB_EDDYSTONE_EDDYSTONE_ENCODER_H_
+#define COMPONENTS_PHYSICAL_WEB_EDDYSTONE_EDDYSTONE_ENCODER_H_
+
+#include <string>
+#include <vector>
+
+namespace physical_web {
+const int kEmptyURL = -1;
+const int kInvalidURL = -2;
mattreynolds 2017/03/09 23:39:48 In C++, use "Url" when including an initialism in
iankc 2017/03/10 22:28:45 Done.
+const int kInvalidFormat = -3;
+const int kNullEncodedUrl = -4;
+/*
+ * EncodeUrl takes a URL in the form of a std::string and
+ * a pointer to a uint8_t vector to populate with the eddystone
+ * encoding of the URL.
+ * Returns:
+ * kEmptyURL If the URL parameter is empty.
+ * kInvalidURL If the URL parameter is not a valid Url.
+ * kInvalidFormat If the URL parameter is not a standard HTTPS or HTTP URL.
+ * kNullEncodedUrl If the encoded_url vector is NULL.
+ * Length of encoded URL.
+ * Eddystone spec can be found here:
+ * https://github.com/google/eddystone/blob/master/protocol-specification.md
+ */
+int EncodeUrl(const std::string& url, std::vector<uint8_t>* encoded_url);
+}
+
+#endif // COMPONENTS_PHYSICAL_WEB_EDDYSTONE_EDDYSTONE_ENCODER_H_
« no previous file with comments | « components/physical_web/eddystone/BUILD.gn ('k') | components/physical_web/eddystone/eddystone_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698