Tilt Five NDK  1.4.1
errors.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020-2023 Tilt Five, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
21
22#include "errors.h"
23
24#include <system_error>
25
26namespace tiltfive {
27
29// Error //
31
35
37enum class Error {
38 // --------- C Errors ---------
41
44
46 //
50
53
56
59
62
65
68
71
74
77
80
83
86
89
92
95
98
101
104
107
110
113
116
119
122
125
128
131};
132
134
135namespace details {
136
137// Work around the lack of inline variable support.
138template <typename Dummy>
139struct ErrorCategory : std::error_category {
140 [[nodiscard]] auto name() const noexcept -> const char* override {
141 return "Tilt Five Error";
142 }
143
144 [[nodiscard]] auto message(int ev) const -> std::string override {
145 return ::t5GetResultMessage(static_cast<T5_Result>(ev));
146 }
147
148 static const ErrorCategory kSingleton;
149};
150
151template <typename Dummy>
153
154} // namespace details
155
157
158inline std::error_code make_error_code(Error e) noexcept {
159 return {static_cast<int>(e), ErrorCategory::kSingleton};
160}
161
162} // namespace tiltfive
163
164namespace std {
165
166template <>
167struct is_error_code_enum<tiltfive::Error> : true_type {};
168
169} // namespace std
error_code make_error_code(future_errc __errc) noexcept
C errors for the Tilt Five™ API.
uint32_t T5_Result
Represents an error code that may be returned by the Tilt Five™ API.
Definition: errors.h:47
#define T5_ERROR_MISC_REMOTE
Miscellaneous remote error.
Definition: errors.h:99
#define T5_ERROR_DECODE_ERROR
Failed to decode.
Definition: errors.h:111
#define T5_ERROR_INTERNAL
An internal error occurred.
Definition: errors.h:69
#define T5_ERROR_TRY_AGAIN
Target is not currently available.
Definition: errors.h:120
#define T5_ERROR_GFX_CONTEXT_INIT_FAIL
Failed to initialize graphics context.
Definition: errors.h:117
#define T5_ERROR_INVALID_ARGS
Argument(s) are invalid.
Definition: errors.h:81
#define T5_ERROR_NOT_CONNECTED
The target is not connected.
Definition: errors.h:129
#define T5_ERROR_UNAVAILABLE
Target is unavailable.
Definition: errors.h:123
#define T5_ERROR_INVALID_BUFFER_SIZE
Invalid Buffer Size.
Definition: errors.h:141
#define T5_ERROR_SERVICE_INCOMPATIBLE
Service incompatible.
Definition: errors.h:135
#define T5_TIMEOUT
Timeout.
Definition: errors.h:57
#define T5_ERROR_STRING_OVERFLOW
Overflow during string conversion operation.
Definition: errors.h:132
#define T5_ERROR_SETTING_UNKNOWN
The requested param is unknown.
Definition: errors.h:93
#define T5_ERROR_REQUEST_ID_UNKNOWN
Service doesn't understand the request.
Definition: errors.h:78
#define T5_ERROR_DEVICE_LOST
Device lost.
Definition: errors.h:84
T5_EXPORT const char * t5GetResultMessage(T5_Result result)
#define T5_ERROR_SETTING_WRONG_TYPE
The requested param has a different type to the requested type.
Definition: errors.h:96
#define T5_ERROR_NO_SERVICE
Service isn't connected.
Definition: errors.h:72
#define T5_ERROR_UNSUPPORTED
Action is unsupported.
Definition: errors.h:108
#define T5_ERROR_IO_FAILURE
Misc IO failure.
Definition: errors.h:75
#define T5_ERROR_ALREADY_CONNECTED
The target is already connected.
Definition: errors.h:126
#define T5_ERROR_NO_CONTEXT
No context.
Definition: errors.h:63
#define T5_PERMISSION_DENIED
Permission denied.
Definition: errors.h:138
#define T5_ERROR_NO_LIBRARY
No library loaded.
Definition: errors.h:66
#define T5_SUCCESS
Success.
Definition: errors.h:54
#define T5_ERROR_TARGET_NOT_FOUND
Target (wand) not found.
Definition: errors.h:87
#define T5_ERROR_OVERFLOW
Buffer overflow.
Definition: errors.h:102
#define T5_ERROR_GRAPHICS_API_UNAVAILABLE
Specified graphics API is unavailable.
Definition: errors.h:105
#define T5_ERROR_INVALID_GEOMETRY
Invalid Geometry.
Definition: errors.h:144
#define T5_ERROR_INVALID_GFX_CONTEXT
Graphics context is invalid.
Definition: errors.h:114
#define T5_ERROR_INVALID_STATE
Incorrect state for the request.
Definition: errors.h:90
Error
Error codes returned by most functions of return type Result.
Definition: errors.hpp:37
@ kRequestIdUnknown
Service doesn't understand the request.
@ kStringOverflow
String overflow.
@ kServiceIncompatible
Service incompatible.
@ kSettingWrongType
The requested param has a different type to the requested type.
@ kLibraryUnavailable
Library Unavailable.
@ kAlreadyConnected
Target is already connected.
@ kTryAgain
Target is temporarily unavailable.
@ kGfxApiUnavailable
Specified graphics API is unavailable.
@ kNotConnected
Target is not connected.
@ kSettingUnknown
The requested param is unknown.
@ kNoContext
No context.
@ kGfxContextInitFail
Failed to initialize graphics context.
@ kDecodeError
Failed to decode.
@ kDeviceLost
Device lost.
@ kInvalidGfxContext
Graphics context is invalid.
@ kTimeout
Timeout.
@ kInvalidArgument
Argument(s) are invalid.
@ kUnsupported
Action is unsupported.
@ kUnavailable
Target is unavailable.
@ kSuccess
Success.
@ kIoFailure
Misc IO failure.
@ kMiscRemote
Miscellaneous remote error.
@ kInvalidState
Incorrect state for the request.
@ kNoService
Service isn't connected.
@ kOverflow
Buffer overflow.
@ kInvalidGeometry
Invalid geometry.
@ kInvalidBuffer
Invalid buffer size.
@ kPermissionDenied
Permission denied.
@ kTargetNotFound
Target (wand) not found.
@ kInternalError
An internal error occurred.