Example #1
0
function set_channel_cb($service, $action, $arg)
{
    printf("Call for action:\n");
    printf("\taction: %s\n", $arg);
    $target = gupnp_service_action_get($action, 'Channel', GUPNP_TYPE_INT);
    if ($target != $GLOBALS['channel']) {
        $GLOBALS['channel'] = $target;
        printf("Call gupnp_service_notify\n");
        $result = gupnp_service_notify($service, 'Channel', GUPNP_TYPE_INT, $GLOBALS['channel']);
        printf("\tresult: channel has been changed to %d.\n", $GLOBALS['channel']);
        gupnp_service_action_return($action);
    } else {
        gupnp_service_action_return_error($action, 100, "this channel number is already set");
    }
    printf("\n");
}
Example #2
0
function action_settarget_cb($service, $action, $arg)
{
    echo "=========================================================\n";
    echo "[CALL] action_settarget_cb()\n";
    echo "---------------------------------------------------------\n";
    echo "[SERVICE]: ";
    var_dump($service);
    echo "[ACTION]: ";
    var_dump($action);
    echo "[ARG]: ";
    var_dump($arg);
    echo "---------------------------------------------------------\n";
    echo "[CALL]: gupnp_service_action_get({$action}, 'NewTargetValue', GUPNP_TYPE_BOOLEAN) \n";
    echo "---------------------------------------------------------\n";
    $res = gupnp_service_action_get($action, 'NewTargetValue', GUPNP_TYPE_BOOLEAN);
    echo "[RESULT]: ";
    var_dump($res);
    echo "---------------------------------------------------------\n\n";
    if ($GLOBALS['status'] != $res) {
        $GLOBALS['status'] = $res;
    }
    echo "---------------------------------------------------------\n";
    echo "[CALL]: gupnp_service_notify({$service}, 'Status', GUPNP_TYPE_BOOLEAN, " . $GLOBALS['status'] . ") \n";
    echo "---------------------------------------------------------\n";
    $res = gupnp_service_notify($service, 'Status', GUPNP_TYPE_BOOLEAN, $GLOBALS['status']);
    echo "[RESULT]: ";
    var_dump($res);
    echo "---------------------------------------------------------\n\n";
    echo "---------------------------------------------------------\n";
    echo "[CALL]: gupnp_service_action_return({$action}) \n";
    echo "---------------------------------------------------------\n";
    $res = gupnp_service_action_return($action);
    echo "[RESULT]: ";
    var_dump($res);
    echo "---------------------------------------------------------\n\n";
    echo "=========================================================\n\n\n";
}
Example #3
0
function get_status_cb($service, $action, $arg)
{
    gupnp_service_action_set($action, 'ResultStatus', GUPNP_TYPE_BOOLEAN, $GLOBALS['status']);
    gupnp_service_action_return($action);
}