//
// © 2018-2020 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
//

#import "MockTransport.h"
#import "MockDispatcher.h"

@implementation MockTransport

- (void)scanForServicesOfTypes:(NSSet<NSString *> *)types
             serviceDiscovered:(IoTTransportServiceDiscoveredCallback)serviceDiscovered
                         queue:(dispatch_queue_t)serviceDiscoveredQueue
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
        if (self.serviceScanCallback) {
            self.serviceScanCallback(types, serviceDiscovered, serviceDiscoveredQueue);
        }
    });
}

- (void)scanForResourcesForHost:(NSString *)host
                      uriPrefix:(NSString *)uriPrefix
             resourceDiscovered:(IoTTransportResourceDiscoveredCallback)resourceDiscovered
                          queue:(dispatch_queue_t)resourceDiscoveredQueue
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
        if (self.resourceScanCallback) {
            self.resourceScanCallback(host, uriPrefix, resourceDiscovered, resourceDiscoveredQueue);
        }
    });
}

- (id<IoTTransportDispatcher>)dispatcher
{
    return [[MockDispatcher alloc] initWithDidConfigureCallback:self.dispatcherDidConfigureCallback
                                                    getCallback:self.dispatcherGetCallback
                                                   postCallback:self.dispatcherPostCallback
                                                observeCallback:self.dispatcherObserveCallback];
}

- (void)start {
}


- (void)stop {
}


@end
