Chromium Code Reviews| 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..72ba9fab63c981371a81f46834cab47a4520eb83 |
| --- /dev/null |
| +++ b/components/physical_web/eddystone/eddystone_encoder.h |
| @@ -0,0 +1,34 @@ |
| +// 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; |
| +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. |
|
Olivier
2017/03/13 11:57:56
s/Url/URL for consistency
iankc
2017/03/13 17:53:01
Done.
|
| + * kInvalidFormat If the URL parameter is not a standard HTTPS or HTTP URL. |
|
Olivier
2017/03/13 11:57:55
or is IP URL.
iankc
2017/03/13 17:53:01
Acknowledged.
|
| + * 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_ |