1 |
< |
// Beep Remote |
1 |
> |
// Display (Crystalfontz CFA-635 USB LCD) |
2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
|
// $Id$ |
6 |
|
|
7 |
< |
#include <audacious/beepctrl.h> |
7 |
> |
#include <foreach.hpp> |
8 |
> |
#include <scopes.hpp> |
9 |
|
|
10 |
< |
#include "Audacious.hpp" |
10 |
> |
#include <iomanip> |
11 |
> |
#include <iostream> |
12 |
|
|
13 |
< |
void Audacious::Playlist(char **list, int size, bool enqueue) |
14 |
< |
{ |
13 |
< |
::xmms_remote_playlist(session, list, size, enqueue); |
14 |
< |
} |
13 |
> |
#include <fcntl.h> |
14 |
> |
#include <termios.h> |
15 |
|
|
16 |
< |
int Audacious::GetVersion() const |
17 |
< |
{ |
18 |
< |
return ::xmms_remote_get_version(session); |
19 |
< |
} |
16 |
> |
#include "Display.hpp" |
17 |
|
|
18 |
< |
void Audacious::PlaylistAdd(::GList *list) |
22 |
< |
{ |
23 |
< |
::xmms_remote_playlist_add(session, list); |
24 |
< |
} |
25 |
< |
|
26 |
< |
void Audacious::PlaylistDelete(int position) |
27 |
< |
{ |
28 |
< |
::xmms_remote_playlist_delete(session, position); |
29 |
< |
} |
30 |
< |
|
31 |
< |
void Audacious::Play() |
32 |
< |
{ |
33 |
< |
::xmms_remote_play(session); |
34 |
< |
} |
35 |
< |
|
36 |
< |
void Audacious::Pause() |
37 |
< |
{ |
38 |
< |
::xmms_remote_pause(session); |
39 |
< |
} |
40 |
< |
|
41 |
< |
void Audacious::Stop() |
42 |
< |
{ |
43 |
< |
::xmms_remote_stop(session); |
44 |
< |
} |
45 |
< |
|
46 |
< |
bool Audacious::IsPlaying() const |
47 |
< |
{ |
48 |
< |
return ::xmms_remote_is_playing(session); |
49 |
< |
} |
50 |
< |
|
51 |
< |
bool Audacious::IsPaused() const |
52 |
< |
{ |
53 |
< |
return ::xmms_remote_is_paused(session); |
54 |
< |
} |
55 |
< |
|
56 |
< |
int Audacious::GetPlaylistPosition() const |
57 |
< |
{ |
58 |
< |
return ::xmms_remote_get_playlist_pos(session); |
59 |
< |
} |
60 |
< |
|
61 |
< |
void Audacious::SetPlaylistPosition(int position) |
62 |
< |
{ |
63 |
< |
::xmms_remote_set_playlist_pos(session, position); |
64 |
< |
} |
65 |
< |
|
66 |
< |
int Audacious::GetPlaylistLength() const |
67 |
< |
{ |
68 |
< |
return ::xmms_remote_get_playlist_length(session); |
69 |
< |
} |
70 |
< |
|
71 |
< |
void Audacious::PlaylistClear() |
72 |
< |
{ |
73 |
< |
return ::xmms_remote_playlist_clear(session); |
74 |
< |
} |
75 |
< |
|
76 |
< |
int Audacious::GetOutputTime() const |
77 |
< |
{ |
78 |
< |
return ::xmms_remote_get_output_time(session); |
79 |
< |
} |
80 |
< |
|
81 |
< |
void Audacious::JumpToTime(int position) |
82 |
< |
{ |
83 |
< |
::xmms_remote_jump_to_time(session, position); |
84 |
< |
} |
85 |
< |
|
86 |
< |
void Audacious::GetVolume(int& left, int& right) const |
87 |
< |
{ |
88 |
< |
::xmms_remote_get_volume(session, &left, &right); |
89 |
< |
} |
90 |
< |
|
91 |
< |
int Audacious::GetMainVolume() const |
92 |
< |
{ |
93 |
< |
return ::xmms_remote_get_main_volume(session); |
94 |
< |
} |
95 |
< |
|
96 |
< |
int Audacious::GetBalance() const |
97 |
< |
{ |
98 |
< |
return ::xmms_remote_get_balance(session); |
99 |
< |
} |
100 |
< |
|
101 |
< |
void Audacious::SetVolume(int left, int right) |
102 |
< |
{ |
103 |
< |
::xmms_remote_set_volume(session, left, right); |
104 |
< |
} |
105 |
< |
|
106 |
< |
void Audacious::SetMainVolume(int volume) |
107 |
< |
{ |
108 |
< |
::xmms_remote_set_main_volume(session, volume); |
109 |
< |
} |
110 |
< |
|
111 |
< |
void Audacious::SetBalance(int balance) |
112 |
< |
{ |
113 |
< |
::xmms_remote_set_balance(session, balance); |
114 |
< |
} |
115 |
< |
|
116 |
< |
std::string Audacious::GetSkin() const |
117 |
< |
{ |
118 |
< |
return ::xmms_remote_get_skin(session); |
119 |
< |
} |
120 |
< |
|
121 |
< |
void Audacious::SetSkin(const std::string &skin) |
122 |
< |
{ |
123 |
< |
::xmms_remote_set_skin(session, const_cast<char*>(skin.c_str())); |
124 |
< |
} |
18 |
> |
extern bool debug; |
19 |
|
|
20 |
< |
std::string Audacious::GetPlaylistFile(int position) const |
20 |
> |
static uint16_t GetCRC(uint8_t *buffer, size_t length) |
21 |
|
{ |
22 |
< |
return ::xmms_remote_get_playlist_file(session, position); |
23 |
< |
} |
22 |
> |
static const uint16_t table[256] = { |
23 |
> |
0x00000, 0x01189, 0x02312, 0x0329b, 0x04624, 0x057ad, 0x06536, 0x074bf, |
24 |
> |
0x08C48, 0x09DC1, 0x0AF5A, 0x0BED3, 0x0CA6C, 0x0DBE5, 0x0E97E, 0x0F8F7, |
25 |
> |
0x01081, 0x00108, 0x03393, 0x0221a, 0x056a5, 0x0472c, 0x075b7, 0x0643e, |
26 |
> |
0x09CC9, 0x08D40, 0x0BFDB, 0x0AE52, 0x0DAED, 0x0CB64, 0x0F9FF, 0x0E876, |
27 |
> |
0x02102, 0x0308b, 0x00210, 0x01399, 0x06726, 0x076af, 0x04434, 0x055bd, |
28 |
> |
0x0AD4A, 0x0BCC3, 0x08E58, 0x09FD1, 0x0EB6E, 0x0FAE7, 0x0C87C, 0x0D9F5, |
29 |
> |
0x03183, 0x0200a, 0x01291, 0x00318, 0x077a7, 0x0662e, 0x054b5, 0x0453c, |
30 |
> |
0x0BDCB, 0x0AC42, 0x09ED9, 0x08F50, 0x0FBEF, 0x0EA66, 0x0D8FD, 0x0C974, |
31 |
> |
0x04204, 0x0538d, 0x06116, 0x0709f, 0x00420, 0x015a9, 0x02732, 0x036bb, |
32 |
> |
0x0ce4c, 0x0dfc5, 0x0ed5e, 0x0fcd7, 0x08868, 0x099e1, 0x0ab7a, 0x0baf3, |
33 |
> |
0x05285, 0x0430c, 0x07197, 0x0601e, 0x014a1, 0x00528, 0x037b3, 0x0263a, |
34 |
> |
0x0decd, 0x0cf44, 0x0fddf, 0x0ec56, 0x098e9, 0x08960, 0x0bbfb, 0x0aa72, |
35 |
> |
0x06306, 0x0728f, 0x04014, 0x0519d, 0x02522, 0x034ab, 0x00630, 0x017b9, |
36 |
> |
0x0EF4E, 0x0FEC7, 0x0CC5C, 0x0DDD5, 0x0A96A, 0x0B8E3, 0x08A78, 0x09BF1, |
37 |
> |
0x07387, 0x0620e, 0x05095, 0x0411c, 0x035a3, 0x0242a, 0x016b1, 0x00738, |
38 |
> |
0x0FFCF, 0x0EE46, 0x0DCDD, 0x0CD54, 0x0B9EB, 0x0A862, 0x09AF9, 0x08B70, |
39 |
> |
0x08408, 0x09581, 0x0a71a, 0x0b693, 0x0c22c, 0x0d3a5, 0x0e13e, 0x0f0b7, |
40 |
> |
0x00840, 0x019c9, 0x02b52, 0x03adb, 0x04e64, 0x05fed, 0x06d76, 0x07cff, |
41 |
> |
0x09489, 0x08500, 0x0b79b, 0x0a612, 0x0d2ad, 0x0c324, 0x0f1bf, 0x0e036, |
42 |
> |
0x018c1, 0x00948, 0x03bd3, 0x02a5a, 0x05ee5, 0x04f6c, 0x07df7, 0x06c7e, |
43 |
> |
0x0a50a, 0x0b483, 0x08618, 0x09791, 0x0e32e, 0x0f2a7, 0x0c03c, 0x0d1b5, |
44 |
> |
0x02942, 0x038cb, 0x00a50, 0x01bd9, 0x06f66, 0x07eef, 0x04c74, 0x05dfd, |
45 |
> |
0x0b58b, 0x0a402, 0x09699, 0x08710, 0x0f3af, 0x0e226, 0x0d0bd, 0x0c134, |
46 |
> |
0x039C3, 0x0284A, 0x01AD1, 0x00B58, 0x07FE7, 0x06E6E, 0x05CF5, 0x04D7C, |
47 |
> |
0x0c60c, 0x0d785, 0x0e51e, 0x0f497, 0x08028, 0x091a1, 0x0a33a, 0x0b2b3, |
48 |
> |
0x04a44, 0x05bcd, 0x06956, 0x078df, 0x00c60, 0x01de9, 0x02f72, 0x03efb, |
49 |
> |
0x0d68d, 0x0c704, 0x0f59f, 0x0e416, 0x090a9, 0x08120, 0x0b3bb, 0x0a232, |
50 |
> |
0x05AC5, 0x04B4C, 0x079D7, 0x0685E, 0x01CE1, 0x00D68, 0x03FF3, 0x02E7A, |
51 |
> |
0x0e70e, 0x0f687, 0x0c41c, 0x0d595, 0x0a12a, 0x0b0a3, 0x08238, 0x093b1, |
52 |
> |
0x06b46, 0x07acf, 0x04854, 0x059dd, 0x02d62, 0x03ceb, 0x00e70, 0x01ff9, |
53 |
> |
0x0f78f, 0x0e606, 0x0d49d, 0x0c514, 0x0b1ab, 0x0a022, 0x092b9, 0x08330, |
54 |
> |
0x07BC7, 0x06A4E, 0x058D5, 0x0495C, 0x03DE3, 0x02C6A, 0x01EF1, 0x00F78, |
55 |
> |
}; |
56 |
> |
register uint16_t crc(0xffff); |
57 |
|
|
58 |
< |
std::string Audacious::GetPlaylistTitle(int position) const |
59 |
< |
{ |
133 |
< |
return ::xmms_remote_get_playlist_title(session, position); |
134 |
< |
} |
58 |
> |
while (length--) |
59 |
> |
crc = (crc >> 8) ^ table[(crc ^ *buffer++) & 0xff]; |
60 |
|
|
61 |
< |
int Audacious::GetPlaylistTime(int position) const |
137 |
< |
{ |
138 |
< |
return ::xmms_remote_get_playlist_time(session, position); |
61 |
> |
return ~crc; |
62 |
|
} |
63 |
|
|
64 |
< |
void Audacious::GetInfo(int &rate, int &frequency, int &channels) const |
64 |
> |
Display::Packet::Packet(Display::Packet::Command command, uint8_t length, const uint8_t *data) : command(command), length(length) |
65 |
|
{ |
66 |
< |
::xmms_remote_get_info(session, &rate, &frequency, &channels); |
67 |
< |
} |
66 |
> |
if (length > sizeof (this->data)) |
67 |
> |
throw; |
68 |
|
|
69 |
< |
void Audacious::MainWindowToggle(bool show) |
147 |
< |
{ |
148 |
< |
::xmms_remote_main_win_toggle(session, show); |
149 |
< |
} |
69 |
> |
::memcpy(this->data, data, length); |
70 |
|
|
71 |
< |
void Audacious::PlaylistWindowToggle(bool show) |
152 |
< |
{ |
153 |
< |
::xmms_remote_pl_win_toggle(session, show); |
71 |
> |
crc = GetCRC(reinterpret_cast<uint8_t *>(this), length + 2); |
72 |
|
} |
73 |
|
|
74 |
< |
void Audacious::EqualizerWindowToggle(bool show) |
74 |
> |
std::ostream &operator<<(std::ostream &output, const Display::Packet &packet) |
75 |
|
{ |
76 |
< |
::xmms_remote_eq_win_toggle(session, show); |
76 |
> |
return output << _B("0x") << std::hex << std::setw(2) << std::setfill('0') << unsigned(packet.command) << _B(" [") << packet.GetData() << ']'; |
77 |
|
} |
78 |
|
|
79 |
< |
bool Audacious::IsMainWindow() const |
79 |
> |
void operator<<(int fd, const Display::Packet &packet) |
80 |
|
{ |
81 |
< |
return ::xmms_remote_is_main_win(session); |
82 |
< |
} |
81 |
> |
if (packet.length != sizeof (packet.data)) |
82 |
> |
::memcpy(const_cast<uint8_t *>(packet.data) + packet.length, &packet.crc, 2); |
83 |
|
|
84 |
< |
bool Audacious::IsPlaylistWindow() const |
85 |
< |
{ |
168 |
< |
return ::xmms_remote_is_pl_win(session); |
169 |
< |
} |
84 |
> |
if (debug) |
85 |
> |
std::cerr << _B("<< ") << packet << std::endl; |
86 |
|
|
87 |
< |
bool Audacious::IsEqualizerWindow() const |
172 |
< |
{ |
173 |
< |
return ::xmms_remote_is_eq_win(session); |
87 |
> |
Posix::Write(fd, &packet, packet.length + 4); |
88 |
|
} |
89 |
|
|
90 |
< |
void Audacious::ShowPreferencesBox() |
90 |
> |
void operator>>(int fd, Display::Packet &packet) |
91 |
|
{ |
92 |
< |
::xmms_remote_show_prefs_box(session); |
93 |
< |
} |
92 |
> |
Posix::Read(fd, &packet, 2); |
93 |
> |
Posix::Read(fd, packet.data, packet.length); |
94 |
> |
Posix::Read(fd, &packet.crc, 2); |
95 |
|
|
96 |
< |
void Audacious::ToggleAlwaysOnTop(bool always) |
97 |
< |
{ |
183 |
< |
::xmms_remote_toggle_aot(session, always); |
96 |
> |
if (debug) |
97 |
> |
std::cerr << _B(">> ") << packet << std::endl; |
98 |
|
} |
99 |
|
|
100 |
< |
void Audacious::Eject() |
100 |
> |
void Communicate(Display *display) |
101 |
|
{ |
102 |
< |
::xmms_remote_eject(session); |
102 |
> |
display->Communicate_(); |
103 |
|
} |
104 |
|
|
105 |
< |
void Audacious::PlaylistPrevious() |
105 |
> |
Display::Display(const std::string &device) : ucom(Posix::Open(device, O_RDWR | O_NOCTTY | O_NONBLOCK)), ucomCondition(ucomLock), running(true), responsesCondition(responsesLock), thread(reinterpret_cast<void *(*)(void *)>(::Communicate), this) |
106 |
|
{ |
107 |
< |
::xmms_remote_playlist_prev(session); |
194 |
< |
} |
107 |
> |
::termios state; |
108 |
|
|
109 |
< |
void Audacious::PlaylistNext() |
110 |
< |
{ |
111 |
< |
::xmms_remote_playlist_next(session); |
199 |
< |
} |
109 |
> |
Posix::CheckError(::tcgetattr(ucom, &state)); |
110 |
> |
Posix::CheckError(::cfsetospeed(&state, B115200)); |
111 |
> |
Posix::CheckError(::cfsetispeed(&state, B115200)); |
112 |
|
|
113 |
< |
void Audacious::PlaylistAddUrl(const std::string &url) |
114 |
< |
{ |
115 |
< |
::xmms_remote_playlist_add_url_string(session, const_cast<char*>(url.c_str())); |
116 |
< |
} |
113 |
> |
state.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | INPCK | ISTRIP | INLCR | IGNCR | ICRNL | IXON | IXOFF); |
114 |
> |
state.c_iflag |= IGNPAR; |
115 |
> |
state.c_oflag &= ~(OPOST | ONLCR | ONOCR | ONLRET); |
116 |
> |
state.c_cflag &= ~(CSIZE | PARENB | PARODD | HUPCL | CRTSCTS); |
117 |
> |
state.c_cflag |= CREAD | CS8 | CSTOPB | CLOCAL; |
118 |
> |
state.c_lflag &= ~(ISIG | ICANON | IEXTEN | ECHO); |
119 |
> |
state.c_lflag |= NOFLSH; |
120 |
|
|
121 |
< |
bool Audacious::IsRunning() const |
207 |
< |
{ |
208 |
< |
return ::xmms_remote_is_running(session); |
209 |
< |
} |
121 |
> |
Posix::CheckError(::tcsetattr(ucom, TCSANOW, &state)); |
122 |
|
|
123 |
< |
void Audacious::ToggleRepeat() |
124 |
< |
{ |
213 |
< |
::xmms_remote_toggle_repeat(session); |
123 |
> |
_synchronized (ucomLock) |
124 |
> |
ucomCondition.Signal(); |
125 |
|
} |
126 |
|
|
127 |
< |
void Audacious::ToggleShuffle() |
127 |
> |
Display::~Display() |
128 |
|
{ |
129 |
< |
::xmms_remote_toggle_shuffle(session); |
219 |
< |
} |
129 |
> |
running = false; |
130 |
|
|
131 |
< |
bool Audacious::IsRepeat() const |
222 |
< |
{ |
223 |
< |
return ::xmms_remote_is_repeat(session); |
224 |
< |
} |
131 |
> |
thread.Join(); |
132 |
|
|
133 |
< |
bool Audacious::IsShuffle() const |
227 |
< |
{ |
228 |
< |
return ::xmms_remote_is_shuffle(session); |
133 |
> |
Posix::Close(ucom); |
134 |
|
} |
135 |
|
|
136 |
< |
void Audacious::GetEqualizer(float& preamp, float bands[10]) const |
136 |
> |
void Display::Communicate_() |
137 |
|
{ |
138 |
< |
float* bands_; |
138 |
> |
_synchronized (ucomLock) |
139 |
> |
ucomCondition.Wait(); |
140 |
|
|
141 |
< |
::xmms_remote_get_eq(session, &preamp, &bands_); |
141 |
> |
while (running) |
142 |
> |
{ |
143 |
> |
Packet response; |
144 |
|
|
145 |
< |
_forall (uint8_t, index, 0, 10) |
146 |
< |
bands[index] = bands[index]; |
145 |
> |
_synchronized (ucomLock) |
146 |
> |
try |
147 |
> |
{ |
148 |
> |
ucom >> response; |
149 |
> |
} |
150 |
> |
catch (const Posix::Error error) |
151 |
> |
{ |
152 |
> |
if (error.what() != _B("Resource temporarily unavailable")) |
153 |
> |
throw error; |
154 |
|
|
155 |
< |
::g_free(bands_); |
156 |
< |
} |
155 |
> |
goto next; |
156 |
> |
} |
157 |
|
|
158 |
< |
float Audacious::GetEqualizerPreamp() const |
159 |
< |
{ |
160 |
< |
return ::xmms_remote_get_eq_preamp(session); |
161 |
< |
} |
158 |
> |
if ((response.command & Packet::Error) == Packet::Error); |
159 |
> |
else if ((response.command & Packet::Report) == Packet::Report) |
160 |
> |
switch (response.command) |
161 |
> |
{ |
162 |
> |
case Packet::KeyActivity: |
163 |
> |
_synchronized (keyActivityLock) |
164 |
> |
keyActivity.push(response); |
165 |
|
|
166 |
< |
float Audacious::GetEqualizerBand(int band) const |
167 |
< |
{ |
168 |
< |
return ::xmms_remote_get_eq_band(session, band); |
169 |
< |
} |
166 |
> |
break; |
167 |
> |
case Packet::FanSpeedReport: |
168 |
> |
case Packet::TemperatureSensorReport: |
169 |
> |
break; |
170 |
> |
} |
171 |
> |
else if ((response.command & Packet::Response) == Packet::Response) |
172 |
> |
_synchronized (responsesLock) |
173 |
> |
{ |
174 |
> |
responses.push(response); |
175 |
> |
responsesCondition.Signal(); |
176 |
> |
} |
177 |
|
|
178 |
< |
void Audacious::SetEqualizer(float preamp, float bands[10]) |
179 |
< |
{ |
255 |
< |
::xmms_remote_set_eq(session, preamp, bands); |
178 |
> |
next: ::usleep(10000); |
179 |
> |
} |
180 |
|
} |
181 |
|
|
182 |
< |
void Audacious::SetEqualizerPreamp(float preamp) |
182 |
> |
Display::Packet Display::Communicate_(Display::Packet::Command command, uint8_t length, const uint8_t *data) |
183 |
|
{ |
184 |
< |
::xmms_remote_set_eq_preamp(session, preamp); |
261 |
< |
} |
184 |
> |
Packet packet(command, length, data); |
185 |
|
|
186 |
< |
void Audacious::SetEqualizerBand(int band, float value) |
187 |
< |
{ |
188 |
< |
::xmms_remote_set_eq_band(session, band, value); |
266 |
< |
} |
186 |
> |
retry: |
187 |
> |
_synchronized (ucomLock) |
188 |
> |
ucom << packet; |
189 |
|
|
190 |
< |
// XMMS 1.2.1 |
191 |
< |
void Audacious::Quit() |
192 |
< |
{ |
193 |
< |
::xmms_remote_quit(session); |
194 |
< |
} |
190 |
> |
_synchronized (responsesLock) |
191 |
> |
{ |
192 |
> |
while (responses.empty()) |
193 |
> |
try |
194 |
> |
{ |
195 |
> |
timeval when; |
196 |
|
|
197 |
< |
// XMMS 1.2.6 |
275 |
< |
void Audacious::PlayPause() |
276 |
< |
{ |
277 |
< |
::xmms_remote_play_pause(session); |
278 |
< |
} |
197 |
> |
::gettimeofday(&when, NULL); |
198 |
|
|
199 |
< |
void Audacious::PlaylistInsertUrl(const std::string &url, int position) |
281 |
< |
{ |
282 |
< |
::xmms_remote_playlist_ins_url_string(session, const_cast<char*>(url.c_str()), position); |
283 |
< |
} |
199 |
> |
timespec wait; |
200 |
|
|
201 |
< |
// XMMS 1.2.11 |
286 |
< |
void Audacious::PlayqueueAdd(int position) |
287 |
< |
{ |
288 |
< |
::xmms_remote_playqueue_add(session, position); |
289 |
< |
} |
201 |
> |
TIMEVAL_TO_TIMESPEC(&when, &wait); |
202 |
|
|
203 |
< |
void Audacious::PlayqueueRemove(int position) |
292 |
< |
{ |
293 |
< |
::xmms_remote_playqueue_remove(session, position); |
294 |
< |
} |
203 |
> |
++wait.tv_sec; |
204 |
|
|
205 |
< |
int Audacious::GetPlayqueueLength() const |
206 |
< |
{ |
207 |
< |
return ::xmms_remote_get_playqueue_length(session); |
208 |
< |
} |
205 |
> |
responsesCondition.Wait(wait); |
206 |
> |
} |
207 |
> |
catch (const Posix::Error &error) |
208 |
> |
{ |
209 |
> |
if (error.what() != _B("Operation timed out")) |
210 |
> |
throw error; |
211 |
|
|
212 |
< |
void Audacious::ToggleAdvance() |
213 |
< |
{ |
303 |
< |
::xmms_remote_toggle_advance(session); |
304 |
< |
} |
212 |
> |
goto retry; |
213 |
> |
} |
214 |
|
|
215 |
< |
bool Audacious::IsAdvance() const |
307 |
< |
{ |
308 |
< |
return ::xmms_remote_is_advance(session); |
309 |
< |
} |
215 |
> |
Packet response(responses.front()); |
216 |
|
|
217 |
< |
// BMP 0.9.7 |
312 |
< |
void Audacious::Activate() |
313 |
< |
{ |
314 |
< |
::xmms_remote_activate(session); |
315 |
< |
} |
217 |
> |
responses.pop(); |
218 |
|
|
219 |
< |
// Audacious 1.1 |
318 |
< |
void Audacious::ShowJumpToFileBox() |
319 |
< |
{ |
320 |
< |
::xmms_remote_show_jtf_box(session); |
321 |
< |
} |
219 |
> |
assert ((packet.command | Packet::Response) == response.command); |
220 |
|
|
221 |
< |
void Audacious::PlayqueueClear() |
222 |
< |
{ |
325 |
< |
::xmms_remote_playqueue_clear(session); |
326 |
< |
} |
221 |
> |
return response; |
222 |
> |
} |
223 |
|
|
224 |
< |
bool Audacious::PlayqueueIsQueued(int position) const |
329 |
< |
{ |
330 |
< |
return ::xmms_remote_playqueue_is_queued(session, position); |
224 |
> |
throw; |
225 |
|
} |
226 |
|
|
227 |
< |
int Audacious::GetPlayqueuePosition(int position) const |
227 |
> |
bool Display::Ping(const std::string &data) |
228 |
|
{ |
229 |
< |
return ::xmms_remote_get_playqueue_position(session, position); |
229 |
> |
return data == Communicate<const std::string &>(Packet::PingCommand, data).GetData(); |
230 |
|
} |
231 |
|
|
232 |
< |
int Audacious::GetPlayqueueQueuePosition(int position) const |
232 |
> |
std::string Display::Version() |
233 |
|
{ |
234 |
< |
return ::xmms_remote_get_playqueue_queue_position(session, position); |
234 |
> |
return Communicate(Packet::GetHardwareAndFirmwareVersion).GetData(); |
235 |
|
} |
236 |
|
|
237 |
< |
// Audacious 1.2 |
344 |
< |
void Audacious::SetSessionUri(const std::string &uri) |
237 |
> |
void Display::Set(uint8_t column, uint8_t row, const std::string &data) |
238 |
|
{ |
239 |
< |
::audacious_set_session_uri(const_cast<char *>(uri.c_str())); |
239 |
> |
Communicate(Packet::SendDataToLCD, column, row, data); |
240 |
|
} |
241 |
|
|
242 |
< |
std::string Audacious::GetSessionUri() const |
242 |
> |
Display::KeyActivity Display::GetKeyActivity() |
243 |
|
{ |
244 |
< |
return ::audacious_get_session_uri(session); |
245 |
< |
} |
244 |
> |
_synchronized (keyActivityLock) |
245 |
> |
if (keyActivity.size()) |
246 |
> |
{ |
247 |
> |
KeyActivity activity(KeyActivity(*keyActivity.front().data)); |
248 |
|
|
249 |
< |
void Audacious::SetSessionType(Type type) |
355 |
< |
{ |
356 |
< |
::audacious_set_session_type(type); |
357 |
< |
} |
249 |
> |
keyActivity.pop(); |
250 |
|
|
251 |
< |
// Audacious 1.3 |
252 |
< |
void Audacious::PlaylistEnqueueToTemp(const std::string &string) |
361 |
< |
{ |
362 |
< |
::xmms_remote_playlist_enqueue_to_temp(session, const_cast<char *>(string.c_str())); |
363 |
< |
} |
251 |
> |
return activity; |
252 |
> |
} |
253 |
|
|
254 |
< |
std::string Audacious::GetTupleFieldData(const std::string &field, int position) |
366 |
< |
{ |
367 |
< |
return ::audacious_get_tuple_field_data(session, const_cast<char *>(field.c_str()), position); |
254 |
> |
return None; |
255 |
|
} |