You may try the following simple PB example. Before starting the program your scanner has to be connected and switched on. If your scanner is not detected by this program, I fear you will be out of luck...
Code: Select all
EnableExplicit
ImportC "/System/Library/Frameworks/ImageCaptureCore.framework/ImageCaptureCore"
EndImport
ImportC "/System/Library/Frameworks/Quartz.framework/Quartz"
EndImport
Define DeviceBrowserView.I
OpenWindow(0, 270, 100, 200, 150, "Available scanners")
DeviceBrowserView = CocoaMessage(0, 0, "IKDeviceBrowserView new")
If DeviceBrowserView
  CocoaMessage(0, DeviceBrowserView, "setDisplaysLocalScanners:", #YES)
  CocoaMessage(0, DeviceBrowserView, "setDisplaysNetworkScanners:", #YES)
  CocoaMessage(0, DeviceBrowserView, "setDisplaysLocalCameras:", #NO)
  CocoaMessage(0, DeviceBrowserView, "setDisplaysNetworkCameras:", #NO)
  CocoaMessage(0, WindowID(0), "setContentView:", DeviceBrowserView)
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
The following code example should get you started:
- It detects the connection of a 
digital camera and displays thumbviews and infos of each photo on this camera just like Apple's image capture app does. When switching on a connected camera while running this code example, Apple's image camera app will pop up too and may be closed again. Even switching the camera off is detected (which will throw a memory access error on Snow Leopard but works fine on Mavericks). It's also possible to start this code example after connecting and switching on the camera (on Snow Leopard it might result in a memory access error: in that case start Apple's image capture app, close it and wait some moments before starting this code example again; this problem did not appear on Mavericks)
- It should detect the connection of a 
scanner and should display the scanner view. It should also detect a button click like clicking the scan button. Unfortunately I am unable to test this because my 2 scanning devices are not detected by MacOS as already described above...
Code: Select all
EnableExplicit
#DeviceBrowserWidth = 180
; ----- Defined in ICDevice.h
#ICDeviceLocationTypeMaskBluetooth = $00000800
#ICDeviceLocationTypeMaskBonjour   = $00000400
#ICDeviceLocationTypeMaskLocal     = $00000100
#ICDeviceLocationTypeMaskRemote    = $0000FE00
#ICDeviceLocationTypeMaskShared    = $00000200
#ICDeviceTypeMaskCamera            = $00000001
#ICDeviceTypeMaskScanner           = $00000002
ImportC ""
  class_addMethod(Class.I, Selector.I, *Callback, Types.P-ASCII)
  class_createInstance(Class.I, ExtraBytes.I)
  objc_allocateClassPair(ModelClass.I, NewClassName.P-ASCII, ExtraBytes.I)
  objc_lookUpClass(ClassName.P-ASCII)
  object_setClass(ObjectToModify.I, NewClass.I)
  objc_registerClassPair(NewClass.I)
  sel_registerName(MethodName.P-ASCII)
EndImport
ImportC "/System/Library/Frameworks/ImageCaptureCore.framework/ImageCaptureCore"
EndImport
ImportC "/System/Library/Frameworks/Quartz.framework/Quartz"
EndImport
Define CameraView.I
Define DelegateClass.I
Define DeviceArray.I
Define DeviceBrowser.I
Define DeviceView.I
Define SubclassedDeviceBrowser.I
Procedure AddView(WindowID.I, View.I, x.I, y.I, Width.I, Height.I)
  Protected ContentView.I
  Protected Frame.NSRect
  Frame\origin\x = x
  Frame\origin\y = y
  Frame\size\width = Width
  Frame\size\height = Height
  CocoaMessage(0, View, "initWithFrame:@", @Frame)
  ContentView = CocoaMessage(0, WindowID(WindowID), "contentView")
  If ContentView
    CocoaMessage(0, ContentView, "addSubview:", View)
  EndIf
EndProcedure 
ProcedureC DeviceAddedCallback(Object.I, Selector.I, DeviceBrowser.I,
  AddedDevice.I, MoreComing.I)
  Static DeviceView.I
  Protected CameraView.I
  Protected DeviceType.I = CocoaMessage(0, AddedDevice, "type")
  Protected ScannerView.I
  CocoaMessage(0, AddedDevice, "setDelegate:", AddedDevice)
  If MoreComing = #NO And DeviceView = 0
    DeviceView = CocoaMessage(0, 0, "IKDeviceBrowserView new")
    If DeviceView
      If DeviceType & #ICDeviceTypeMaskCamera
        ; ----- New camera was detected
        Debug "DeviceAddedCallback: new camera detected"
        SetWindowTitle(0, "Camera image viewer")
        AddView(0, DeviceView, 5, 5, #DeviceBrowserWidth, WindowHeight(0) - 10)
        CameraView = CocoaMessage(0, 0, "IKCameraDeviceView new")
        If CameraView
          AddView(0, CameraView, #DeviceBrowserWidth + 1, 5,
            WindowWidth(0) - #DeviceBrowserWidth - 10, WindowHeight(0) - 10)
          CocoaMessage(0, CameraView, "setCameraDevice:", AddedDevice)
        EndIf
      ElseIf DeviceType & #ICDeviceTypeMaskScanner
        ; ----- New scanner was detected
        Debug "DeviceAddedCallback: new scanner detected"
        SetWindowTitle(0, "Scanner")
        AddView(0, DeviceView, 5, 5, #DeviceBrowserWidth, WindowHeight(0) - 10)
        ScannerView = CocoaMessage(0, 0, "IKScannerDeviceView new")
        If ScannerView
          AddView(0, ScannerView, #DeviceBrowserWidth + 1, 5,
            WindowWidth(0) - #DeviceBrowserWidth - 10, WindowHeight(0) - 10)
          CocoaMessage(0, ScannerView, "setScannerDevice:", AddedDevice)
        EndIf
      Else
        Debug "DeviceAddedCallback: new other device detected"
      EndIf
    EndIf
  EndIf
EndProcedure
ProcedureC DeviceRemovedCallback(Object.I, Selector.I,
  DeviceBrowser.I, RemovedDevice.I, MoreGoing.I)
  CocoaMessage(0, RemovedDevice, "setDelegate:", 0)
  Debug "DeviceRemovedCallback: Device was removed"
EndProcedure
ProcedureC DeviceSelectedCallback(Object.I, Selector.I, Device.I)
  Debug "DeviceSelectedCallback: Button was pressed"
EndProcedure
OpenWindow(0, 90, 100, 900, 600, "",
  #PB_Window_SystemMenu | #PB_Window_SizeGadget)
DeviceBrowser = CocoaMessage(0, 0, "ICDeviceBrowser new")
If DeviceBrowser
  DelegateClass = objc_allocateClassPair(objc_lookUpClass("NSObject"),
    "PB_Delegate", 0)
  class_addMethod(DelegateClass,
    sel_registerName("deviceBrowser:didAddDevice:moreComing:"),
    @DeviceAddedCallback(), "v@:@@@")
  class_addMethod(DelegateClass,
    sel_registerName("deviceBrowser:didRemoveDevice:moreGoing:"),
    @DeviceRemovedCallback(), "v@:@@@")
  class_addMethod(DelegateClass,
    sel_registerName("deviceBrowser:requestsSelectDevice:"),
    @DeviceSelectedCallback(), "v@:@@")
  objc_registerClassPair(DelegateClass)
  CocoaMessage(0, DeviceBrowser, "setDelegate:",
    class_createInstance(DelegateClass, 0))
  CocoaMessage(0, DeviceBrowser, "setBrowsedDeviceTypeMask:",
    #ICDeviceLocationTypeMaskLocal | #ICDeviceLocationTypeMaskShared |
    #ICDeviceTypeMaskCamera | #ICDeviceTypeMaskScanner)
  CocoaMessage(0, DeviceBrowser, "start")
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
  CocoaMessage(0, DeviceBrowser, "stop")
  CocoaMessage(0, DeviceBrowser, "release")
EndIf
 
Update: I had to change 2 occurences of CameraView to ScannerView in the scanner part. Thank you for pinpointing the error, TI-994A.