forked from giuse/asus-xonar-u1-utils
-
Notifications
You must be signed in to change notification settings - Fork 1
/
xonarctl.h
184 lines (159 loc) · 5.32 KB
/
xonarctl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
* Xonarctl
*
* Copyright 2013 Stephane Albert
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file xonarctl.h
* \brief Xonard control utility
*/
#ifndef XONARCTL_H
#define XONARCTL_H
#include <getopt.h>
#include <stdlib.h>
#include "xonar.h"
#if ENABLE_CTL == 1
/**
* \brief Send a custom message over the socket.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] type The type of message to send.
* \param[in] payload The bytes of configuration to send.
*/
void sendCustom(int sockfd, char type, char payload[]);
/**
* \brief Send a blinking configuration message over the socket.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] ledIndex The led to modify.
* \param[in] timeOn The LED on duration (in ms).
* \param[in] period The total time of the cycle.
*/
void sendBlink(int sockfd, short ledIndex, short timeOn, short period);
/**
* \brief Send a global configuration message over the socket.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] conf Configuration bytes to send.
*/
void sendConf(int sockfd, int conf);
/**
* \brief Set the LED to blue without blinking.
* \param[in] sockfd A file descriptor to the socket.
*/
void setBlueStill(int sockfd);
/**
* \brief Set the LED to blinking blue.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] timeOn The LED on duration (in ms).
* \param[in] period The total time of the cycle.
*/
void setBlueBlink(int sockfd, int timeOn, int period);
/**
* \brief Set the LED to blinking from blue to red.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] timeOn The LED on duration (in ms).
* \param[in] period The total time of the cycle.
*/
void setBlueRedBlink(int sockfd, int timeOn, int period);
/**
* \brief Set the LED to red without blinking.
* \param[in] sockfd A file descriptor to the socket.
*/
void setRedStill(int sockfd);
/**
* \brief Set the LED to blinking red.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] timeOn The LED on duration (in ms).
* \param[in] period The total time of the cycle.
*/
void setRedBlink(int sockfd, int timeOn, int period);
/**
* \brief Set the LED to blinking from red to blue.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] timeOn The LED on duration (in ms).
* \param[in] period The total time of the cycle.
*/
void setRedBlueBlink(int sockfd, int timeOn, int period);
/**
* \brief Set the red LED to react to audio.
* \param[in] sockfd A file descriptor to the socket.
*/
void setRedAudio(int sockfd);
/**
* \brief Set the LED to purple without blinking.
* \param[in] sockfd A file descriptor to the socket.
*/
void setPurpleStill(int sockfd);
/**
* \brief Set the LED to blinking purple.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] timeOn The LED on duration (in ms).
* \param[in] period The total time of the cycle.
*/
void setPurpleBlink(int sockfd, int timeOn, int period);
/**
* \brief Set the LED to blinking from purple to blue.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] timeOn The LED on duration (in ms).
* \param[in] period The total time of the cycle.
*/
void setPurpleBlueBlink(int sockfd, int timeOn, int period);
/**
* \brief Set the LED to blinking from blue to purple.
* \param[in] sockfd A file descriptor to the socket.
* \param[in] timeOn The LED on duration (in ms).
* \param[in] period The total time of the cycle.
*/
void setPurpleRedBlink(int sockfd, int timeOn, int period);
/**
* \brief Set the LED to purple and audio blinking.
* \param[in] sockfd A file descriptor to the socket.
*/
void setPurpleAudio(int sockfd);
/**
* \brief Disable the LED output.
* \param[in] sockfd A file descriptor to the socket.
*/
void setDisabled(int sockfd);
/**
* \brief Change the LED output depending on the volume (from blue to red).
* \param[in] sockfd A file descriptor to the socket.
* \param[in] volume The current volume level in percent from 0 to 100.
*/
void setVolumeDependent(int sockfd, short volume);
/**
* \brief Initialize Inter-Process communication, create a unix socket.
* \return A file descriptor to a socket on success or a negative number on
* error.
*/
int initIPC();
/**
* \brief Stop Inter-Process communication.
* \param[in] sockfd A file descriptor to the unix socket.
*/
void destroyIPC(int sockfd);
/**
* \brief Send a message over the socket.
* \param[in] sockfd A file descriptor to the unix socket.
* \param[in] buffer Bytes to send on the unix socket
* \param[in] frameSize Number of bytes to send on the unix socket
*/
void sendMsg(int sockfd, char *buffer, char frameSize);
/**
* \brief Show help.
* \param[in] Should be set to argv[0] to pring the application name.
*/
void printUsage(char *appName);
#endif
#endif