         }
     }
 }
+
+internal extension GAPData {
+    
+    var data: Data {
+        
+        var data = Data(capacity: dataLength)
+        append(to: &data)
+        return data
+    }
+}
+
+internal extension GAPUUIDList {
+    
+    var data: Data {
+        
+        return Data(self)
+    }
+}
+
+internal extension GAPDataEncoder {
+    
+    static func encode(_ encodables: [GAPData]) -> Data {
+        
+        let encoder = GAPDataEncoder()
+        return encoder.encode(encodables)
+    }
+}
+
+internal extension GAPDataDecoder {
+    
+    static func decode(_ data: Data,
+                              types: [GAPData.Type],
+                              ignoreUnknownType: Bool = true) throws -> [GAPData] {
+        
+        var decoder = GAPDataDecoder()
+        decoder.types = types
+        decoder.ignoreUnknownType = ignoreUnknownType
+        return try decoder.decode(data)
+    }
+}

        ("testLERole", testLERole),
        ("testURI", testURI),
        ("testIndoorPositioning", testIndoorPositioning),
        ("testLESupportedFeatures", testLESupportedFeatures),
        ("testLESecureConnectionsConfirmation", testLESecureConnectionsConfirmation),
        ("testLESecureConnectionsRandom", testLESecureConnectionsRandom),
        ("testChannelMapUpdateIndication", testChannelMapUpdateIndication),

        }
        
        XCTAssertEqual(GAPAppearanceData(data: Data([0x4f, 0xf8])), GAPAppearanceData(data: Data([0x4f, 0xf8])))
        XCTAssertEqual(GAPAppearanceData(appearance: 0xf5).data.count, 2)
        
        XCTAssertEqual(GAPAppearanceData(appearance: 0).data, Data([0x00, 0x00]))
        XCTAssertEqual(GAPAppearanceData(appearance: GAPAppearance.Unknown.unknown).data, Data([0x00, 0x00]))
