             let isPrimary: Bool
             
             switch attribute.uuid {
-            case BluetoothUUID.primaryService:
+            case .primaryService:
                 isPrimary = true
-            case BluetoothUUID.secondaryService:
+            case .secondaryService:
                 isPrimary = false
             default:
                 return nil // invalid uuid

        init?(attribute: Attribute) {
            
            guard attribute.uuid == type(of: self).uuid,
                let length = Length(rawValue: attribute.value.count)
                else { return nil }
            
            assert(attribute.permissions == [.read], "Invalid attribute permissions")
            
            let serviceHandle = UInt16(littleEndian: UInt16(bytes: (attribute.value[0], attribute.value[1])))
            let endGroupHandle = UInt16(littleEndian: UInt16(bytes: (attribute.value[2], attribute.value[3])))
            let uuid = BluetoothUUID(littleEndian: BluetoothUUID(data: attribute.value.subdataNoCopy(in: 4 ..< length.rawValue))!)
            
            self.serviceHandle = serviceHandle
            self.endGroupHandle = endGroupHandle

        
        var attribute: Attribute {
            
            var data = Data(capacity: 3 + uuid.dataLength)
            data += properties.rawValue
            data += valueHandle.littleEndian
            data += uuid.littleEndian
            
            return Attribute(handle: handle,
                             uuid: type(of: self).uuid,
                             value: data,
                             permissions: [.read])
        }
        
