Exemple #1
0
    def is_debug_characteristic(self, uuid):
        """Checking whether the provided UUID is a valid debug characteristic UUID.

        Args:
            uuid (str): Characteristic UUID.
        
        Returns:
            bool: True if the provided UUID is a valid debug characteristic UUID,
            False otherwise.
        """
        return uuid.endswith(str(Debug.DEBUG_STDINOUT_BLUESTSDK_SERVICE_UUID)) or \
            uuid.endswith(str(Debug.DEBUG_STDERR_BLUESTSDK_SERVICE_UUID))
Exemple #2
0
    def is_base_feature_characteristic(self, uuid):
        """Checking whether the UUID is a valid feature UUID.

        Args:
            uuid (str): Characteristic's UUID.
        
        Returns:
            bool: True if the UUID is a valid feature UUID, False otherwise.
        """
        return uuid.endswith(
            FeatureCharacteristic.BLUESTSDK_BASE_FEATURES_UUID)
Exemple #3
0
    def is_config_service(self, uuid):
        """Checking whether the provided UUID is a valid config service UUID.

        Args:
            uuid (str): Service UUID.
        
        Returns:
            bool: True if the provided UUID is a valid config service UUID,
            False otherwise.
        """
        return uuid.endswith(str(Config.CONFIG_BLUESTSDK_SERVICE_UUID))
Exemple #4
0
    def is_debug_service(self, uuid):
        """Checking whether the provided UUID is a valid debug service UUID.

        Args:
            uuid (str): Service UUID.
        
        Returns:
            bool: True if the provided UUID is a valid debug service UUID,
            False otherwise.
        """
        return uuid.endswith(str(Debug.DEBUG_BLUESTSDK_SERVICE_UUID))
    def get_short(self, uuid: str):
        """
        Returns the short type for a given UUID. That means that "0000006D-0000-1000-8000-0026BB765291" and "6D" both
        translates to "position.current" (after looking up "public.hap.characteristic.position.current").

        if item in self._characteristics:
            return self._characteristics[item].split('.', 3)[3]
        :param uuid: the UUID in long form or the shortened version as defined in chapter 5.6.1 page 72.
        :return: the textual representation
        """
        orig_item = uuid
        if uuid.endswith(self.baseUUID):
            uuid = uuid.split('-', 1)[0]
            uuid = uuid.lstrip('0')

        if uuid in self._characteristics:
            return self._characteristics[uuid].split('.', maxsplit=3)[3]

        return 'Unknown Characteristic {i}'.format(i=orig_item)