Package com.flir.thermalsdk.androidsdk.live
// set of permissions needed to discover over WiFi network <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> // adds support for USB OTG cameras (also Flir One camera) <uses-feature android:name="android.hardware.usb.host" android:required="true" />Also for USB discovery you will need to register for specific intent filter in your Activity in Manifest.xml file.
<activity android:name="com.flir.thermalsdk.discovery.SampleActivity"> <intent-filter> <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> </intent-filter> <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/flir_usb_device_filter" /> </activity>Note the flir_usb_device_filter.xml mentioned in 'meta-data' tag file which defines the allowed Flir devices. The vendor-id="2507" identifies a FLIR device. The file is located under 'res/xml' named flir_usb_device_filter.xml, but the name and location is up to you to decide.
<?xml version="1.0" encoding="utf-8"?> <resources> <usb-device vendor-id="2507" /> </resources>
The discovery is performed over any supported physical interfaces: USB, NETWORK ( WIFI / LAN / ETC). Discovery results in creating information about each supported FLIR Camera. Based on this information, it is possible to create a class representing a FLIR camera and connect to it.
The main class providing control over discovery process is
DiscoveryFactory
.
Here User can start or stop discovery over specific physical interface(s).
The discovery procedure is set up in 3 easy steps:
- obtain the
DiscoveryFactory
instance, - set
DiscoveryEventListener
for it to receive notification about discovery events - start it for a subset of physical interfaces defined by
CommunicationInterface
.
All discovery events are passed through DiscoveryEventListener
. It is called whenever
a new supported FLIR camera is found or lost, or discovery process has finished due to it's
limitations. One of such discovery processes is Bluetooth discovery, which on standard Android
platforms take 12 seconds and is switched off automatically.
when the OS stops a scan the DiscoveryEventListener.onDiscoveryFinished(CommunicationInterface)
is called,
this callback in NOT invoked when a client calls DiscoveryFactory.stop()
,
the the client will immediately be able to call start() after stop() without waiting for any callback.
Whenever new FLIR camera is found
DiscoveryEventListener.onCameraFound(com.flir.thermalsdk.live.discovery.DiscoveredCamera)
is called.
Based on the Identity
provided it is possible to
create an object representing this camera.
A simple example showing how to manage discovery process and camera is shown below:
public class MyDiscovery implements DiscoveryEventListener { public void startDiscovery() { DiscoveryFactory.getInstance().scan(this, CommunicationInterface.USB); } public void stopDiscovery() { DiscoveryFactory.getInstance().stop(); } public void onCameraFound(DiscoveredCamera discoveredCamera) { // called for every Camera found } public void onCameraLost(Identity identity) { //Camera was lost from scanning } public void onDiscoveryError(CommunicationInterface communicationInterface, ErrorCode error) { // communicationInterface is the communication interface where the error occurred, the client might scan on several interfaces. } public void onDiscoveryFinished(CommunicationInterface communicationInterface) { // invoked if the OS is shutting down the scan (will NOT be called if the user calls "stop()" } }
Connect
FLIR ONE camera
1. Add USB Attach permissions to Android Manifest as specified above using the "flir_usb_device_filter.xml" and "android.hardware.usb.action.USB_DEVICE_ATTACHED",
this way you will automatically be granted access to the FLIR ONE and doesn't need to check/request runtime permissions before calling
Camera.connect(com.flir.thermalsdk.live.Identity, com.flir.thermalsdk.live.connectivity.ConnectionStatusListener, com.flir.thermalsdk.live.ConnectParameters)
2. For using runtime permissions use UsbPermissionHandler
to request permission to connect to a FLIR ONE before calling
Camera.connect(com.flir.thermalsdk.live.Identity, com.flir.thermalsdk.live.connectivity.ConnectionStatusListener, com.flir.thermalsdk.live.ConnectParameters)
Other cameras
No need to check permission, just call Camera.connect(com.flir.thermalsdk.live.Identity, com.flir.thermalsdk.live.connectivity.ConnectionStatusListener, com.flir.thermalsdk.live.ConnectParameters)
-
ClassesClassDescriptionA wrapper used to provide Parcelable feature for
AdapterInfo
.A wrapper used to provide Parcelable feature forCameraInformation
.A wrapper used to provide Parcelable feature forIdentity
.A wrapper used to provide Parcelable feature forIpSettings
.