//# sourceURL=J_ALTUI_iphone.js "use strict"; // This program is free software: you can redistribute it and/or modify // it under the condition that it is for private or home useage and // this whole comment is reproduced in the source code file. // Commercial utilisation is not authorized without the appropriate // written agreement from amg0 / alexis . mermet @ gmail . com // 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. var ALTUI_IPhoneLocator= ( function( window, undefined ) { // return styles needed by this plugin module function _getStyle() { var style=""; style += ".altui-iphone { font-size: 16px; }"; style += ".altui-canalplus { font-size: 12px; }"; style += "#altui-cplus-keytbl td {text-align:center; vertical-align:middle;}"; style += ".altui-cplus-button { width: 70px; font-size:12px;}"; style += ".altui-ipx { margin-top: 10px; }"; return style; }; function _drawAltUI( device) { var debug = MultiBox.getStatus( device, 'urn:upnp-org:serviceId:altui1', 'Debug' ); var html =""; html += ALTUI_PluginDisplays.createOnOffButton( debug,"altui-onoffbtn-"+device.altuiid, _T("Normal,Debug") , "pull-right"); html += ""; return html; }; function _drawIPX( device) { var html =""; var ip = device.ip; if (ip) { html+= ("" .format( device.altuiid,_T("Open") )) ; html += ""; } return html; }; // return the html string inside the .panel-body of the .altui-device#id panel function _drawIPhone( device) { var dist = parseFloat(MultiBox.getStatus( device, 'urn:upnp-org:serviceId:IPhoneLocator1', 'Distance' )); var unit = MultiBox.getStatus( device, 'urn:upnp-org:serviceId:IPhoneLocator1', 'Unit' ); var mute = MultiBox.getStatus( device, 'urn:upnp-org:serviceId:IPhoneLocator1', 'Muted' ); var html =""; html+=(" "+dist+" "); html+=(" "+unit+" "); html += ALTUI_PluginDisplays.createOnOffButton( mute,"altui-onoffbtn-"+device.altuiid, _T("Unmuted,Muted") , "pull-right"); html += ""; return html; }; function _drawCanalplus( device) { var channel = MultiBox.getStatus( device, 'urn:upnp-org:serviceId:cplus1', 'CurrentChannel' ).split(','); var present = MultiBox.getStatus( device, 'urn:upnp-org:serviceId:cplus1', 'Present' ); var html =""; html += ALTUI_PluginDisplays.createOnOffButton( present,"altui-onoffbtn-"+device.altuiid, _T("OFF,ON"), "pull-right" ); if (channel.length>=2) html+=("
{0}
{1}".format(channel[1],channel[0])); html += ""; return html; }; // function _drawControlPanel(devid, device, domparent) { // $(domparent).append("Hello I am alive, and I am in a custom drawing function!"); // }; function _drawCanaplusControlPanel( device, domparent) { var html=""; html +="
"; html += ""; html += ""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html += ""; html += "
-
-
"; html +="
"; // html +="
"; // html +="
"; $(domparent).append(html); // also display the default // UIManager.defaultDeviceDrawControlPanel(devid, device, domparent.find("div#altui-cplus-divcontainer").width(400)); $(".altui-cplus-button").click( function() { var id = $(this).prop('id'); MultiBox.runAction( device, 'urn:upnp-org:serviceId:cplus1', 'SendKey', {keyStream:id} ); }); }; // explicitly return public methods when this object is instantiated return { //--------------------------------------------------------- // PUBLIC functions //--------------------------------------------------------- getStyle : _getStyle, drawIPhone : _drawIPhone, drawIPX : _drawIPX, drawAltUI : _drawAltUI, drawCanalplus : _drawCanalplus, drawCanaplusControlPanel : _drawCanaplusControlPanel, // drawControlPanel : _drawControlPanel, toggleDebug : function (devid,htmlid) { ALTUI_PluginDisplays.toggleButton(devid, htmlid, 'urn:upnp-org:serviceId:altui1', 'Debug', function(id,newval) { MultiBox.runActionByAltuiID ( devid, 'urn:upnp-org:serviceId:altui1', 'SetDebug', {newDebugMode:newval} ); }); }, toggleMute : function (devid,htmlid) { ALTUI_PluginDisplays.toggleButton(devid, htmlid, 'urn:upnp-org:serviceId:IPhoneLocator1', 'Muted', function(id,newval) { MultiBox.runActionByAltuiID( devid, 'urn:upnp-org:serviceId:IPhoneLocator1', 'SetMute', {newMuteStatus:newval} ); }); }, toggleCplusOnOff : function (devid,htmlid) { ALTUI_PluginDisplays.toggleButton(devid, htmlid, 'urn:upnp-org:serviceId:cplus1', 'Present', function(id,newval) { MultiBox.runActionByAltuiID( devid, 'urn:upnp-org:serviceId:cplus1', 'SetPower', {newPowerState:newval} ); }); }, }; })( window );