Search in sources :

Example 1 with NetcastHttpServer

use of com.connectsdk.service.netcast.NetcastHttpServer in project butter-android by butterproject.

the class NetcastTVService method connect.

@Override
public void connect() {
    if (state != State.INITIAL) {
        Log.w(Util.T, "already connecting; not trying to connect again: " + state);
        // don't try to connect again while connected
        return;
    }
    if (!(serviceConfig instanceof NetcastTVServiceConfig)) {
        ServiceConfig.ServiceConfigListener serviceConfigListener = serviceConfig.getListener();
        serviceConfig = new NetcastTVServiceConfig(serviceConfig.getServiceUUID());
        serviceConfig.setListener(serviceConfigListener);
    }
    if (DiscoveryManager.getInstance().getPairingLevel() == PairingLevel.ON) {
        if (((NetcastTVServiceConfig) serviceConfig).getPairingKey() != null && ((NetcastTVServiceConfig) serviceConfig).getPairingKey().length() != 0) {
            sendPairingKey(((NetcastTVServiceConfig) serviceConfig).getPairingKey());
        } else {
            showPairingKeyOnTV();
        }
        Util.runInBackground(new Runnable() {

            @Override
            public void run() {
                httpServer = new NetcastHttpServer(NetcastTVService.this, getServiceDescription().getPort(), mTextChangedListener);
                httpServer.setSubscriptions(subscriptions);
                httpServer.start();
            }
        });
    } else {
        hConnectSuccess();
    }
}
Also used : NetcastHttpServer(com.connectsdk.service.netcast.NetcastHttpServer) NetcastTVServiceConfig(com.connectsdk.service.config.NetcastTVServiceConfig) ServiceConfig(com.connectsdk.service.config.ServiceConfig) NetcastTVServiceConfig(com.connectsdk.service.config.NetcastTVServiceConfig)

Aggregations

NetcastTVServiceConfig (com.connectsdk.service.config.NetcastTVServiceConfig)1 ServiceConfig (com.connectsdk.service.config.ServiceConfig)1 NetcastHttpServer (com.connectsdk.service.netcast.NetcastHttpServer)1