1// Copyright 2015 The Weave Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef LIBWEAVE_SRC_UTILS_H_
6#define LIBWEAVE_SRC_UTILS_H_
7
8#include <memory>
9#include <string>
10
11#include <base/values.h>
12#include <weave/error.h>
13
14namespace weave {
15
16namespace errors {
17extern const char kSchemaError[];
18extern const char kInvalidCategoryError[];
19extern const char kInvalidPackageError[];
20}  // namespace errors
21
22// kDefaultCategory represents a default state property category for standard
23// properties from "base" package which are provided by buffet and not any of
24// the daemons running on the device.
25const char kDefaultCategory[] = "";
26
27// Helper function to load a JSON dictionary from a string.
28std::unique_ptr<base::DictionaryValue> LoadJsonDict(
29    const std::string& json_string,
30    ErrorPtr* error);
31
32std::unique_ptr<base::DictionaryValue> ErrorInfoToJson(const Error& error);
33
34}  // namespace weave
35
36#endif  // LIBWEAVE_SRC_UTILS_H_
37