/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! \file status_codes.h \brief Global status codes and related macros. */ #pragma once #include //! Status codes. See \ref status_t typedef enum StatusCode { //! Operation completed successfully. S_SUCCESS = 0, //! An error occurred (no description). E_ERROR = -1, //! No idea what went wrong. E_UNKNOWN = -2, //! There was a generic internal logic error. E_INTERNAL = -3, //! The function was not called correctly. E_INVALID_ARGUMENT = -4, //! Insufficient allocatable memory available. E_OUT_OF_MEMORY = -5, //! Insufficient long-term storage available. E_OUT_OF_STORAGE = -6, //! Insufficient resources available. E_OUT_OF_RESOURCES = -7, //! Argument out of range (may be dynamic). E_RANGE = -8, //! Target of operation does not exist. E_DOES_NOT_EXIST = -9, //! Operation not allowed (may depend on state). E_INVALID_OPERATION = -10, //! Another operation prevented this one. E_BUSY = -11, //! Operation not completed; try again. E_AGAIN = -12, //! Equivalent of boolean true. S_TRUE = 1, //! Equivalent of boolean false. S_FALSE = 0, //! For list-style requests. At end of list. S_NO_MORE_ITEMS = 2, //! No action was taken as none was required. S_NO_ACTION_REQUIRED = 3, } StatusCode; // Use the int-sized int from the watch's processor. //! Return value for system operations. See \ref StatusCode for possible values. typedef int32_t status_t; #define DECLARE_DOMAIN_STATUS(e) ((status_t)(e & (1 << 30))) #define PASSED(s) ((status_t)(s) >= 0) #define FAILED(s) ((status_t)(s) < 0)