2 * This file is part of the libjaylink project.
4 * Copyright (C) 2014-2015 Marc Schink <jaylink-dev@marcschink.de>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "libjaylink.h"
29 * Return a human-readable description of a libjaylink error code.
31 * @param[in] error_code A libjaylink error code. See #jaylink_error for valid
34 * @return A string which describes the given error code, or the string
35 * <i>unknown error</i> if the error code is not known. The string is
36 * null-terminated and must not be free'd by the caller.
40 JAYLINK_API
const char *jaylink_strerror(int error_code
)
46 return "unspecified error";
48 return "invalid argument";
49 case JAYLINK_ERR_MALLOC
:
50 return "memory allocation error";
51 case JAYLINK_ERR_TIMEOUT
:
52 return "timeout occurred";
53 case JAYLINK_ERR_PROTO
:
54 return "protocol violation";
55 case JAYLINK_ERR_NOT_AVAILABLE
:
56 return "entity not available";
57 case JAYLINK_ERR_NOT_SUPPORTED
:
58 return "operation not supported";
60 return "input/output error";
62 return "device: unspecified error";
63 case JAYLINK_ERR_DEV_NOT_SUPPORTED
:
64 return "device: operation not supported";
65 case JAYLINK_ERR_DEV_NOT_AVAILABLE
:
66 return "device: entity not available";
67 case JAYLINK_ERR_DEV_NO_MEMORY
:
68 return "device: not enough memory to perform operation";
70 return "unknown error";
75 * Return the name of a libjaylink error code.
77 * @param[in] error_code A libjaylink error code. See #jaylink_error for valid
80 * @return A string which contains the name for the given error code, or the
81 * string <i>unknown error code</i> if the error code is not known. The
82 * string is null-terminated and must not be free'd by the caller.
86 JAYLINK_API
const char *jaylink_strerror_name(int error_code
)
94 return "JAYLINK_ERR_ARG";
95 case JAYLINK_ERR_MALLOC
:
96 return "JAYLINK_ERR_MALLOC";
97 case JAYLINK_ERR_TIMEOUT
:
98 return "JAYLINK_ERR_TIMEOUT";
99 case JAYLINK_ERR_PROTO
:
100 return "JAYLINK_ERR_PROTO";
101 case JAYLINK_ERR_NOT_AVAILABLE
:
102 return "JAYLINK_ERR_NOT_AVAILABLE";
103 case JAYLINK_ERR_NOT_SUPPORTED
:
104 return "JAYLINK_ERR_NOT_SUPPORTED";
106 return "JAYLINK_ERR_IO";
107 case JAYLINK_ERR_DEV
:
108 return "JAYLINK_ERR_DEV";
109 case JAYLINK_ERR_DEV_NOT_SUPPORTED
:
110 return "JAYLINK_ERR_DEV_NOT_SUPPORTED";
111 case JAYLINK_ERR_DEV_NOT_AVAILABLE
:
112 return "JAYLINK_ERR_DEV_NOT_AVAILABLE";
113 case JAYLINK_ERR_DEV_NO_MEMORY
:
114 return "JAYLINK_ERR_DEV_NO_MEMORY";
116 return "unknown error code";