summaryrefslogtreecommitdiffstats
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 @@
#include "settings.h"
#include "metadata.h"
#include "playback.h"
+#if CONFIG_TUNER
+#include "ipod_remote_tuner.h"
+#endif
/*
* 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)
device.play_status = audio_status();
/* TODO: Fix this */
device.mute = false;
- device.volume = 0x80;
+ device.volume = global_settings.volume;
device.power_state = charger_input_state;
device.battery_level = battery_level();
/* TODO: Fix this */
@@ -299,8 +302,8 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
/* GetRemoteEventStatus (0x0A)
*
- * Request the events changed since the last call to GetREmoteEventStatus
- * or SetRemoteEventNotification
+ * Request the events changed since the last call to
+ * GetREmoteEventStatus or SetRemoteEventNotification
*
* Packet format (offset in buf[]: Description)
* 0x00: Lingo ID: Display Remote Lingo, always 0x03
@@ -434,15 +437,18 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
*/
case 0x04:
{
- /* Figuring out what the current volume is
- * seems to be tricky.
- * TODO: Fix.
- */
+ if (device.mute == false) {
+ /* Mute status False*/
+ IAP_TX_PUT(0x00);
+ /* Volume */
+ IAP_TX_PUT(0xFF & (int)((global_settings.volume + 90) * 2.65625));
- /* Mute status */
- IAP_TX_PUT(0x00);
- /* Volume */
- IAP_TX_PUT(0x80);
+ } else {
+ /* Mute status True*/
+ IAP_TX_PUT(0x01);
+ /* Volume should be 0 if muted */
+ IAP_TX_PUT(0x00);
+ }
iap_send_tx();
break;
@@ -620,15 +626,24 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
*/
case 0x10:
{
- /* TODO: See volume above */
- IAP_TX_PUT(0x00);
- IAP_TX_PUT(0x80);
- IAP_TX_PUT(0x80);
+ if (device.mute == false) {
+ /* Mute status False*/
+ IAP_TX_PUT(0x00);
+ /* Volume */
+ IAP_TX_PUT(0xFF & (int)((global_settings.volume + 90) * 2.65625));
+ IAP_TX_PUT(0xFF & (int)((global_settings.volume + 90) * 2.65625));
+
+ } else {
+ /* Mute status True*/
+ IAP_TX_PUT(0x01);
+ /* Volume should be 0 if muted */
+ IAP_TX_PUT(0x00);
+ IAP_TX_PUT(0x00);
+ }
iap_send_tx();
break;
}
-
default:
{
cmd_ack(cmd, IAP_ACK_BAD_PARAM);
@@ -746,14 +761,18 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
break;
}
- /* Volume/Mute
- * Data length: 2
- * TODO: Fix this
- */
case 0x04:
{
CHECKLEN(5);
- cmd_ack(cmd, IAP_ACK_CMD_FAILED);
+ if (buf[0x03]==0x00){
+ /* Not Muted */
+ global_settings.volume = (int) (buf[0x04]/2.65625)-90;
+ device.mute = false;
+ }
+ else {
+ device.mute = true;
+ }
+ cmd_ok(cmd);
break;
}
@@ -919,7 +938,16 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
case 0x10:
{
CHECKLEN(7);
- cmd_ack(cmd, IAP_ACK_CMD_FAILED);
+ if (buf[0x03]==0x00){
+ /* Not Muted */
+ global_settings.volume = (int) (buf[0x04]/2.65625)-90;
+ device.mute = false;
+ }
+ else {
+ device.mute = true;
+ }
+
+ cmd_ok(cmd);
break;
}
@@ -1499,9 +1527,8 @@ void iap_handlepkt_mode3(const unsigned int len, const unsigned char *buf)
{
#ifdef LOGF_ENABLE
logf("iap: Unsupported Mode03 Command");
-#else
- cmd_ack(cmd, IAP_ACK_BAD_PARAM);
#endif
+ cmd_ack(cmd, IAP_ACK_BAD_PARAM);
break;
}
}