$_REQUEST["key"] = getArg('command');
$key = "KEY_" . $_REQUEST["key"];
<?
$tv_ip_or_mac = getArg('tv_ip_or_mac');
$tv_ip = sdk_get_ip_from_ip_or_mac($tv_ip_or_mac);
$eedomus_mac = getArg('eedomus_mac');
$eedomus_ip = sdk_get_ip_from_ip_or_mac($eedomus_mac);
$command = getArg('command');
$appstring = "iphone..iapp.samsung"; //What the iPhone app reports
$tvappstring = "iphone.UD40D6310.iapp.samsung"; //Might need changing to match your TV type
$remotename = "eedomus"; //What gets reported when it asks for permission/also shows in General->Wireless Remote Control menu
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$result = socket_connect($sock, $tv_ip, '55000');
if( $result === false)
{
die ("Could not create socket");
}
$ipencoded = base64_encode($eedomus_ip);
$macencoded = base64_encode($eedomus_mac);
$remotenameencoded = base64_encode($remotename);
$messagepart1 = chr(0x64) . chr(0x00) . chr(strlen($ipencoded)) . chr(0x00) . $ipencoded . chr(strlen($macencoded)) . chr(0x00) . $macencoded . chr(strlen($remotenameencoded)) . chr(0x00) . $remotenameencoded;
$part1 = chr(0x00) . chr(strlen($appstring)) . chr(0x00) . $appstring . chr(strlen($messagepart1)) . chr(0x00) . $messagepart1;
socket_write($sock, $part1, strlen($part1));
echo $part1;
echo "\n";
$messagepart2 = chr(0xc8) . chr(0x00);
$part2 = chr(0x00) . chr(strlen($appstring)) . chr(0x00) . $appstring . chr(strlen($messagepart2)) . chr(0x00) . $messagepart2;
socket_write($sock, $part2, strlen($part2));
echo $part2;
echo "\n";
//Preceding sections all first time only
if (!empty($command))
{
//Send remote key
$key = base64_encode($command);
$messagepart3 = chr(0x00) . chr(0x00) . chr(0x00) . chr(strlen($key)) . chr(0x00) . $key;
$part3 = chr(0x00) . chr(strlen($tvappstring)) . chr(0x00) . $tvappstring . chr(strlen($messagepart3)) . chr(0x00) . $messagepart3;
socket_write($sock,$part3,strlen($part3));
echo $part3;
echo "\n";
}
socket_close($sock);
echo "\n\n";
?>
http://192.168.xxx.xxx/script/?exec=ancien.php&tv_ip_or_mac=F8:04:2E:FA:XX:XX&eedomus_mac=00:60:6E:33:XX:XX&command=KEY_SOURCE
hornet49 a écrit:Ok je m'y colle, juste une petite question, est il possible d'optimisé le scripte en évitant de demander l'adresse MAC de l'EEDOMUS ? on doit pouvoir la trouver ou la déduire sans la demander dans un champs je pense ?
<?
$tv_ip_or_mac = getArg('tv_ip_or_mac');
$tv_ip = sdk_get_ip_from_ip_or_mac($tv_ip_or_mac);
$command = base64_encode(getArg('command'));
$description = base64_encode('eedomus remote controller');
$id = base64_encode('eedomus');
$remotename = base64_encode('eedomus');
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$result = socket_connect($sock, $tv_ip, '55000');
if( $result === false)
{
die ("Could not create socket");
}
$payload = chr(0x64) . chr(0x00);
$payload .= chr(strlen($description)) . chr(0x00) . $description;
$payload .= chr(strlen($id)) . chr(0x00) . $id;
$payload .= chr(strlen($remotename)) . chr(0x00) . $remotename;
$packet = chr(0x00) . chr(0x00) . chr(0x00) . chr(strlen($payload)) . chr(0x00) . $payload;
socket_write($sock, $packet, strlen($packet));
//Send remote key
$payload = chr(0x00) . chr(0x00) . chr(0x00) . chr(strlen($command)) . chr(0x00) . $command;
$packet = chr(0x00) . chr(0x00) . chr(0x00) . chr(strlen($payload)) . chr(0x00) . $payload;
socket_write($sock,$packet,strlen($packet));
socket_close($sock);
?>
http://192.168.xxx.xxx/script/?exec=ancien.php&tv_ip_or_mac=F8:04:2E:FA:XX:XX&command=KEY_SOURCE
Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 23 invité(s)