summaryrefslogtreecommitdiff
path: root/apps/iap/iap-lingo3.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/iap/iap-lingo3.c')
-rw-r--r--apps/iap/iap-lingo3.c75
1 files changed, 51 insertions, 24 deletions
diff --git a/apps/iap/iap-lingo3.c b/apps/iap/iap-lingo3.c
index 0ed3df118e..c7801fbce0 100644
--- a/apps/iap/iap-lingo3.c
+++ b/apps/iap/iap-lingo3.c
@@ -38,6 +38,9 @@
38#include "settings.h" 38#include "settings.h"
39#include "metadata.h" 39#include "metadata.h"
40#include "playback.h" 40#include "playback.h"
41#if CONFIG_TUNER
42#include "ipod_remote_tuner.h"
43#endif
41 44
42/* 45/*
43 * This macro is meant to be used inside an IAP mode message handler. 46 * This macro is meant to be used inside an IAP mode message handler.
@@ -262,7 +265,7 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
262 device.play_status = audio_status(); 265 device.play_status = audio_status();
263 /* TODO: Fix this */ 266 /* TODO: Fix this */
264 device.mute = false; 267 device.mute = false;
265 device.volume = 0x80; 268 device.volume = global_settings.volume;
266 device.power_state = charger_input_state; 269 device.power_state = charger_input_state;
267 device.battery_level = battery_level(); 270 device.battery_level = battery_level();
268 /* TODO: Fix this */ 271 /* TODO: Fix this */
@@ -299,8 +302,8 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
299 302
300 /* GetRemoteEventStatus (0x0A) 303 /* GetRemoteEventStatus (0x0A)
301 * 304 *
302 * Request the events changed since the last call to GetREmoteEventStatus 305 * Request the events changed since the last call to
303 * or SetRemoteEventNotification 306 * GetREmoteEventStatus or SetRemoteEventNotification
304 * 307 *
305 * Packet format (offset in buf[]: Description) 308 * Packet format (offset in buf[]: Description)
306 * 0x00: Lingo ID: Display Remote Lingo, always 0x03 309 * 0x00: Lingo ID: Display Remote Lingo, always 0x03
@@ -434,15 +437,18 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
434 */ 437 */
435 case 0x04: 438 case 0x04:
436 { 439 {
437 /* Figuring out what the current volume is 440 if (device.mute == false) {
438 * seems to be tricky. 441 /* Mute status False*/
439 * TODO: Fix. 442 IAP_TX_PUT(0x00);
440 */ 443 /* Volume */
444 IAP_TX_PUT(0xFF & (int)((global_settings.volume + 90) * 2.65625));
441 445
442 /* Mute status */ 446 } else {
443 IAP_TX_PUT(0x00); 447 /* Mute status True*/
444 /* Volume */ 448 IAP_TX_PUT(0x01);
445 IAP_TX_PUT(0x80); 449 /* Volume should be 0 if muted */
450 IAP_TX_PUT(0x00);
451 }
446 452
447 iap_send_tx(); 453 iap_send_tx();
448 break; 454 break;
@@ -620,15 +626,24 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
620 */ 626 */
621 case 0x10: 627 case 0x10:
622 { 628 {
623 /* TODO: See volume above */ 629 if (device.mute == false) {
624 IAP_TX_PUT(0x00); 630 /* Mute status False*/
625 IAP_TX_PUT(0x80); 631 IAP_TX_PUT(0x00);
626 IAP_TX_PUT(0x80); 632 /* Volume */
633 IAP_TX_PUT(0xFF & (int)((global_settings.volume + 90) * 2.65625));
634 IAP_TX_PUT(0xFF & (int)((global_settings.volume + 90) * 2.65625));
635
636 } else {
637 /* Mute status True*/
638 IAP_TX_PUT(0x01);
639 /* Volume should be 0 if muted */
640 IAP_TX_PUT(0x00);
641 IAP_TX_PUT(0x00);
642 }
627 643
628 iap_send_tx(); 644 iap_send_tx();
629 break; 645 break;
630 } 646 }
631
632 default: 647 default:
633 { 648 {
634 cmd_ack(cmd, IAP_ACK_BAD_PARAM); 649 cmd_ack(cmd, IAP_ACK_BAD_PARAM);
@@ -746,14 +761,18 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
746 break; 761 break;
747 } 762 }
748 763
749 /* Volume/Mute
750 * Data length: 2
751 * TODO: Fix this
752 */
753 case 0x04: 764 case 0x04:
754 { 765 {
755 CHECKLEN(5); 766 CHECKLEN(5);
756 cmd_ack(cmd, IAP_ACK_CMD_FAILED); 767 if (buf[0x03]==0x00){
768 /* Not Muted */
769 global_settings.volume = (int) (buf[0x04]/2.65625)-90;
770 device.mute = false;
771 }
772 else {
773 device.mute = true;
774 }
775 cmd_ok(cmd);
757 break; 776 break;
758 } 777 }
759 778
@@ -919,7 +938,16 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
919 case 0x10: 938 case 0x10:
920 { 939 {
921 CHECKLEN(7); 940 CHECKLEN(7);
922 cmd_ack(cmd, IAP_ACK_CMD_FAILED); 941 if (buf[0x03]==0x00){
942 /* Not Muted */
943 global_settings.volume = (int) (buf[0x04]/2.65625)-90;
944 device.mute = false;
945 }
946 else {
947 device.mute = true;
948 }
949
950 cmd_ok(cmd);
923 break; 951 break;
924 } 952 }
925 953
@@ -1499,9 +1527,8 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
1499 { 1527 {
1500#ifdef LOGF_ENABLE 1528#ifdef LOGF_ENABLE
1501 logf("iap: Unsupported Mode03 Command"); 1529 logf("iap: Unsupported Mode03 Command");
1502#else
1503 cmd_ack(cmd, IAP_ACK_BAD_PARAM);
1504#endif 1530#endif
1531 cmd_ack(cmd, IAP_ACK_BAD_PARAM);
1505 break; 1532 break;
1506 } 1533 }
1507 } 1534 }