How to use the pebble.LibPebblesCommand.LibPebbleCommand.run function in Pebble

To help you get started, we’ve selected a few Pebble examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Hexxeh / libpebble / pebble / LibPebblesCommand.py View on Github external
def run(self, args):
        LibPebbleCommand.run(self, args)
        self.tail()
github Hexxeh / libpebble / pebble / LibPebblesCommand.py View on Github external
def run(self, args):
        LibPebbleCommand.run(self, args)
        self.args = args

        self.pebble.register_endpoint("MUSIC_CONTROL", self.music_control_handler)

        logging.info('Waiting for music control events...')
        try:
            while True:
                self.update_metadata()
                time.sleep(5)
        except KeyboardInterrupt:
            return
github Hexxeh / libpebble / pebble / LibPebblesCommand.py View on Github external
def run(self, args):
        LibPebbleCommand.run(self, args)

        if not os.path.exists(args.pbw_path):
            logging.error("Could not find pbw <{}> for install.".format(args.pbw_path))
            return 1

        self.pebble.app_log_enable()

        success = self.pebble.install_app(args.pbw_path, args.launch)

        # Send the phone OS version to analytics
        phoneInfoStr = self.pebble.get_phone_info()
        PblAnalytics.phone_info_evt(phoneInfoStr = phoneInfoStr)

        if success and args.logs:
            self.tail(skip_enable_app_log=True)
github Hexxeh / libpebble / pebble / LibPebblesCommand.py View on Github external
def run(self, args):
        LibPebbleCommand.run(self, args)

        uuid = self.pebble.current_running_uuid()
        uuid_hex = uuid.translate(None, '-')
        if not uuid:
            return
        elif int(uuid_hex, 16) == 0:
            print "System"
            return

        print uuid
        d = self.pebble.describe_app_by_uuid(uuid_hex)
        if not isinstance(d, dict):
            return
        print "Name: %s\nCompany: %s\nVersion: %d" % (d.get("name"), d.get("company"), d.get("version"))
        return
github Hexxeh / libpebble / pebble / LibPebblesCommand.py View on Github external
def run(self, args):
        LibPebbleCommand.run(self, args)
        self.pebble.ping(cookie=0xDEADBEEF)
github Hexxeh / libpebble / pebble / LibPebblesCommand.py View on Github external
def run(self, args):
        LibPebbleCommand.run(self, args)

        for app in self.pebble.get_appbank_status()['apps']:
            if app['index'] == args.bank_id:
                self.pebble.remove_app(app["id"], app["index"])
                logging.info("App removed")
                return 0

        logging.info("No app found in bank %u" % args.bank_id)
        return 1
github Hexxeh / libpebble / pebble / LibPebblesCommand.py View on Github external
def run(self, args):
        LibPebbleCommand.run(self, args)
        self.pebble.launcher_message(args.app_uuid, "RUNNING")
github Hexxeh / libpebble / pebble / LibPebblesCommand.py View on Github external
def run(self, args):
        LibPebbleCommand.run(self, args)

        logging.info("Taking screenshot...")
        def progress_callback(amount):
            logging.info("%.2f%% done..." % (amount*100.0))

        image = self.pebble.screenshot(progress_callback)
        name = time.strftime("pebble-screenshot_%Y-%m-%d_%H-%M-%S.png")
        image.save(name, "PNG")
        logging.info("Screenshot saved to %s" % name)

        # Open up the image in the user's default image viewer. For some
        # reason, this doesn't seem to open it up in their webbrowser,
        # unlike how it might appear. See
        # http://stackoverflow.com/questions/7715501/pil-image-show-doesnt-work-on-windows-7
        try:
            import webbrowser
github Hexxeh / libpebble / pebble / LibPebblesCommand.py View on Github external
def run(self, args):
        LibPebbleCommand.run(self, args)

        try:
            response = self.pebble.get_appbank_status()
            apps = response['apps']
            if len(apps) == 0:
                logging.info("No apps installed.")
            for app in apps:
                logging.info('[{}] {}'.format(app['index'], app['name']))
        except:
            logging.error("Error getting apps list.")
            return 1