| 1 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- |
| 2 |
* |
| 3 |
* Copyright (C) 2013 Richard Hughes <[email protected]> |
| 4 |
* |
| 5 |
* Licensed under the GNU General Public License Version 2 |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
#include "config.h" |
| 23 |
|
| 24 |
#include <glib.h> |
| 25 |
|
| 26 |
#include "huey-enum.h" |
| 27 |
|
| 28 |
const gchar * |
| 29 |
huey_rc_to_string (guchar value) |
| 30 |
{ |
| 31 |
if (value == HUEY_RC_SUCCESS) |
| 32 |
return "success"; |
| 33 |
if (value == HUEY_RC_LOCKED) |
| 34 |
return "locked"; |
| 35 |
if (value == HUEY_RC_ERROR) |
| 36 |
return "error"; |
| 37 |
if (value == HUEY_RC_RETRY) |
| 38 |
return "retry"; |
| 39 |
if (value == HUEY_RC_UNKNOWN_5A) |
| 40 |
return "unknown5a"; |
| 41 |
if (value == HUEY_RC_UNKNOWN_81) |
| 42 |
return "unknown81"; |
| 43 |
return NULL; |
| 44 |
} |
| 45 |
|
| 46 |
const gchar * |
| 47 |
huey_cmd_code_to_string (guchar value) |
| 48 |
{ |
| 49 |
if (value == HUEY_CMD_GET_STATUS) |
| 50 |
return "get-status"; |
| 51 |
if (value == HUEY_CMD_READ_GREEN) |
| 52 |
return "read-green"; |
| 53 |
if (value == HUEY_CMD_READ_BLUE) |
| 54 |
return "read-blue"; |
| 55 |
if (value == HUEY_CMD_SET_INTEGRATION_TIME) |
| 56 |
return "set-integration-time"; |
| 57 |
if (value == HUEY_CMD_GET_INTEGRATION_TIME) |
| 58 |
return "get-integration-time"; |
| 59 |
if (value == HUEY_CMD_REGISTER_WRITE) |
| 60 |
return "reg-write"; |
| 61 |
if (value == HUEY_CMD_REGISTER_READ) |
| 62 |
return "reg-read"; |
| 63 |
if (value == HUEY_CMD_UNLOCK) |
| 64 |
return "unlock"; |
| 65 |
if (value == HUEY_CMD_UNKNOWN_0F) |
| 66 |
return "unknown0f"; |
| 67 |
if (value == HUEY_CMD_UNKNOWN_10) |
| 68 |
return "unknown10"; |
| 69 |
if (value == HUEY_CMD_UNKNOWN_11) |
| 70 |
return "unknown11"; |
| 71 |
if (value == HUEY_CMD_UNKNOWN_12) |
| 72 |
return "unknown12"; |
| 73 |
if (value == HUEY_CMD_SENSOR_MEASURE_RGB_CRT) |
| 74 |
return "measure-rgb-crt"; |
| 75 |
if (value == HUEY_CMD_UNKNOWN_15) |
| 76 |
return "unknown15(status?)"; |
| 77 |
if (value == HUEY_CMD_SENSOR_MEASURE_RGB) |
| 78 |
return "measure-rgb"; |
| 79 |
if (value == HUEY_CMD_UNKNOWN_21) |
| 80 |
return "unknown21"; |
| 81 |
if (value == HUEY_CMD_GET_AMBIENT) |
| 82 |
return "get-ambient"; |
| 83 |
if (value == HUEY_CMD_SET_LEDS) |
| 84 |
return "set-leds"; |
| 85 |
if (value == HUEY_CMD_SENSOR_MEASURE_RGB_ALT) |
| 86 |
return "measure-rgb-alt"; |
| 87 |
return NULL; |
| 88 |
} |