2 * Copyright (C) 2006 Paul Davis
3 * Copyright (C) 2007 Michael Taht
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <tranzport_control_protocol.h>
23 // Lights are buffered, and arguably these functions should be eliminated or inlined
26 TranzportControlProtocol::lights_on ()
32 TranzportControlProtocol::lights_off ()
34 lights_pending
.reset();
38 TranzportControlProtocol::light_on (LightID light
)
40 lights_pending
.set(light
);
45 TranzportControlProtocol::light_off (LightID light
)
47 lights_pending
.reset(light
);
51 void TranzportControlProtocol::lights_init()
54 lights_flash
= lights_pending
= lights_current
.reset();
58 // Now that all this is bitsets, I don't see much
59 // need for these 4 to remain in the API
61 void TranzportControlProtocol::light_validate (LightID light
)
63 lights_invalid
.reset(light
);
66 void TranzportControlProtocol::light_invalidate (LightID light
)
68 lights_invalid
.set(light
);
71 void TranzportControlProtocol::lights_validate ()
73 lights_invalid
.reset();
76 void TranzportControlProtocol::lights_invalidate ()
82 TranzportControlProtocol::light_set (LightID light
, bool offon
)
85 cmd
[0] = 0x00; cmd
[1] = 0x00; cmd
[2] = light
; cmd
[3] = offon
;
86 cmd
[4] = 0x00; cmd
[5] = 0x00; cmd
[6] = 0x00; cmd
[7] = 0x00;
88 if (write (cmd
) == 0) {
89 lights_current
[light
] = offon
;
90 lights_invalid
.reset(light
);