FLIR One Developer / Blog / Topics / FLIRCameraImportDelegate not working

FLIRCameraImportDelegate not working

Home Forums FLIR Mobile SDK Development iOS Development FLIRCameraImportDelegate not working

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of ultexies ultexies 1 month, 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)

  • Author

    Posts

  • #18647

    Profile photo of Jordan
    Jordan

    Participant

    Hello,

    I’m using Swift, and the camera import delegate is not being invoked. My logic is exactly the same as the example project in Objective-C. I can see the following in the logs:

    2020-11-19 12:14:36.897250-0800 veriflimobile[744:124964] OnFileCompletion FLIR1576.jpg
    2020-11-19 12:14:40.107097-0800 veriflimobile[744:124964] OnFileCompletion FLIR1577.jpg

    Here’s some sample code:

    
    ..... {
        func cameraFound(_ cameraIdentity: FLIRIdentity) {
            DispatchQueue.global().async { [weak self] in
                do {
                    try self?.camera.connect(cameraIdentity);
                    self?.camera.getImport()?.delegate = self;
                    if (self?.onCameraConnectionChange != nil) {
                        self?.onCameraConnectionChange!(["cameraConnected": true, "deviceID": cameraIdentity.deviceId()]);
                    }
                } catch {
                    print("Connection error info: \(error)")
                }
            }
        }
        func importImages() {
            if (self.camera.isConnected()) {
                let importer = self.camera.getImport();
                DispatchQueue.global().async { [weak self] in
                    let images = importer.listImages(self?.camera.getIdentity()!.ipSettings()?.ipAddress());
                    if (images.count > 0) {
                        importer.start(images, withDestPath: 'path/to/dest');
                    }
                }
            }
        }
        func fileAdded(_ event: Any!) {
           print("DONE");
        }
        func fileError(_ event: Any!) {
            print("ERROR");
        }
        func importError(_ e: [AnyHashable : Any]!) {
            print("ERROR");
        }
        func fileProgress(_ progress: Int32, forFileNumber number: Int32) {
            print("MAKING PROGRESS...");
        }
    

    It’s not clear to me what I’m doing wrong. Am I setting the delegate properly? I’ve tried setting the delegate at different points in the flow, but I can’t get it to invoke my methods with anything I have tried.

    • This topic was modified 2 months ago by Profile photo of Jordan Jordan.
    • This topic was modified 2 months ago by Profile photo of Jordan Jordan.

    #18663

    Profile photo of Jordan
    Jordan

    Participant

    I was able to get this working. It’s because camera.getImport() returns a new instance each time, and you must set the delegate after fetching the import.

    
    let importer = self.camera.getImport();
    importer.delegate = self;
    importer.import(...);
    

    My delegate gets invoked now.

    #19289

    Profile photo of ultexies
    ultexies

    Participant

    Collect high quality data personally from customers. Our customer survey software is flexible to connect through emails and web-pages. Use panel management …
    https://takesurveys.onl/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.