예제 #1
0
 def setUp(self):
     luna.call(API_URL + "muteSpeaker", {
         "tvSoundOutput": "tv_speaker",
         "mute": False
     })
     self.status = luna.subscribe(API_URL + "getStatus", {
         "tvSoundOutput": "tv_speaker",
         "subscribe": True
     })
예제 #2
0
    def setUp(self):
        self.vlog("setUp")
        if SUPPORT_REGISTER:
            for pid in PID_LIST:
                self.vlog("register " + pid)
                luna.call(API_URL + "register", {"context": pid})

        self.statusSub = luna.subscribe(API_URL + "getStatus",
                                        {"subscribe": True})
    def tearDown(self):
        print("[tearDown]")
        luna.cancelSubscribe(self.statusSub)
################# Disconnect #####################
        print("- Disconnect connection")
        luna.call(API_URL + "disconnect", { "sink": TARGET_SINK, "context": PID1 })

################# Unregister #####################
        self.vlog("- unregister " + PID1)
        luna.call(API_URL + "unregister", { "context": PID1 })
예제 #4
0
    def tearDown(self):
        self.vlog("tearDown")
        for sink in SINK_LIST:
            self.vlog("disconnect " + sink)
            luna.call(API_URL + "disconnect", {"sink": sink})

        if SUPPORT_REGISTER:
            for pid in PID_LIST:
                self.vlog("unregister " + pid)
                luna.call(API_URL + "unregister", {"context": pid})

        luna.cancelSubscribe(self.statusSub)
예제 #5
0
 def setUp(self):
     luna.call(API_URL + "disconnect", {
         "sink": "MAIN",
         "source": "ADEC",
         "sourcePort": 0
     })
     luna.call(API_URL + "disconnect", {
         "sink": "SUB",
         "source": "ADEC",
         "sourcePort": 1
     })
     self.statusSub = luna.subscribe(API_URL + "getStatus",
                                     {"subscribe": True})
예제 #6
0
    def test_get_status(self):
        ret = luna.call(API_URL + "getStatus", {})
        self.assertContainsData(ret, {
            "audioStatus": [{
                "tvSoundOutput": "tv_speaker",
                "volume": "_any_"
            }]
        })

        ret = luna.call(API_URL + "getStatus", {"tvSoundOutput": "tv_speaker"})
        self.assertContainsData(ret, {
            "audioStatus": [{
                "tvSoundOutput": "tv_speaker",
                "volume": "_any_"
            }]
        })
    def setUp(self):
        print("[setUp]")

################# Disconnect #####################
        self.vlog("- Disconnect old connection")
        luna.call(API_URL + "disconnect", { "sink": TARGET_SINK })

################# Subscribe #####################
        self.vlog("- subscription True")
        self.statusSub = luna.subscribe(API_URL + "getStatus", {"subscribe":True})

################# Register ####################
        self.vlog("- Register " + PID1)
        luna.call(API_URL + "register", { "context": PID1 })

################# Connect #####################
        self.vlog("- Connect")
        self.checkLunaCallSuccessAndSubscriptionUpdate(API_URL + "connect",
                { "outputMode": "DISPLAY", "sink": TARGET_SINK, "source": TEST_SOURCE, "sourcePort": TEST_SOURCE_PORT, "context": PID1 },
                self.statusSub,
                {"video":[{"sink": TARGET_SINK, "connectedSource": TEST_SOURCE, "connectedSourcePort": TEST_SOURCE_PORT}]})

################# setVideoData #####################
        self.vlog("- setVideoData")
        self.checkLunaCallSuccessAndSubscriptionUpdate(
                API_URL + "setVideoData",
                {"sink": TARGET_SINK,
                    "context": PID1,
                    "contentType": CONTENT_TYPE,
                    "frameRate":FRAMERATE,
                    "width":WIDTH,
                    "height":HEIGHT,
                    "scanType":SCANTYPE},
                self.statusSub,
                {"video":[{"sink": TARGET_SINK,
                    "fullScreen": FULLSCREEN,
                    "width":WIDTH,
                    "height":HEIGHT,
                    "frameRate":FRAMERATE
                    }]})
예제 #8
0
    def test_set_volume(self):
        curVolume = luna.call(
            API_URL + "getStatus",
            {"tvSoundOutput": "tv_speaker"})["audioStatus"][0]["volume"]

        for i in range(20):
            volume = random.randint(0, 100)
            #ensure different volume than current
            if volume == curVolume:
                volume = (volume + 1) % 100

            self.checkLunaCallSuccessAndSubscriptionUpdate(
                API_URL + "set", {
                    "tvSoundOutput": "tv_speaker",
                    "volume": volume
                }, self.status, {
                    "audioStatus": [{
                        "tvSoundOutput": "tv_speaker",
                        "volume": volume
                    }]
                })
            curVolume = volume
예제 #9
0
 def tearDown(self):
     luna.cancelSubscribe(self.status)
     luna.call(API_URL + "muteSpeaker", {
         "tvSoundOutput": "tv_speaker",
         "mute": True
     })
예제 #10
0
 def setUp(self):
     luna.call(API_URL + "disconnect", { "sink": "MAIN" })
     luna.call(API_URL + "disconnect", { "sink": "SUB" })
     self.statusSub = luna.subscribe(API_URL + "getStatus", {"subscribe":True})