├── .gitignore
├── .gitmodules
├── .travis.yml
├── Custom-Info.plist
├── GetThermal.pro
├── LICENSE
├── README.md
├── boson_sdk
├── Client_API.c
├── Client_API.h
├── Client_Dispatcher.c
├── Client_Dispatcher.h
├── Client_Packager.c
├── Client_Packager.h
├── EnumTypes.h
├── Example.c
├── FunctionCodes.h
├── ReturnCodes.h
├── Serializer_BuiltIn.c
├── Serializer_BuiltIn.h
├── Serializer_Struct.c
├── Serializer_Struct.h
├── UART_Connector.c
├── UART_Connector.h
├── flirCRC.c
├── flirCRC.h
├── flirChannels.c
├── flirChannels.h
└── libusb_binary_protocol.c
├── common.pri
├── deploy
├── create_linux_appimage.sh
├── getthermal-start.sh
└── getthermal.desktop
├── deployment.pri
├── icons
├── getthermal.png
└── macos.icns
├── inc
├── abstractccinterface.h
├── bosonvariation.h
├── bosonvariation_types.h
├── dataformatter.h
├── leptonvariation.h
├── leptonvariation_types.h
├── rangeprovider.h
├── uvcacquisition.h
├── uvcbuffer.h
└── uvcvideoproducer.h
├── installer.pri
├── lepton_sdk
├── Inc
│ ├── LEPTON_AGC.h
│ ├── LEPTON_ErrorCodes.h
│ ├── LEPTON_Macros.h
│ ├── LEPTON_OEM.h
│ ├── LEPTON_RAD.h
│ ├── LEPTON_SDK.h
│ ├── LEPTON_SDKConfig.h
│ ├── LEPTON_SYS.h
│ ├── LEPTON_Types.h
│ ├── LEPTON_VID.h
│ ├── crc16.h
│ └── uvc_sdk.h
└── Src
│ ├── LEPTON_AGC.c
│ ├── LEPTON_OEM.c
│ ├── LEPTON_RAD.c
│ ├── LEPTON_SDK.c
│ ├── LEPTON_SYS.c
│ ├── LEPTON_VID.c
│ └── crc16fast.c
├── qml
├── Viewer.qml
├── ViewerForm.ui.qml
├── boson
│ ├── BosonTabs.qml
│ ├── InfoControls.qml
│ └── VidControls.qml
├── controls
│ ├── CameraControls.qml
│ ├── RangeDisplay.qml
│ ├── SpotInfo.qml
│ ├── ValueSlider.qml
│ └── VideoRoi.qml
├── images
│ └── brand-logo.png
├── lepton
│ ├── AgcControls.qml
│ ├── InfoControls.qml
│ ├── LeptonTabs.qml
│ └── VidControls.qml
├── main.qml
├── qml.qrc
└── qtquickcontrols2.conf
├── setup.pri
└── src
├── abstractccinterface.cpp
├── bosonvariation.cpp
├── dataformatter.cpp
├── leptonvariation.cpp
├── main.cpp
├── rangeprovider.cpp
├── uvcacquisition.cpp
├── uvcbuffer.cpp
└── uvcvideoproducer.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | # This file is used to ignore files which are generated
2 | # ----------------------------------------------------------------------------
3 |
4 | *~
5 | *.autosave
6 | *.a
7 | *.core
8 | *.moc
9 | *.o
10 | *.obj
11 | *.orig
12 | *.rej
13 | *.so
14 | *.so.*
15 | *_pch.h.cpp
16 | *_resource.rc
17 | *.qm
18 | .#*
19 | *.*#
20 | core
21 | !core/
22 | tags
23 | .DS_Store
24 | .directory
25 | *.debug
26 | Makefile*
27 | *.prl
28 | *.app
29 | moc_*.cpp
30 | ui_*.h
31 | qrc_*.cpp
32 | Thumbs.db
33 | *.res
34 | *.rc
35 | /.qmake.cache
36 | /.qmake.stash
37 |
38 | # qtcreator generated files
39 | *.pro.user*
40 |
41 | # xemacs temporary files
42 | *.flc
43 |
44 | # Vim temporary files
45 | .*.swp
46 |
47 | # Visual Studio generated files
48 | *.ib_pdb_index
49 | *.idb
50 | *.ilk
51 | *.pdb
52 | *.sln
53 | *.suo
54 | *.vcproj
55 | *vcproj.*.*.user
56 | *.ncb
57 | *.sdf
58 | *.opensdf
59 | *.vcxproj
60 | *vcxproj.*
61 |
62 | # MinGW generated files
63 | *.Debug
64 | *.Release
65 |
66 | # Python byte code
67 | *.pyc
68 |
69 | # Binaries
70 | # --------
71 | *.dll
72 | *.exe
73 |
74 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "libuvc"]
2 | path = libuvc
3 | url = https://github.com/groupgets/libuvc
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: cpp
2 |
3 | os:
4 | - linux
5 | - osx
6 |
7 | dist: trusty
8 |
9 | compiler:
10 | - clang
11 | - gcc
12 |
13 | env:
14 | global:
15 | - secure: "QXa5MUcWCi9eKx2V4Cq8aA7TuF06LmPe553dsB7u5AVRoHQytYqgivPHYWzTwpY5cy2ksQbQvFW/HM0AFz9skvrMCian6pS7I9PkBIdNdyvJgwqdnImYH67Dg/KNogYaPTrBBI9RElzJHp1uGmZuLIuo9hXo+w8zGvGwGnjh+tKsQtaSEBRnj5CTRucI19JSfb7JcwrZowDldpeqYkCUccB6Ma+AEPfONX654O71v+4bqYG8S0qHEFF8bdU/HiMvwEHPgwNVWIOcLiF4xUIFwqwlFGfPIqi/fNY0S6dBmmNySLUT2c0gbcI11BQF8fvRcLk9tjLdKg4a9zYgYuWiQ9bZ++pZlRn0h25CJFdZxnU9Tsnh2/sNaSuXXFjpq/ORUNV5ngu2q3T0yZFfbe+40TSNQuplNUDKLYxzfZHBXXQPYv7Ru0hzbGk65hdjdKAnAIxR6lxwEHkTaU3mruUudFRtlGz/IRWWjDESpSh25x8GL1Ul06fzqdcEhVUQBY4cHXAiifcOho08GB2yP5xA3+9vUBPW1F80Boob5yMXpct+ZstlPb0O7mWBLHLv092q02VT6MlnzlGpP6j2L7XKRpnk7MnyOWt6KPANVqrMviLTEo/KAiK5joPD5pc2JNnnnid485JZTDcUuP6cSX2WhyhatK6Zqcg7OPaxxxszIkM="
16 | matrix:
17 | # - QT=57 BREW=ex PPA=beineri/opt-qt571-trusty
18 | # - QT=58 BREW=ex PPA=beineri/opt-qt58-trusty
19 | - QT=59 BREW=ex PPA=beineri/opt-qt593-trusty
20 | # - QT=510 BREW=@ex PPA=beineri/opt-qt-5.10.1-trusty
21 |
22 | matrix:
23 | exclude:
24 | - { os: osx, compiler: gcc }
25 | - { os: linux, compiler: clang }
26 |
27 | addons:
28 | coverity_scan:
29 | project:
30 | name: "groupgets/GetThermal"
31 | description: "Build submitted via Travis CI"
32 | notification_email: kurt@groupgets.com
33 | build_command_prepend: >
34 | cp -a "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR-scan" &&
35 | pushd "$TRAVIS_BUILD_DIR-scan" &&
36 | qmake CONFIG+=debug_and_release
37 | build_command: make all
38 | branch_pattern: coverity_scan
39 |
40 | before_install:
41 | - '[[ "$TRAVIS_OS_NAME" != linux || -z "$PPA" ]] || sudo add-apt-repository -y ppa:$PPA'
42 | - '[ "$TRAVIS_OS_NAME" != linux ] || sudo apt-get -qy update'
43 | - '[ "$TRAVIS_OS_NAME" != osx ] || brew update'
44 |
45 | install:
46 | - '[ "$TRAVIS_OS_NAME" != linux ] || sudo apt-get -qy install qt${QT}base qt${QT}xmlpatterns qt${QT}declarative qt${QT}quickcontrols2 qt${QT}multimedia libusb-1.0-0-dev'
47 | - '[ "$TRAVIS_OS_NAME" != osx ] || brew install qt'
48 | - '[ "$TRAVIS_OS_NAME" != osx ] || brew link --force qt'
49 | - qmake -v
50 |
51 | before_script:
52 | - '[[ "$TRAVIS_OS_NAME" != linux || "$CXX" != clang++ ]] || export QMAKESPEC=linux-clang'
53 | - '[[ "$TRAVIS_OS_NAME" != linux || "$CXX" != g++ ]] || export QMAKESPEC=linux-g++'
54 | - '[[ "$TRAVIS_OS_NAME" != osx || "$CXX" != clang++ ]] || export QMAKESPEC=macx-clang'
55 | - '[[ "$TRAVIS_OS_NAME" != osx || "$CXX" != g++ ]] || export QMAKESPEC=macx-g++'
56 | - '[[ "$TRAVIS_OS_NAME" != linux || "$PPA" != */opt-* ]] || . /opt/qt${QT}/bin/qt${QT}-env.sh'
57 | - '[[ "$TRAVIS_OS_NAME" != linux || "$PPA" == */opt-* ]] || export QT_SELECT=qt5'
58 | - pushd libuvc
59 | - mkdir build
60 | - pushd build
61 | - cmake ..
62 | - make
63 | - popd
64 | - popd
65 | - mkdir -p "$TRAVIS_BUILD_DIR-build"
66 | - qmake -o "$TRAVIS_BUILD_DIR-build" -r CONFIG+=release CONFIG+=installer "$TRAVIS_BUILD_DIR"
67 |
68 | script:
69 | - make -C "$TRAVIS_BUILD_DIR-build" all
70 | - '[ "$TRAVIS_OS_NAME" != linux ] || mkdir -p "$TRAVIS_BUILD_DIR-build/release/package"'
71 | - '[ "$TRAVIS_OS_NAME" != linux ] || pushd "$TRAVIS_BUILD_DIR-build/release/package"'
72 | - '[ "$TRAVIS_OS_NAME" != linux ] || $TRAVIS_BUILD_DIR/deploy/create_linux_appimage.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR-build/release"'
73 | - '[ "$TRAVIS_OS_NAME" != linux ] || popd'
74 |
75 | deploy:
76 | - provider: s3
77 | access_key_id: AKIAJGQ2AT747PZ7POLA
78 | secret_access_key:
79 | secure: nTrRPshAm2dTH7PFZU0qjs82xk8d02sBLrY6IUovdMkpDypO9ztv0TGcoo330F9q9PZMel9OmtzR6BGUz/O6tmxzs3quc7OO7QlidpzMSi3r9+MxfcpXbJ0XTeQyM+wCd8lo65DeHQCjjt5Ze3tM9kfp+E3TnJJ8Qtc6UIiQNbnK39a1GwHnXL4nseBxaTZRHGgKTJvkN9vV54q3795rlDXIH0wv1xQTjjBlHi/Fc1ciziZ+U9PTn/OtFTO7zrK0oDPlzUJJDlT9v2JLvFtTrNfgZgN2rTqhQRK9zcaZwmAzUcrAT8re9jnQPG46gG0TOnsHIaAR5cFSyRTw5Kbmx3wWSpHk8iDM0K0FHnzb1jPSI15TMQdx+etr8mHhRDsn74YP6SdGXqZMmnDtZmoQS7jfKkddNc+S8c/2c1/sUmihZoRstth5FmQ+eiflOyyfZCNgvYf1d+YBqMgrOM0TJtlaqOuJkz/1NiV+GEQSNjFoF9wbsWukS5rWj/h/OXv2e99vRWdRBcjNfHXsKS/rnNOG6rAUVaAdvqKO6e1wVlGNfOMQsGE1CddLZ/XOagbT/g7yWXhONKnE06n/GgPhzKoMFJR9kWwYxJKgdFXc4eTnOpafws/s/yIbcDUQWQfFAHD2jooko8vSb3IH+gPi+LWPV7n5WPIkjuDGF5nrVGw=
80 | bucket: groupgets-ci
81 | local-dir: ${TRAVIS_BUILD_DIR}-build/release/package
82 | upload-dir: builds/${TRAVIS_BRANCH}
83 | acl: public_read
84 | skip_cleanup: true
85 | on:
86 | repo: groupgets/GetThermal
87 | all_branches: true
88 | - provider: releases
89 | api_key:
90 | secure: jTB9BnOADARnmOuhXv7eVXJhM3lIyb/hjnrqmdyrsJKFfzbASvMBCufaWtmsYMyJFMUUVIJ75XkNZ2fHgIkEikQEl8FytQT6G7s0WHZGnP+DSlRETFaZC5cK+nnYoPW9cK2n7Jp+QUPv5NOYiTJzScrnf4EfxPdC3smZNL07kpeWtuUQXHJ6PPhCHohFnUjX2x6n48vBK3S3Ys9unQgUlB238/4j+k2spZT3DGb5uZkiPbV4aEkKGH45u3v3e9js8pXzQJpzoMnWUJTLMSrwnnNWmHLaQc7eBAUbP4MVYOTQioLOFdFBGYGSoN+lDsMlhS1mBAXoqapRkhoROx/gFlhArC3QN1xhsSj6n4yDyBmXOUdRTgk4RCyBf9W8t5U6fXjZ/TTvN5P4ONk/cF3LXh/aVJctkJG/H2JMBkOqspUPaBjl+QPaOSEnu6hYNJXIArGRb/iuF1OK3EH9Uklyp7/yZDafJ8JvrRZpy0wsQXjM70a9yLQ1a7rbFkSeSgMoQKve44RzHjizhFk7MschI5SaN63xO5w6UUd44AQybojxC8gsoywCU4ZEJkSZwCV7IPGeaTe94bmBmqhjLbYnste8EKPaSNmbg3DRe5EOVvsYbpes/Mys3p8CHgoYyQ8LHIqhH+Q4fgxhcN9VvayKwyPcZaRvZjnPNe3HjThcNl8=
91 | file_glob: true
92 | file: "${TRAVIS_BUILD_DIR}-build/release/package/*"
93 | skip_cleanup: true
94 | on:
95 | repo: groupgets/GetThermal
96 | tags: true
97 |
--------------------------------------------------------------------------------
/Custom-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrincipalClass
6 | NSApplication
7 | CFBundleIconFile
8 | macos.icns
9 | CFBundlePackageType
10 | APPL
11 | CFBundleVersion
12 | ###
13 | CFBundleShortVersionString
14 | #.#.#
15 | CFBundleSignature
16 | ????
17 | CFBundleExecutable
18 | @EXECUTABLE@
19 | CFBundleIdentifier
20 | org.groupgets.getthermal
21 | NOTE
22 | Open source GetThermal app provided by GroupGets and GetLab
23 |
24 |
25 |
--------------------------------------------------------------------------------
/GetThermal.pro:
--------------------------------------------------------------------------------
1 | exists($${OUT_PWD}/GetThermal.pro) {
2 | error("You must use shadow build (e.g. mkdir build; cd build; qmake ../GetThermal.pro).")
3 | }
4 |
5 | message(Qt version $$[QT_VERSION])
6 |
7 | !equals(QT_MAJOR_VERSION, 5) | !greaterThan(QT_MINOR_VERSION, 6) {
8 | error("Unsupported Qt version, 5.7+ is required")
9 | }
10 |
11 | include(common.pri)
12 |
13 | DebugBuild {
14 | DESTDIR = $${OUT_PWD}/debug
15 | } else {
16 | DESTDIR = $${OUT_PWD}/release
17 | }
18 |
19 | QT += qml quick multimedia
20 |
21 | QT_CONFIG -= no-pkg-config
22 | CONFIG += c++11 \
23 | link_pkgconfig
24 |
25 | MacBuild: {
26 | PKG_CONFIG = /usr/local/bin/pkg-config
27 | }
28 |
29 | SOURCES += \
30 | src/main.cpp \
31 | src/uvcvideoproducer.cpp \
32 | src/uvcacquisition.cpp \
33 | src/uvcbuffer.cpp \
34 | src/leptonvariation.cpp \
35 | src/abstractccinterface.cpp \
36 | lepton_sdk/Src/LEPTON_AGC.c \
37 | lepton_sdk/Src/LEPTON_OEM.c \
38 | lepton_sdk/Src/LEPTON_RAD.c \
39 | lepton_sdk/Src/LEPTON_SDK.c \
40 | lepton_sdk/Src/LEPTON_SYS.c \
41 | lepton_sdk/Src/LEPTON_VID.c \
42 | lepton_sdk/Src/crc16fast.c \
43 | src/dataformatter.cpp \
44 | src/rangeprovider.cpp \
45 | src/bosonvariation.cpp \
46 | boson_sdk/Client_API.c \
47 | boson_sdk/Client_Dispatcher.c \
48 | boson_sdk/Client_Packager.c \
49 | boson_sdk/Example.c \
50 | boson_sdk/Serializer_BuiltIn.c \
51 | boson_sdk/Serializer_Struct.c \
52 | boson_sdk/UART_Connector.c \
53 | boson_sdk/flirChannels.c \
54 | boson_sdk/flirCRC.c \
55 | boson_sdk/libusb_binary_protocol.c
56 |
57 | RESOURCES += qml/qml.qrc
58 |
59 | # Additional import path used to resolve QML modules in Qt Creator's code model
60 | QML_IMPORT_PATH =
61 |
62 | HEADERS += \
63 | inc/uvcvideoproducer.h \
64 | inc/uvcbuffer.h \
65 | inc/uvcacquisition.h \
66 | inc/leptonvariation.h \
67 | inc/abstractccinterface.h \
68 | lepton_sdk/Inc/LEPTON_AGC.h \
69 | lepton_sdk/Inc/LEPTON_ErrorCodes.h \
70 | lepton_sdk/Inc/LEPTON_Macros.h \
71 | lepton_sdk/Inc/LEPTON_OEM.h \
72 | lepton_sdk/Inc/LEPTON_RAD.h \
73 | lepton_sdk/Inc/LEPTON_SDK.h \
74 | lepton_sdk/Inc/LEPTON_SDKConfig.h \
75 | lepton_sdk/Inc/LEPTON_SYS.h \
76 | lepton_sdk/Inc/LEPTON_Types.h \
77 | lepton_sdk/Inc/LEPTON_VID.h \
78 | lepton_sdk/Inc/crc16.h \
79 | lepton_sdk/Inc/uvc_sdk.h \
80 | inc/leptonvariation_types.h \
81 | inc/dataformatter.h \
82 | inc/rangeprovider.h \
83 | inc/bosonvariation.h \
84 | boson_sdk/Client_API.h \
85 | boson_sdk/Client_Dispatcher.h \
86 | boson_sdk/Client_Packager.h \
87 | boson_sdk/EnumTypes.h \
88 | boson_sdk/FunctionCodes.h \
89 | boson_sdk/ReturnCodes.h \
90 | boson_sdk/Serializer_BuiltIn.h \
91 | boson_sdk/Serializer_Struct.h \
92 | boson_sdk/UART_Connector.h \
93 | boson_sdk/flirChannels.h \
94 | boson_sdk/flirCRC.h \
95 | inc/bosonvariation_types.h
96 |
97 | DISTFILES += \
98 | qml/qtquickcontrols2.conf
99 |
100 | PKGCONFIG += libusb-1.0
101 |
102 | QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
103 |
104 | win32:CONFIG(release, debug|release): LIBS += -L$$PWD/libuvc/build/release/ -luvc
105 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/libuvc/build/debug/ -luvc
106 | else:macos: LIBS += -L$$PWD/libuvc/build/ -luvc
107 | else:unix: LIBS += -L$$PWD/libuvc/build/ -luvcstatic
108 |
109 | INCLUDEPATH += $$PWD/lepton_sdk/Inc \
110 | $$PWD/libuvc/build/include \
111 | $$PWD/libuvc/include \
112 | $$PWD/inc
113 | DEPENDPATH += $$PWD/libuvc/build/include \
114 | $$PWD/libuvc/include
115 |
116 | MacBuild {
117 | QMAKE_INFO_PLIST = Custom-Info.plist
118 | ICON = $${BASEDIR}/icons/macos.icns
119 | OTHER_FILES += Custom-Info.plist
120 | equals(QT_MAJOR_VERSION, 5) | greaterThan(QT_MINOR_VERSION, 5) {
121 | LIBS += -framework ApplicationServices
122 | }
123 | # This is required to fixup homebrew libusb-1.0 installation
124 | # the pkgconfig file for this doesn't include cxxflags, so we need to pick this up
125 | INCLUDEPATH += /usr/local/include
126 |
127 | # Support MacPorts libusb-1.0 installation
128 | INCLUDEPATH += /opt/local/include
129 | }
130 |
131 | # post-link configuration
132 | include(setup.pri)
133 |
134 | # installer scripts
135 | include(installer.pri)
136 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | Copyright (c) 2015 GroupGets LLC
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 |
6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GetThermal
2 |
3 | [](https://travis-ci.org/groupgets/GetThermal)
4 |
5 | A cross-platform thermal camera viewer application.
6 |
7 | 
8 |
9 | # Supported Platforms
10 |
11 | Binaries are available for desktop Linux (x64) and Mac OS platforms; see the Releases tab on GitHub. The Wiki tab has
12 | instructions for building on Raspbian. Success has also been reported on NVIDIA Linux for Tegra. Ultimately, any
13 | platform that runs QT 5.7+ and libusb should function with some effort.
14 |
15 | # Supported Cameras
16 |
17 | GetThermal supports all FLIR Lepton variants used with the USB
18 | [PureThermal 1](https://groupgets.com/manufacturers/getlab/products/purethermal-1-flir-lepton-smart-i-o-module) or
19 | [PureThermal 2](https://groupgets.com/manufacturers/getlab/products/purethermal-2-flir-lepton-smart-i-o-module) Smart I/O Modules,
20 | including the Radiometric Lepton 2.5 and 3.5
21 |
22 | It also supports basic thermal data acquisition from [FLIR Boson](https://groupgets.com/manufacturers/flir/products/boson) 320 and 640.
23 |
24 | # Building
25 |
26 | Prerequisites: You will need `libusb-1.0` and [CMake](http://www.cmake.org/) installed. You will
27 | also need [QT 5.7](https://www.qt.io/download-open-source/) or newer. On OS X, these packages should
28 | be available via Homebrew.
29 |
30 | `GetThermal` uses a modified version of `libuvc` for camera image download and control. Even if
31 | you have `libuvc` on your system already, you will have to build the fork.
32 |
33 | ## Get the source code
34 |
35 | git clone https://github.com/groupgets/GetThermal
36 | cd GetThermal
37 |
38 | ## Get libuvc and build
39 |
40 | To build the `libuvc` fork, you can run these shell commands:
41 |
42 | git submodule init
43 | git submodule update
44 | pushd libuvc
45 | mkdir build
46 | cd build
47 | cmake ..
48 | make
49 | popd
50 |
51 | ## Build GetThermal
52 |
53 | GetThermal is a QT qmake project. So all you should have to do now is to fire up QTCreator, open the project file,
54 | and hit run.
55 |
56 | ### OSx Qt-Creator build prerequisites
57 | If Qt Creator fails to run the application due to errors with linking the proper ImageIO.framework or libjpeg version, go to Projects -> Run -> Run Environment and edit the DYLD_FRAMEWORK_PATH and DYLD_LIBRARY_PATH by adding
58 |
59 | /System/Library/Frameworks/ImageIO.framework/Resources:
60 |
61 | to the beginning of the line.
62 |
63 | ### Via Command Line
64 | You can also build from the command line:
65 |
66 | qmake # or depending on your installation, maybe ~/Qt/5.7/clang_64/bin/qmake
67 | make
68 |
69 | # Releases
70 |
71 | This is a work in progress. See the Releases tab in github for OS X and Linux pre-release builds.
72 |
--------------------------------------------------------------------------------
/boson_sdk/Client_Dispatcher.c:
--------------------------------------------------------------------------------
1 | // /////////////////////////////////////////////////////
2 | // // DO NOT EDIT. This is a machine generated file. //
3 | // /////////////////////////////////////////////////////
4 | /******************************************************************************/
5 | /* */
6 | /* Copyright (C) 2015, FLIR Systems */
7 | /* All rights reserved. */
8 | /* */
9 | /* This document is controlled to FLIR Technology Level 2. The information */
10 | /* contained in this document pertains to a dual use product controlled for */
11 | /* export by the Export Administration Regulations (EAR). Diversion contrary */
12 | /* to US law is prohibited. US Department of Commerce authorization is not */
13 | /* required prior to export or transfer to foreign persons or parties unless */
14 | /* otherwise prohibited. */
15 | /* */
16 | /******************************************************************************/
17 |
18 | #include "Client_Dispatcher.h"
19 |
20 | FLR_RESULT CLIENT_dispatcher(uint32_t seqNum, FLR_FUNCTION fnID, const uint8_t *sendData, const uint32_t sendBytes, const uint8_t *receiveData, uint32_t *receiveBytes) {
21 |
22 | uint32_t i;
23 |
24 | // Allocated buffer with extra space for payload header
25 | uint8_t sendPayload[530];
26 | uint8_t *pyldPtr = (uint8_t *)sendPayload;
27 |
28 | // Write sequence number to first 4 bytes
29 | UINT_32ToByte(seqNum, (const uint8_t *)pyldPtr);
30 | pyldPtr += 4;
31 |
32 | // Write function ID to second 4 bytes
33 | UINT_32ToByte((const uint32_t) fnID, (const uint8_t *)pyldPtr);
34 | pyldPtr += 4;
35 |
36 | // Write 0xFFFFFFFF to third 4 bytes
37 | UINT_32ToByte(0xFFFFFFFF, (const uint8_t *)pyldPtr);
38 | pyldPtr += 4;
39 |
40 | // Copy sendData to payload buffer
41 | uint8_t *dataPtr = (uint8_t *)sendData;
42 | for(i = 0;i
22 | #include "ReturnCodes.h"
23 | #include "Serializer_Struct.h"
24 | #include "FunctionCodes.h"
25 | #include "UART_Connector.h"
26 |
27 | FLR_RESULT CLIENT_dispatcher(uint32_t seqNum, FLR_FUNCTION fnID, const uint8_t *sendData, const uint32_t sendBytes, const uint8_t *receiveData, uint32_t *receiveBytes);
28 |
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/boson_sdk/Example.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "Client_API.h"
4 | #include "EnumTypes.h"
5 | #include "UART_Connector.h"
6 |
7 |
8 | int boson_example()
9 | {
10 | uint32_t idx;
11 | FLR_RESULT result;
12 |
13 | printf("CameraSN: ");
14 | uint32_t camera_sn;
15 | result = bosonGetCameraSN(&camera_sn);
16 | if (result)
17 | {
18 | printf("Failed with status 0x%08X, exiting.\n",result);
19 | Close();
20 | return -1;
21 | }
22 | printf(" %d \n", camera_sn);
23 |
24 |
25 | // printf("\n");
26 | // FLR_DVO_SRC_E dvo_src;
27 | // result = dvoGetSource(&dvo_src);
28 | // printf("DVO Source: 0x%08X -- 0x%08X \n", result, dvo_src);
29 |
30 |
31 | printf("\n");
32 | uint32_t major, minor, patch;
33 | printf("SoftwareRev: ");
34 | result = bosonGetSoftwareRev(&major, &minor, &patch);
35 | if (result)
36 | {
37 | printf("Failed with status 0x%08X, exiting.\n",result);
38 | Close();
39 | return -1;
40 | }
41 | printf(" %u.%u.%u \n", major,minor,patch);
42 |
43 | printf("\n");
44 | FLR_BOSON_SENSOR_PARTNUMBER_T part_num;
45 | printf("PartNum: ");
46 | result = bosonGetSensorPN(&part_num);
47 | if (result)
48 | {
49 | printf("Failed with status 0x%08X, exiting.\n",result);
50 | Close();
51 | return -1;
52 | }
53 | printf(" \"%s\"", part_num.value);
54 | for (idx=0; idx=32 && tempchar<=125)
60 | {
61 | printf(" \"%c\"",tempchar);
62 | }
63 | else
64 | {
65 | printf(" %02X",tempchar);
66 | }
67 | }
68 | printf("\n");
69 |
70 | printf("\n");
71 | uint8_t data[256];
72 | printf("Capture Data[0:255]: ");
73 | // memReadCapture(index, offset, num_bytes, empty_data_buffer);
74 | result = memReadCapture(0, 0, 256, data);
75 | if (result)
76 | {
77 | printf("Failed with status 0x%08X, exiting.\n",result);
78 | Close();
79 | return -1;
80 | }
81 | printf(" -- ");
82 | for (idx=0; idx<256; idx++)
83 | {
84 | if ( !(idx%16) )
85 | printf("\n\t");
86 | printf(" %02X",data[idx]);
87 | }
88 | printf("\n");
89 | printf("Erase Flash: location=%d ",FLR_MEM_LENS_DISTORTION);
90 | // memEraseFlash(enum, index);
91 | result = memEraseFlash(FLR_MEM_LENS_DISTORTION, 1);
92 | if (result)
93 | {
94 | printf("Failed with status 0x%08X, exiting.\n",result);
95 | Close();
96 | return -1;
97 | }
98 | printf("Success.\n");
99 |
100 | printf("\n");
101 | uint8_t flashdata[64];
102 | printf("Flash Data[0:64]: ");
103 | // memReadFlash(enum, index, offset, num_bytes, empty_data_buffer);
104 | result = memReadFlash(FLR_MEM_LENS_DISTORTION, 1, 0, 64, flashdata);
105 | if (result)
106 | {
107 | printf("Failed with status 0x%08X, exiting.\n",result);
108 | Close();
109 | return -1;
110 | }
111 | printf("-- ");
112 | for (idx=0; idx<64; idx++)
113 | {
114 | if ( !(idx%16) )
115 | printf("\n\t");
116 | printf(" %02X",flashdata[idx]);
117 | }
118 | printf("\n");
119 |
120 | uint8_t writedata[64];
121 | for (idx=0; idx<64; idx++)
122 | {
123 | writedata[idx] = idx;
124 | }
125 | printf("Write Flash: ");
126 | result = memWriteFlash(FLR_MEM_LENS_DISTORTION, 1, 0, 64, writedata);
127 | if (result)
128 | {
129 | printf("Failed with status 0x%08X, exiting.\n",result);
130 | Close();
131 | return -1;
132 | }
133 | printf("success.\n");
134 |
135 | printf("\n");
136 | printf("Confirm Flash Data[0:64]: ");
137 | // memReadFlash(enum, index, offset, num_bytes, empty_data_buffer);
138 | result = memReadFlash(FLR_MEM_LENS_DISTORTION, 1, 0, 64, flashdata);
139 | if (result)
140 | {
141 | printf("Failed with status 0x%08X, exiting.\n",result);
142 | Close();
143 | return -1;
144 | }
145 | for (idx=0; idx<64; idx++)
146 | {
147 | if ( !(idx%16) )
148 | printf("\n\t");
149 | printf(" %02X",flashdata[idx]);
150 | }
151 | printf("\n");
152 |
153 | printf("\n");
154 | printf("Erase Flash: ");
155 | // memEraseFlash(enum, index);
156 | result = memEraseFlash(FLR_MEM_LENS_DISTORTION, 1);
157 | if (result)
158 | {
159 | printf("Failed with status 0x%08X, exiting.\n",result);
160 | Close();
161 | return -1;
162 | }
163 | printf("success.\n");
164 |
165 | result = bosonRunFFC();
166 | printf("RunFFC: 0x%08X \n", result);
167 |
168 | return 0;
169 | }
170 |
--------------------------------------------------------------------------------
/boson_sdk/ReturnCodes.h:
--------------------------------------------------------------------------------
1 | // /////////////////////////////////////////////////////
2 | // // DO NOT EDIT. This is a machine generated file. //
3 | // /////////////////////////////////////////////////////
4 | /******************************************************************************/
5 | /* */
6 | /* Copyright (C) 2015, FLIR Systems */
7 | /* All rights reserved. */
8 | /* */
9 | /* This document is controlled to FLIR Technology Level 2. The information */
10 | /* contained in this document pertains to a dual use product controlled for */
11 | /* export by the Export Administration Regulations (EAR). Diversion contrary */
12 | /* to US law is prohibited. US Department of Commerce authorization is not */
13 | /* required prior to export or transfer to foreign persons or parties unless */
14 | /* otherwise prohibited. */
15 | /* */
16 | /******************************************************************************/
17 |
18 | #ifndef FLR_RESULT_CODES_H
19 | #define FLR_RESULT_CODES_H
20 |
21 | enum _returnCodes {
22 | MAX_ERR_CODE = 0xFFFFFFFF, // 65535
23 |
24 | R_SUCCESS = 0U, // 0x00000000
25 | R_UART_UNSPECIFIED_FAILURE = 1U, // 0x00000001
26 | R_UART_PORT_FAILURE = 2U, // 0x00000002
27 | R_UART_RECEIVE_TIMEOUT = 3U, // 0x00000003
28 | R_UART_PORT_ALREADY_OPEN = 4U, // 0x00000004
29 |
30 | R_SDK_API_UNSPECIFIED_FAILURE = 272U, // 0x00000110
31 | R_SDK_PKG_UNSPECIFIED_FAILURE = 288U, // 0x00000120
32 | R_SDK_PKG_BUFFER_OVERFLOW = 303U, // 0x0000012F
33 | R_SDK_DSPCH_UNSPECIFIED_FAILURE = 304U, // 0x00000130
34 | R_SDK_DSPCH_SEQUENCE_MISMATCH = 305U, // 0x00000131
35 | R_SDK_DSPCH_ID_MISMATCH = 306U, // 0x00000132
36 | R_SDK_DSPCH_MALFORMED_STATUS = 307U, // 0x00000133
37 | R_SDK_TX_UNSPECIFIED_FAILURE = 320U, // 0x00000140
38 | R_CAM_RX_UNSPECIFIED_FAILURE = 336U, // 0x00000150
39 | R_CAM_DSPCH_UNSPECIFIED_FAILURE = 352U, // 0x00000160
40 | R_CAM_DSPCH_BAD_CMD_ID = 353U, // 0x00000161
41 | R_CAM_DSPCH_BAD_PAYLOAD_STATUS = 354U, // 0x00000162
42 | R_CAM_PKG_UNSPECIFIED_FAILURE = 368U, // 0x00000170
43 | R_CAM_PKG_INSUFFICIENT_BYTES = 381U, // 0x0000017D
44 | R_CAM_PKG_EXCESS_BYTES = 382U, // 0x0000017E
45 | R_CAM_PKG_BUFFER_OVERFLOW = 383U, // 0x0000017F
46 | R_CAM_API_UNSPECIFIED_FAILURE = 384U, // 0x00000180
47 | R_CAM_API_INVALID_INPUT = 385U, // 0x00000181
48 | R_CAM_TX_UNSPECIFIED_FAILURE = 400U, // 0x00000190
49 | R_API_RX_UNSPECIFIED_FAILURE = 416U, // 0x000001A0
50 |
51 | FLR_OK = 0U, // 0x00000000
52 | FLR_COMM_OK = 0U, // 0x00000000
53 |
54 | FLR_ERROR = 513U, // 0x00000201
55 | FLR_NOT_READY = 514U, // 0x00000202
56 | FLR_RANGE_ERROR = 515U, // 0x00000203
57 | FLR_CHECKSUM_ERROR = 516U, // 0x00000204
58 | FLR_BAD_ARG_POINTER_ERROR = 517U, // 0x00000205
59 | FLR_DATA_SIZE_ERROR = 518U, // 0x00000206
60 | FLR_UNDEFINED_FUNCTION_ERROR = 519U, // 0x00000207
61 | FLR_ILLEGAL_ADDRESS_ERROR = 520U, // 0x00000208
62 | FLR_COMM_PORT_NOT_OPEN = 613U, // 0x00000265
63 | FLR_COMM_INVALID_PORT_ERROR = 614U, // 0x00000266
64 | FLR_COMM_RANGE_ERROR = 615U, // 0x00000267
65 | FLR_ERROR_CREATING_COMM = 616U, // 0x00000268
66 | FLR_ERROR_STARTING_COMM = 617U, // 0x00000269
67 | FLR_ERROR_CLOSING_COMM = 618U, // 0x0000026A
68 | FLR_COMM_CHECKSUM_ERROR = 619U, // 0x0000026B
69 | FLR_COMM_NO_DEV = 620U, // 0x0000026C
70 | FLR_COMM_TIMEOUT_ERROR = 621U, // 0x0000026D
71 | FLR_COMM_ERROR_WRITING_COMM = 621U, // 0x0000026D
72 | FLR_COMM_ERROR_READING_COMM = 622U, // 0x0000026E
73 | FLR_COMM_COUNT_ERROR = 623U, // 0x0000026F
74 | FLR_OPERATION_CANCELED = 638U, // 0x0000027E
75 | FLR_UNDEFINED_ERROR_CODE = 639U, // 0x0000027F
76 | FLR_LEN_NOT_SUBBLOCK_BOUNDARY = 640U, // 0x00000280
77 | FLR_CONFIG_ERROR = 641U, // 0x00000281
78 | };
79 | typedef enum _returnCodes FLR_RESULT;
80 |
81 | #endif
82 |
--------------------------------------------------------------------------------
/boson_sdk/Serializer_BuiltIn.c:
--------------------------------------------------------------------------------
1 | #include "Serializer_BuiltIn.h"
2 | //#include
3 |
4 | void byteToBOOL(const uint8_t *inBuff, _Bool *outVal){
5 | *outVal = (_Bool) *inBuff;
6 | }
7 | void byteToBOOLArray(const uint8_t *inBuff, _Bool *outVal,uint16_t length){
8 | uint16_t i;
9 | for (i=0;i>8 & 0xff);
161 | *outPtr = (uint8_t) (tempBytes & 0xff);
162 | }
163 | void INT_16ArrayToByte(const int16_t *inVal,uint16_t length, const uint8_t *outBuff){
164 | uint16_t i;
165 | for (i=0;i>8 & 0xff);
173 | *outPtr = (uint8_t) (inVal & 0xff);
174 | }
175 | void UINT_16ArrayToByte(const uint16_t *inVal,uint16_t length, const uint8_t *outBuff){
176 | uint16_t i;
177 | for (i=0;i>24 & 0xff);
186 | *outPtr++ = (uint8_t) (tempBytes>>16 & 0xff);
187 | *outPtr++ = (uint8_t) (tempBytes>>8 & 0xff);
188 | *outPtr = (uint8_t) (tempBytes & 0xff);
189 | }
190 | void INT_32ArrayToByte(const int32_t *inVal,uint16_t length, const uint8_t *outBuff){
191 | uint16_t i;
192 | for (i=0;i>24 & 0xff);
200 | *outPtr++ = (uint8_t) (inVal>>16 & 0xff);
201 | *outPtr++ = (uint8_t) (inVal>>8 & 0xff);
202 | *outPtr = (uint8_t) (inVal & 0xff);
203 | }
204 | void UINT_32ArrayToByte(const uint32_t *inVal,uint16_t length, const uint8_t *outBuff){
205 | uint16_t i;
206 | for (i=0;i>24 & 0xff);
215 | *outPtr++ = (uint8_t) (tempBytes>>16 & 0xff);
216 | *outPtr++ = (uint8_t) (tempBytes>>8 & 0xff);
217 | *outPtr = (uint8_t) (tempBytes & 0xff);
218 | }
219 | void FLOATArrayToByte(const float *inVal,uint16_t length, const uint8_t *outBuff){
220 | uint16_t i;
221 | for (i=0;i>56 & 0xff);
230 | *outPtr++ = (uint8_t) (tempBytes>>48 & 0xff);
231 | *outPtr++ = (uint8_t) (tempBytes>>40 & 0xff);
232 | *outPtr++ = (uint8_t) (tempBytes>>32 & 0xff);
233 | *outPtr++ = (uint8_t) (tempBytes>>24 & 0xff);
234 | *outPtr++ = (uint8_t) (tempBytes>>16 & 0xff);
235 | *outPtr++ = (uint8_t) (tempBytes>>8 & 0xff);
236 | *outPtr = (uint8_t) (tempBytes & 0xff);
237 | }
238 | void DOUBLEArrayToByte(const double *inVal,uint16_t length, const uint8_t *outBuff){
239 | uint16_t i;
240 | for (i=0;i
5 | #include
6 |
7 | extern void byteToBOOL(const uint8_t*inBuff, bool *outVal);
8 | extern void byteToCHAR(const uint8_t*inBuff, int8_t *outVal);
9 | extern void byteToUCHAR(const uint8_t*inBuff, uint8_t *outVal);
10 | extern void byteToINT_16(const uint8_t*inBuff, int16_t *outVal);
11 | extern void byteToUINT_16(const uint8_t*inBuff, uint16_t *outVal);
12 | extern void byteToINT_32(const uint8_t*inBuff, int32_t *outVal);
13 | extern void byteToUINT_32(const uint8_t*inBuff, uint32_t *outVal);
14 | extern void byteToFLOAT(const uint8_t*inBuff, float *outVal);
15 | extern void byteToDOUBLE(const uint8_t*inBuff, double *outVal);
16 |
17 | extern void byteToBOOLArray(const uint8_t*inBuff, bool *outVal,uint16_t length);
18 | extern void byteToCHARArray(const uint8_t*inBuff, int8_t *outVal,uint16_t length);
19 | extern void byteToUCHARArray(const uint8_t*inBuff, uint8_t *outVal,uint16_t length);
20 | extern void byteToINT_16Array(const uint8_t*inBuff, int16_t *outVal,uint16_t length);
21 | extern void byteToUINT_16Array(const uint8_t*inBuff, uint16_t *outVal,uint16_t length);
22 | extern void byteToINT_32Array(const uint8_t*inBuff, int32_t *outVal,uint16_t length);
23 | extern void byteToUINT_32Array(const uint8_t*inBuff, uint32_t *outVal,uint16_t length);
24 | extern void byteToFLOATArray(const uint8_t*inBuff, float *outVal,uint16_t length);
25 | extern void byteToDOUBLEArray(const uint8_t*inBuff, double *outVal,uint16_t length);
26 |
27 | extern void BOOLToByte(const bool inVal, const uint8_t *outBuff);
28 | extern void CHARToByte(const int8_t inVal, const uint8_t *outBuff );
29 | extern void UCHARToByte(const uint8_t inVal, const uint8_t *outBuff);
30 | extern void INT_16ToByte(const int16_t inVal, const uint8_t *outBuff);
31 | extern void UINT_16ToByte(const uint16_t inVal, const uint8_t *outBuff);
32 | extern void INT_32ToByte(const int32_t inVal, const uint8_t *outBuff);
33 | extern void UINT_32ToByte(const uint32_t inVal, const uint8_t *outBuff);
34 | extern void FLOATToByte(const float inVal, const uint8_t *outBuff);
35 | extern void DOUBLEToByte(const double inVal, const uint8_t *outBuff);
36 |
37 | extern void BOOLArrayToByte(const bool *inVal, uint16_t length, const uint8_t *outBuff);
38 | extern void CHARArrayToByte(const int8_t *inVal, uint16_t length, const uint8_t *outBuff );
39 | extern void UCHARArrayToByte(const uint8_t *inVal, uint16_t length, const uint8_t *outBuff);
40 | extern void INT_16ArrayToByte(const int16_t *inVal, uint16_t length, const uint8_t *outBuff);
41 | extern void UINT_16ArrayToByte(const uint16_t *inVal, uint16_t length, const uint8_t *outBuff);
42 | extern void INT_32ArrayToByte(const int32_t *inVal, uint16_t length, const uint8_t *outBuff);
43 | extern void UINT_32ArrayToByte(const uint32_t *inVal, uint16_t length, const uint8_t *outBuff);
44 | extern void FLOATArrayToByte(const float *inVal, uint16_t length, const uint8_t *outBuff);
45 | extern void DOUBLEArrayToByte(const double *inVal, uint16_t length, const uint8_t *outBuff);
46 |
47 |
48 | #endif //BOSON_BUILTIN_HANDLERS_H
49 |
--------------------------------------------------------------------------------
/boson_sdk/Serializer_Struct.h:
--------------------------------------------------------------------------------
1 | // /////////////////////////////////////////////////////
2 | // // DO NOT EDIT. This is a machine generated file. //
3 | // /////////////////////////////////////////////////////
4 |
5 | /******************************************************************************/
6 | /* */
7 | /* Copyright (C) 2015, FLIR Systems */
8 | /* All rights reserved. */
9 | /* */
10 | /* This document is controlled to FLIR Technology Level 2. The information */
11 | /* contained in this document pertains to a dual use product controlled for */
12 | /* export by the Export Administration Regulations (EAR). Diversion contrary */
13 | /* to US law is prohibited. US Department of Commerce authorization is not */
14 | /* required prior to export or transfer to foreign persons or parties unless */
15 | /* otherwise prohibited. */
16 | /* */
17 | /******************************************************************************/
18 |
19 |
20 | #ifndef SERIALIZER_STRUCT_H
21 | #define SERIALIZER_STRUCT_H
22 |
23 | #include
24 | #include "EnumTypes.h"
25 | #include "Serializer_BuiltIn.h"
26 |
27 | struct t_FLR_ROIC_CONTROL_WORD_T {
28 | uint16_t value[16];
29 | };
30 | typedef struct t_FLR_ROIC_CONTROL_WORD_T FLR_ROIC_CONTROL_WORD_T;
31 |
32 | void byteToFLR_ROIC_CONTROL_WORD_T(const uint8_t *inBuff, FLR_ROIC_CONTROL_WORD_T *outVal);
33 | void FLR_ROIC_CONTROL_WORD_TToByte(const FLR_ROIC_CONTROL_WORD_T *inVal, const uint8_t *outBuff);
34 |
35 | struct t_FLR_ROIC_FPATEMP_TABLE_T {
36 | int16_t value[32];
37 | };
38 | typedef struct t_FLR_ROIC_FPATEMP_TABLE_T FLR_ROIC_FPATEMP_TABLE_T;
39 |
40 | void byteToFLR_ROIC_FPATEMP_TABLE_T(const uint8_t *inBuff, FLR_ROIC_FPATEMP_TABLE_T *outVal);
41 | void FLR_ROIC_FPATEMP_TABLE_TToByte(const FLR_ROIC_FPATEMP_TABLE_T *inVal, const uint8_t *outBuff);
42 |
43 | struct t_FLR_BOSON_PARTNUMBER_T {
44 | uint8_t value[20];
45 | };
46 | typedef struct t_FLR_BOSON_PARTNUMBER_T FLR_BOSON_PARTNUMBER_T;
47 |
48 | void byteToFLR_BOSON_PARTNUMBER_T(const uint8_t *inBuff, FLR_BOSON_PARTNUMBER_T *outVal);
49 | void FLR_BOSON_PARTNUMBER_TToByte(const FLR_BOSON_PARTNUMBER_T *inVal, const uint8_t *outBuff);
50 |
51 | struct t_FLR_BOSON_SENSOR_PARTNUMBER_T {
52 | uint8_t value[32];
53 | };
54 | typedef struct t_FLR_BOSON_SENSOR_PARTNUMBER_T FLR_BOSON_SENSOR_PARTNUMBER_T;
55 |
56 | void byteToFLR_BOSON_SENSOR_PARTNUMBER_T(const uint8_t *inBuff, FLR_BOSON_SENSOR_PARTNUMBER_T *outVal);
57 | void FLR_BOSON_SENSOR_PARTNUMBER_TToByte(const FLR_BOSON_SENSOR_PARTNUMBER_T *inVal, const uint8_t *outBuff);
58 |
59 | struct t_FLR_BOSON_GAIN_SWITCH_PARAMS_T {
60 | uint32_t pHighToLowPercent;
61 | uint32_t cHighToLowPercent;
62 | uint32_t pLowToHighPercent;
63 | uint32_t hysteresisPercent;
64 | };
65 | typedef struct t_FLR_BOSON_GAIN_SWITCH_PARAMS_T FLR_BOSON_GAIN_SWITCH_PARAMS_T;
66 |
67 | void byteToFLR_BOSON_GAIN_SWITCH_PARAMS_T(const uint8_t *inBuff, FLR_BOSON_GAIN_SWITCH_PARAMS_T *outVal);
68 | void FLR_BOSON_GAIN_SWITCH_PARAMS_TToByte(const FLR_BOSON_GAIN_SWITCH_PARAMS_T *inVal, const uint8_t *outBuff);
69 |
70 | struct t_FLR_DVO_YCBCR_SETTINGS_T {
71 | FLR_DVO_OUTPUT_YCBCR_FORMAT_E ycbcrFormat;
72 | FLR_DVO_OUTPUT_CBCR_ORDER_E cbcrOrder;
73 | FLR_DVO_OUTPUT_Y_ORDER_E yOrder;
74 | };
75 | typedef struct t_FLR_DVO_YCBCR_SETTINGS_T FLR_DVO_YCBCR_SETTINGS_T;
76 |
77 | void byteToFLR_DVO_YCBCR_SETTINGS_T(const uint8_t *inBuff, FLR_DVO_YCBCR_SETTINGS_T *outVal);
78 | void FLR_DVO_YCBCR_SETTINGS_TToByte(const FLR_DVO_YCBCR_SETTINGS_T *inVal, const uint8_t *outBuff);
79 |
80 | struct t_FLR_DVO_RGB_SETTINGS_T {
81 | FLR_DVO_OUTPUT_RGB_FORMAT_E rgbFormat;
82 | FLR_DVO_OUTPUT_RGB_ORDER_E rgbOrder;
83 | };
84 | typedef struct t_FLR_DVO_RGB_SETTINGS_T FLR_DVO_RGB_SETTINGS_T;
85 |
86 | void byteToFLR_DVO_RGB_SETTINGS_T(const uint8_t *inBuff, FLR_DVO_RGB_SETTINGS_T *outVal);
87 | void FLR_DVO_RGB_SETTINGS_TToByte(const FLR_DVO_RGB_SETTINGS_T *inVal, const uint8_t *outBuff);
88 |
89 | struct t_FLR_CAPTURE_SETTINGS_T {
90 | FLR_CAPTURE_SRC_E dataSrc;
91 | uint32_t numFrames;
92 | uint16_t bufferIndex;
93 | };
94 | typedef struct t_FLR_CAPTURE_SETTINGS_T FLR_CAPTURE_SETTINGS_T;
95 |
96 | void byteToFLR_CAPTURE_SETTINGS_T(const uint8_t *inBuff, FLR_CAPTURE_SETTINGS_T *outVal);
97 | void FLR_CAPTURE_SETTINGS_TToByte(const FLR_CAPTURE_SETTINGS_T *inVal, const uint8_t *outBuff);
98 |
99 | struct t_FLR_AGC_ROI_T {
100 | uint16_t rowStart;
101 | uint16_t rowStop;
102 | uint16_t colStart;
103 | uint16_t colStop;
104 | };
105 | typedef struct t_FLR_AGC_ROI_T FLR_AGC_ROI_T;
106 |
107 | void byteToFLR_AGC_ROI_T(const uint8_t *inBuff, FLR_AGC_ROI_T *outVal);
108 | void FLR_AGC_ROI_TToByte(const FLR_AGC_ROI_T *inVal, const uint8_t *outBuff);
109 |
110 | struct t_FLR_TF_WLUT_T {
111 | uint8_t value[32];
112 | };
113 | typedef struct t_FLR_TF_WLUT_T FLR_TF_WLUT_T;
114 |
115 | void byteToFLR_TF_WLUT_T(const uint8_t *inBuff, FLR_TF_WLUT_T *outVal);
116 | void FLR_TF_WLUT_TToByte(const FLR_TF_WLUT_T *inVal, const uint8_t *outBuff);
117 |
118 | struct t_FLR_TF_NF_LUT_T {
119 | uint16_t value[17];
120 | };
121 | typedef struct t_FLR_TF_NF_LUT_T FLR_TF_NF_LUT_T;
122 |
123 | void byteToFLR_TF_NF_LUT_T(const uint8_t *inBuff, FLR_TF_NF_LUT_T *outVal);
124 | void FLR_TF_NF_LUT_TToByte(const FLR_TF_NF_LUT_T *inVal, const uint8_t *outBuff);
125 |
126 | struct t_FLR_TF_MOTION_DELTA_LUT_T {
127 | uint32_t value[10];
128 | };
129 | typedef struct t_FLR_TF_MOTION_DELTA_LUT_T FLR_TF_MOTION_DELTA_LUT_T;
130 |
131 | void byteToFLR_TF_MOTION_DELTA_LUT_T(const uint8_t *inBuff, FLR_TF_MOTION_DELTA_LUT_T *outVal);
132 | void FLR_TF_MOTION_DELTA_LUT_TToByte(const FLR_TF_MOTION_DELTA_LUT_T *inVal, const uint8_t *outBuff);
133 |
134 | struct t_FLR_SPNR_PSD_KERNEL_T {
135 | float fvalue[64];
136 | };
137 | typedef struct t_FLR_SPNR_PSD_KERNEL_T FLR_SPNR_PSD_KERNEL_T;
138 |
139 | void byteToFLR_SPNR_PSD_KERNEL_T(const uint8_t *inBuff, FLR_SPNR_PSD_KERNEL_T *outVal);
140 | void FLR_SPNR_PSD_KERNEL_TToByte(const FLR_SPNR_PSD_KERNEL_T *inVal, const uint8_t *outBuff);
141 |
142 | struct t_FLR_SPNR_SF_LUT_T {
143 | float value[10];
144 | };
145 | typedef struct t_FLR_SPNR_SF_LUT_T FLR_SPNR_SF_LUT_T;
146 |
147 | void byteToFLR_SPNR_SF_LUT_T(const uint8_t *inBuff, FLR_SPNR_SF_LUT_T *outVal);
148 | void FLR_SPNR_SF_LUT_TToByte(const FLR_SPNR_SF_LUT_T *inVal, const uint8_t *outBuff);
149 |
150 | struct t_FLR_SCALER_ZOOM_AREA_T {
151 | uint32_t zoom;
152 | FLR_SCALER_FILTER_E filter;
153 | uint32_t xStart;
154 | uint32_t yStart;
155 | uint32_t width;
156 | uint32_t height;
157 | };
158 | typedef struct t_FLR_SCALER_ZOOM_AREA_T FLR_SCALER_ZOOM_AREA_T;
159 |
160 | void byteToFLR_SCALER_ZOOM_AREA_T(const uint8_t *inBuff, FLR_SCALER_ZOOM_AREA_T *outVal);
161 | void FLR_SCALER_ZOOM_AREA_TToByte(const FLR_SCALER_ZOOM_AREA_T *inVal, const uint8_t *outBuff);
162 |
163 | struct t_FLR_SCALER_ZOOM_PARAMS_T {
164 | uint32_t zoom;
165 | uint32_t xCenter;
166 | uint32_t yCenter;
167 | };
168 | typedef struct t_FLR_SCALER_ZOOM_PARAMS_T FLR_SCALER_ZOOM_PARAMS_T;
169 |
170 | void byteToFLR_SCALER_ZOOM_PARAMS_T(const uint8_t *inBuff, FLR_SCALER_ZOOM_PARAMS_T *outVal);
171 | void FLR_SCALER_ZOOM_PARAMS_TToByte(const FLR_SCALER_ZOOM_PARAMS_T *inVal, const uint8_t *outBuff);
172 |
173 | struct t_FLR_TESTRAMP_SETTINGS_T {
174 | uint16_t start;
175 | uint16_t end;
176 | uint16_t increment;
177 | };
178 | typedef struct t_FLR_TESTRAMP_SETTINGS_T FLR_TESTRAMP_SETTINGS_T;
179 |
180 | void byteToFLR_TESTRAMP_SETTINGS_T(const uint8_t *inBuff, FLR_TESTRAMP_SETTINGS_T *outVal);
181 | void FLR_TESTRAMP_SETTINGS_TToByte(const FLR_TESTRAMP_SETTINGS_T *inVal, const uint8_t *outBuff);
182 |
183 | #endif //SERIALIZER_STRUCT_H
184 |
--------------------------------------------------------------------------------
/boson_sdk/UART_Connector.c:
--------------------------------------------------------------------------------
1 |
2 | /******************************************************************************/
3 | /* */
4 | /* Copyright (C) 2015, FLIR Systems */
5 | /* All rights reserved. */
6 | /* */
7 | /* This document is controlled to FLIR Technology Level 2. The information */
8 | /* contained in this document pertains to a dual use product controlled for */
9 | /* export by the Export Administration Regulations (EAR). Diversion contrary */
10 | /* to US law is prohibited. US Department of Commerce authorization is not */
11 | /* required prior to export or transfer to foreign persons or parties unless */
12 | /* otherwise prohibited. */
13 | /* */
14 | /******************************************************************************/
15 |
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 |
22 | #include "UART_Connector.h"
23 |
24 | uint8_t open_port(libusb_device_handle *devh);
25 | void close_port(libusb_device_handle *devh);
26 | void send_to_camera(libusb_device_handle *devh, uint8_t channel_ID, uint32_t sendBytes, uint8_t *sendPayload);//, uint32_t *receiveBytes, uint8_t *receivePayload);
27 | // void read_command(int32_t port_num, uint8_t channel_ID, uint32_t sendBytes, uint8_t *sendPayload, uint32_t *receiveBytes, uint8_t *receivePayload);
28 | void read_frame(libusb_device_handle *devh,uint8_t channel_ID, uint16_t start_byte_ms,uint32_t *receiveBytes, uint8_t *receiveBuffer);
29 | void read_unframed(libusb_device_handle *devh, uint16_t start_byte_ms,uint32_t *receiveBytes, uint8_t *receiveBuffer);
30 |
31 | static uint8_t isInitialized = 0;
32 |
33 | /* We use a global variable to keep the device handle
34 | */
35 | static struct libusb_device_handle *devh = NULL;
36 |
37 | FLR_RESULT Initialize(libusb_device_handle *indevh)
38 | {
39 | if (isInitialized) return R_UART_PORT_ALREADY_OPEN;
40 |
41 | devh = indevh;
42 |
43 | // __declspec( dllimport ) uint8_t open_port(int32_t port_num, int32_t baud_rate);
44 | if (open_port(devh)) return R_UART_PORT_FAILURE;
45 |
46 | isInitialized = 1;
47 | return FLR_COMM_OK; // 0 == success.
48 | }
49 |
50 | void Close()
51 | {
52 | // __declspec( dllimport ) void close_port(int32_t port_num);
53 | close_port(devh);
54 | isInitialized = 0;
55 | devh = NULL;
56 | // myPort = 0;
57 | }
58 |
59 | void SendToCamera( uint8_t channelID, uint32_t sendBytes, uint8_t *sendData)
60 | {
61 | if (!isInitialized) return;
62 |
63 | // __declspec( dllimport ) void send_to_camera(int32_t port_num, uint8_t channel_ID, uint32_t sendBytes, uint8_t *sendPayload);
64 | send_to_camera(devh, channelID, sendBytes, sendData);
65 | }
66 |
67 |
68 | void ReadFrame( uint8_t channelID, uint32_t *receiveBytes, uint8_t *receiveData)
69 | {
70 | // __declspec( dllimport ) void read_frame(int32_t port_num,uint8_t channel_ID, uint16_t start_byte_ms,uint32_t *receiveBytes, uint8_t *receiveBuffer);
71 | // hardcoded 1000ms polling delay for now
72 | read_frame(devh, channelID, 1000, receiveBytes, receiveData);
73 | }
74 |
75 |
76 | void ReadUnframed(uint32_t *receiveBytes, uint8_t *receiveData)
77 | {
78 | // __declspec( dllimport ) void read_unframed(int32_t port_num, uint16_t start_byte_ms,uint32_t *receiveBytes, uint8_t *receiveBuffer);
79 | // hardcoded 25ms polling delay for now
80 | read_unframed(devh, 25, receiveBytes,receiveData);
81 | }
82 |
--------------------------------------------------------------------------------
/boson_sdk/UART_Connector.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************/
2 | /* */
3 | /* Copyright (C) 2015, FLIR Systems */
4 | /* All rights reserved. */
5 | /* */
6 | /* This document is controlled to FLIR Technology Level 2. The information */
7 | /* contained in this document pertains to a dual use product controlled for */
8 | /* export by the Export Administration Regulations (EAR). Diversion contrary */
9 | /* to US law is prohibited. US Department of Commerce authorization is not */
10 | /* required prior to export or transfer to foreign persons or parties unless */
11 | /* otherwise prohibited. */
12 | /* */
13 | /******************************************************************************/
14 |
15 | #ifndef UART_CONNECTOR_H
16 | #define UART_CONNECTOR_H
17 |
18 | #include
19 | #include
20 | #include "ReturnCodes.h"
21 |
22 | void SendToCamera( uint8_t channelID, uint32_t sendBytes, uint8_t *sendData);
23 | void ReadFrame( uint8_t channelID, uint32_t *receiveBytes, uint8_t *receiveData);
24 | void ReadUnframed(uint32_t *receiveBytes, uint8_t *receiveData);
25 | FLR_RESULT Initialize(libusb_device_handle *devh);
26 | void Close();
27 |
28 | #endif //UART_CONNECTOR_H
29 |
--------------------------------------------------------------------------------
/boson_sdk/flirCRC.c:
--------------------------------------------------------------------------------
1 | #include "flirCRC.h"
2 |
3 | static const uint16_t ccitt_16Table[] = {
4 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
5 | 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
6 | 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
7 | 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
8 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
9 | 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
10 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
11 | 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
12 | 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
13 | 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
14 | 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
15 | 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
16 | 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
17 | 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
18 | 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
19 | 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
20 | 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
21 | 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
22 | 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
23 | 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
24 | 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
25 | 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
26 | 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
27 | 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
28 | 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
29 | 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
30 | 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
31 | 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
32 | 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
33 | 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
34 | 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
35 | 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
36 | };
37 |
38 |
39 | #define _FAST
40 | #ifdef _FAST
41 | //
42 | // ===== ByteCRC16 ===== FAST
43 | // Calculate (update) the CRC16 for a single 8-bit byte
44 | //
45 | #if 0
46 | int ByteCRC16(int value, int crcin)
47 | {
48 | return (unsigned short)((crcin << 8) ^ ccitt_16Table[((crcin >> 8) ^ (value)) & 255]);
49 | }
50 | #endif
51 |
52 | #else
53 | //
54 | // ===== ByteCRC16 ===== SLOW
55 | // Calculate (update) the CRC16 for a single 8-bit byte
56 | //
57 | int ByteCRC16(int value, int crcin)
58 | {
59 | int k = (((crcin >> 8) ^ value) & 255) << 8;
60 | int crc = 0;
61 | int bits = 8;
62 | do
63 | {
64 | if ( ( crc ^ k ) & 0x8000 )
65 | crc = (crc << 1) ^ 0x1021;
66 | else
67 | crc <<= 1;
68 | k <<= 1;
69 | }
70 | while ( --bits );
71 | return ((crcin << 8) ^ crc);
72 | }
73 | #endif
74 |
75 |
76 | #define _LITTLE_ENDIAN 0
77 | #define _BIG_ENDIAN 1
78 |
79 | //
80 | // ===== CalcCRC16Words =====
81 | // Calculate the CRC for a buffer of 16-bit words. Supports both
82 | // Little and Big Endian formats using conditional compilation.
83 | // Note: minimum count is 1 (0 case not handled)
84 | //
85 | uint16_t calcFlirCRC16Words(unsigned int count, short *buffer)
86 | {
87 | int crc = FLIR_CRC_INITIAL_VALUE;
88 | int endian = _LITTLE_ENDIAN;
89 | do
90 | {
91 | int value = *buffer++;
92 | if ( endian == _BIG_ENDIAN )
93 | {
94 | crc = ByteCRC16(value >> 8, crc);
95 | crc = ByteCRC16(value, crc);
96 | }
97 | else
98 | {
99 | crc = ByteCRC16(value, crc);
100 | crc = ByteCRC16(value >> 8, crc);
101 | }
102 | }
103 | while ( --count );
104 | return (uint16_t) crc;
105 | }
106 |
107 |
108 | //
109 | // ===== CalcCRC16Bytes =====
110 | // Calculate the CRC for a buffer of 8-bit words.
111 | // Note: minimum count is 1 (0 case not handled)
112 | //
113 | uint16_t calcFlirCRC16Bytes(unsigned int count, char *buffer)
114 | {
115 |
116 | int crc = FLIR_CRC_INITIAL_VALUE;
117 |
118 | do
119 | {
120 | int value = *buffer++;
121 | crc = ByteCRC16(value, crc);
122 | }
123 | while ( --count );
124 |
125 | return (uint16_t) crc;
126 | }
127 |
--------------------------------------------------------------------------------
/boson_sdk/flirCRC.h:
--------------------------------------------------------------------------------
1 | #ifndef _FLIR_CRC_H_
2 | #define _FLIR_CRC_H_
3 |
4 | #include
5 |
6 | #define FLIR_CRC_INITIAL_VALUE (0x1D0F)
7 |
8 | uint16_t calcFlirCRC16Words(unsigned int count, short *buffer);
9 | uint16_t calcFlirCRC16Bytes(unsigned int count, char *buffer);
10 | int ByteCRC16(int value, int crcin);
11 | #endif // _FLIR_CRC_H_
12 |
--------------------------------------------------------------------------------
/boson_sdk/flirChannels.c:
--------------------------------------------------------------------------------
1 | #include "flirChannels.h"
2 |
3 | static uint8_t is_initialized = 0;
4 |
5 | int16_t get_channel(uint8_t channel_ID, CHANNEL_T **return_channel){
6 | uint16_t i;
7 | for (i=1;istart);
24 | if (channel_ptr->len != CHANNEL_BUF_SIZ){
25 | index = start + (channel_ptr->len);
26 | (channel_ptr->buff)[index] = inbyte;
27 | (channel_ptr->len)++;
28 | } else {
29 | (channel_ptr->buff)[start] = inbyte;
30 | (channel_ptr->start) = (start + 1)%CHANNEL_BUF_SIZ;
31 | }
32 | }
33 |
34 | int32_t get_byte(uint8_t *outbyte,CHANNEL_T *channel_ptr){
35 | //return remaining length if success, -1 if channel already empty
36 | if (channel_ptr->len == 0) {
37 | return -1;
38 | } else {
39 | *outbyte = (channel_ptr->buff)[(channel_ptr->start)];
40 | (channel_ptr->start)++;
41 | return --(channel_ptr->len);
42 | }
43 | }
44 |
45 | void initialize_channels(){
46 | if (is_initialized==0) {
47 | chan_ptr = &(channel_list[0]);
48 | chan_ptr->channel = 0x00; // unframed "channel" always slot 0
49 | chan_ptr->len = 0;
50 | chan_ptr->start = 0;
51 | chan_ptr = &(channel_list[1]);
52 | chan_ptr->channel = 0x00; // command channel
53 | chan_ptr->len = 0;
54 | chan_ptr->start = 0;
55 | chan_ptr = &(channel_list[2]);
56 | chan_ptr->channel = 0x99; // "0x99" debug channel
57 | chan_ptr->len = 0;
58 | chan_ptr->start = 0;
59 | chan_ptr = &(channel_list[3]);
60 | chan_ptr->channel = 0x63; // "99" alt debug channel
61 | chan_ptr->len = 0;
62 | chan_ptr->start = 0;
63 |
64 | is_initialized = 1;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/boson_sdk/flirChannels.h:
--------------------------------------------------------------------------------
1 | #ifndef FLIR_CHANNELS_H
2 | #define FLIR_CHANNELS_H
3 |
4 | #include
5 | #define CHANNEL_BUF_SIZ 32000
6 |
7 | struct t_CHANNEL_T {
8 | uint8_t channel;
9 | uint16_t start;
10 | uint16_t len;
11 | uint8_t buff[CHANNEL_BUF_SIZ];
12 | };
13 | typedef struct t_CHANNEL_T CHANNEL_T;
14 |
15 | #define NUM_CHANNELS 4
16 |
17 | static CHANNEL_T *chan_ptr;
18 | static CHANNEL_T *unframed_ptr;
19 | static CHANNEL_T channel_list[NUM_CHANNELS];
20 |
21 | extern void initialize_channels();
22 | extern int16_t get_channel(uint8_t channel_ID, CHANNEL_T **return_channel);
23 | extern void get_unframed(CHANNEL_T **return_channel);
24 | extern void add_byte(uint8_t inbyte,CHANNEL_T *channel_ptr);
25 | extern int32_t get_byte(uint8_t *outbyte,CHANNEL_T *channel_ptr);
26 |
27 | /* Maybe later if number of channels becomes large.
28 | int16_t channel_nums[256] = {
29 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x00->0x09
30 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x0A->0x13
31 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x14->0x1D
32 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x1E->0x27
33 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x28->0x31
34 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x32->0x3B
35 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x3C->0x45
36 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x46->0x4F
37 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x50->0x59
38 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x5A->0x63
39 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x64->0x6D
40 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x6E->0x77
41 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x78->0x81
42 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x82->0x8B
43 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x8C->0x95
44 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0x96->0x9F
45 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0xA0->0xA9
46 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0xAA->0xB3
47 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0xB4->0xBD
48 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0xBE->0xC7
49 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0xC8->0xD1
50 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0xD2->0xDB
51 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0xDC->0xE5
52 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0xE6->0xEF
53 | -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //0xF0->0xF9
54 | -1,-1,-1,-1,-1,-1, //0xFA->0xFF
55 | }
56 | */
57 |
58 |
59 | #endif //FLIR_CHANNELS_H
--------------------------------------------------------------------------------
/common.pri:
--------------------------------------------------------------------------------
1 | # -------------------------------------------------
2 | # QGroundControl - Micro Air Vehicle Groundstation
3 | # Please see our website at
4 | # Maintainer:
5 | # Lorenz Meier
6 | # (c) 2009-2014 QGroundControl Developers
7 | # License terms set in COPYING.md
8 | # -------------------------------------------------
9 |
10 | #
11 | # This file contains configuration settings which are common to both the QGC Application and
12 | # the Location Plugin. It should mainly contains initial CONFIG tag setup and compiler settings.
13 | #
14 |
15 | # Setup our supported build types. We do this once here and then use the defined config scopes
16 | # to allow us to easily modify suported build types in one place instead of duplicated throughout
17 | # the project file.
18 |
19 | linux {
20 | linux-g++ | linux-g++-64 | linux-g++-32 | linux-clang {
21 | message("Linux build")
22 | CONFIG += LinuxBuild
23 | DEFINES += __STDC_LIMIT_MACROS
24 | linux-clang {
25 | message("Linux clang")
26 | QMAKE_CXXFLAGS += -Qunused-arguments -fcolor-diagnostics
27 | }
28 | } else : linux-rasp-pi2-g++ {
29 | message("Linux R-Pi2 build")
30 | CONFIG += LinuxBuild
31 | DEFINES += __STDC_LIMIT_MACROS __rasp_pi2__
32 | } else : android-g++ {
33 | CONFIG += AndroidBuild MobileBuild
34 | DEFINES += __android__
35 | DEFINES += __STDC_LIMIT_MACROS
36 | DEFINES += QGC_ENABLE_BLUETOOTH
37 | target.path = $$DESTDIR
38 | equals(ANDROID_TARGET_ARCH, x86) {
39 | CONFIG += Androidx86Build
40 | DEFINES += __androidx86__
41 | message("Android x86 build")
42 | } else {
43 | message("Android Arm build")
44 | }
45 | } else {
46 | error("Unsuported Linux toolchain, only GCC 32- or 64-bit is supported")
47 | }
48 | } else : win32 {
49 | win32-msvc2010 | win32-msvc2012 | win32-msvc2013 {
50 | message("Windows build")
51 | CONFIG += WindowsBuild
52 | DEFINES += __STDC_LIMIT_MACROS
53 | } else {
54 | error("Unsupported Windows toolchain, only Visual Studio 2010, 2012, and 2013 are supported")
55 | }
56 | } else : macx {
57 | macx-clang | macx-llvm {
58 | message("Mac build")
59 | CONFIG += MacBuild
60 | DEFINES += __macos__
61 | CONFIG += x86_64
62 | CONFIG -= x86
63 | equals(QT_MAJOR_VERSION, 5) | greaterThan(QT_MINOR_VERSION, 5) {
64 | QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
65 | } else {
66 | QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
67 | }
68 | #-- Not forcing anything. Let qmake find the latest, installed SDK.
69 | #QMAKE_MAC_SDK = macosx10.12
70 | QMAKE_CXXFLAGS += -fvisibility=hidden
71 | } else {
72 | error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
73 | }
74 | } else : ios {
75 | !equals(QT_MAJOR_VERSION, 5) | !greaterThan(QT_MINOR_VERSION, 4) {
76 | error("Unsupported Qt version, 5.5.x or greater is required for iOS")
77 | }
78 | message("iOS build")
79 | CONFIG += iOSBuild MobileBuild app_bundle NoSerialBuild
80 | DEFINES += __ios__
81 | DEFINES += QGC_NO_GOOGLE_MAPS
82 | DEFINES += NO_SERIAL_LINK
83 | QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
84 | QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2 # Universal
85 | QMAKE_LFLAGS += -Wl,-no_pie
86 | } else {
87 | error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported")
88 | }
89 |
90 | # Enable ccache where we can
91 | linux|macx|ios {
92 | system(which ccache) {
93 | message("Found ccache, enabling")
94 | !ios {
95 | QMAKE_CXX = ccache $$QMAKE_CXX
96 | QMAKE_CC = ccache $$QMAKE_CC
97 | } else {
98 | QMAKE_CXX = $$PWD/tools/iosccachecc.sh
99 | QMAKE_CC = $$PWD/tools/iosccachecxx.sh
100 | }
101 | }
102 | }
103 |
104 | MobileBuild {
105 | DEFINES += __mobile__
106 | }
107 |
108 | # set the QGC version from git
109 |
110 | exists ($$PWD/.git) {
111 | GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
112 | GIT_BRANCH = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --abbrev-ref HEAD)
113 | GIT_HASH = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --short HEAD)
114 | GIT_TIME = $$system(git --git-dir $$PWD/.git --work-tree $$PWD show --oneline --format=\"%ci\" -s HEAD)
115 |
116 | # determine if we're on a tag matching vX.Y.Z (stable release)
117 | contains(GIT_DESCRIBE, v[0-9].[0-9].[0-9]) {
118 | # release version "vX.Y.Z"
119 | GIT_VERSION = $${GIT_DESCRIBE}
120 | } else {
121 | # development version "Development branch:sha date"
122 | GIT_VERSION = "Development $${GIT_BRANCH}:$${GIT_HASH} $${GIT_TIME}"
123 | }
124 |
125 | VERSION = $$replace(GIT_DESCRIBE, "v", "")
126 | VERSION = $$replace(VERSION, "-", ".")
127 | VERSION = $$section(VERSION, ".", 0, 3)
128 | MacBuild {
129 | MAC_VERSION = $$section(VERSION, ".", 0, 2)
130 | MAC_BUILD = $$section(VERSION, ".", 3, 3)
131 | message(GetThermal version $${MAC_VERSION} build $${MAC_BUILD} describe $${GIT_VERSION})
132 | } else {
133 | message(GetThermal $${GIT_VERSION})
134 | }
135 | } else {
136 | GIT_VERSION = None
137 | VERSION = 0.0.0 # Marker to indicate out-of-tree build
138 | MAC_VERSION = 0.0.0
139 | MAC_BUILD = 0
140 | }
141 |
142 | DEFINES += GIT_VERSION=\"\\\"$$GIT_VERSION\\\"\"
143 |
144 | # Installer configuration
145 |
146 | installer {
147 | CONFIG -= debug
148 | CONFIG -= debug_and_release
149 | CONFIG += release
150 | message(Build Installer)
151 | }
152 |
153 | # Setup our supported build flavors
154 |
155 | CONFIG(debug, debug|release) {
156 | message(Debug flavor)
157 | CONFIG += DebugBuild
158 | } else:CONFIG(release, debug|release) {
159 | message(Release flavor)
160 | CONFIG += ReleaseBuild
161 | } else {
162 | error(Unsupported build flavor)
163 | }
164 |
165 | # Setup our build directories
166 |
167 | BASEDIR = $$IN_PWD
168 |
169 | !iOSBuild {
170 | OBJECTS_DIR = $${OUT_PWD}/obj
171 | MOC_DIR = $${OUT_PWD}/moc
172 | UI_DIR = $${OUT_PWD}/ui
173 | RCC_DIR = $${OUT_PWD}/rcc
174 | }
175 |
176 | LANGUAGE = C++
177 |
178 | # Turn off serial port warnings
179 | DEFINES += _TTY_NOWARN_
180 |
181 | #
182 | # By default warnings as errors are turned off. Even so, in order for a pull request
183 | # to be accepted you must compile cleanly with warnings as errors turned on the default
184 | # set of OS builds. See http://www.qgroundcontrol.org/dev/contribute for more details.
185 | # You can use the WarningsAsErrorsOn CONFIG switch to turn warnings as errors on for your
186 | # own builds.
187 | #
188 |
189 | MacBuild | LinuxBuild {
190 | QMAKE_CXXFLAGS_WARN_ON += -Wall
191 | WarningsAsErrorsOn {
192 | QMAKE_CXXFLAGS_WARN_ON += -Werror
193 | }
194 | MacBuild {
195 | # Latest clang version has a buggy check for this which cause Qt headers to throw warnings on qmap.h
196 | QMAKE_CXXFLAGS_WARN_ON += -Wno-return-stack-address
197 | }
198 | }
199 |
200 | WindowsBuild {
201 | QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
202 | QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
203 | QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
204 | QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
205 | QMAKE_CXXFLAGS_WARN_ON += /W3 \
206 | /wd4996 \ # silence warnings about deprecated strcpy and whatnot
207 | /wd4005 \ # silence warnings about macro redefinition
208 | /wd4290 # ignore exception specifications
209 |
210 | WarningsAsErrorsOn {
211 | QMAKE_CXXFLAGS_WARN_ON += /WX
212 | }
213 | }
214 |
215 | #
216 | # Build-specific settings
217 | #
218 |
219 | ReleaseBuild {
220 | DEFINES += QT_NO_DEBUG
221 | CONFIG += force_debug_info # Enable debugging symbols on release builds
222 | !iOSBuild {
223 | CONFIG += ltcg # Turn on link time code generation
224 | }
225 |
226 | WindowsBuild {
227 | # Enable function level linking and enhanced optimized debugging
228 | QMAKE_CFLAGS_RELEASE += /Gy /Zo
229 | QMAKE_CXXFLAGS_RELEASE += /Gy /Zo
230 | QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += /Gy /Zo
231 | QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += /Gy /Zo
232 |
233 | # Eliminate duplicate COMDATs
234 | QMAKE_LFLAGS_RELEASE += /OPT:ICF
235 | QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += /OPT:ICF
236 | }
237 | }
238 |
--------------------------------------------------------------------------------
/deploy/create_linux_appimage.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -x
2 |
3 | set +e
4 |
5 | if [[ $# -eq 0 ]]; then
6 | echo 'create_linux_appimage.sh GT_SRC_DIR GT_RELEASE_DIR'
7 | exit 1
8 | fi
9 |
10 | GT_SRC=$1
11 | if [ ! -f ${GT_SRC}/GetThermal.pro ]; then
12 | echo 'please specify path to GetThermal source as the 1st argument'
13 | exit 1
14 | fi
15 |
16 | GT_RELEASE_DIR=$2
17 | if [ ! -f ${GT_RELEASE_DIR}/GetThermal ]; then
18 | echo 'please specify path to GetThermal release as the 2nd argument'
19 | exit 1
20 | fi
21 |
22 | OUTPUT_DIR=${3-`pwd`}
23 | echo "Output directory:" ${OUTPUT_DIR}
24 |
25 | # Generate AppImage using the binaries currently provided by the project.
26 | # These require at least GLIBC 2.14, which older distributions might not have.
27 | # On the other hand, 2.14 is not that recent so maybe we can just live with it.
28 |
29 | APP=GetThermal
30 |
31 | TMPDIR=`mktemp -d`
32 | APPDIR=${TMPDIR}/$APP".AppDir"
33 | mkdir -p ${APPDIR}
34 |
35 | #cd ${TMPDIR}
36 | #wget -c --quiet http://ftp.us.debian.org/debian/pool/main/u/udev/udev_175-7.2_amd64.deb
37 |
38 | cd ${APPDIR}
39 | find ../ -name *.deb -exec dpkg -x {} . \;
40 |
41 | # copy libdirectfb-1.2.so.9
42 | #cd ${TMPDIR}
43 | #wget -c --quiet http://ftp.us.debian.org/debian/pool/main/d/directfb/libdirectfb-1.2-9_1.2.10.0-5.1_amd64.deb
44 | #mkdir libdirectfb
45 | #dpkg -x libdirectfb-1.2-9_1.2.10.0-5.1_amd64.deb libdirectfb
46 | #cp -L libdirectfb/usr/lib/x86_64-linux-gnu/libdirectfb-1.2.so.9 ${APPDIR}/usr/lib/x86_64-linux-gnu/
47 | #cp -L libdirectfb/usr/lib/x86_64-linux-gnu/libfusion-1.2.so.9 ${APPDIR}/usr/lib/x86_64-linux-gnu/
48 | #cp -L libdirectfb/usr/lib/x86_64-linux-gnu/libdirect-1.2.so.9 ${APPDIR}/usr/lib/x86_64-linux-gnu/
49 | #
50 | ## copy libts-0.0-0
51 | #wget -c --quiet http://ftp.us.debian.org/debian/pool/main/t/tslib/libts-0.0-0_1.0-11_amd64.deb
52 | #mkdir libts
53 | #dpkg -x libts-0.0-0_1.0-11_amd64.deb libts
54 | #cp -L libts/usr/lib/x86_64-linux-gnu/libts-0.0.so.0 ${APPDIR}/usr/lib/x86_64-linux-gnu/
55 |
56 | # copy GetThermal release into appimage
57 | cp -r ${GT_RELEASE_DIR}/* ${APPDIR}/
58 | rm -rf ${APPDIR}/package
59 | mv ${APPDIR}/getthermal-start.sh ${APPDIR}/AppRun
60 |
61 | # copy icon
62 | cp ${GT_SRC}/icons/getthermal.png ${APPDIR}/
63 |
64 | # copy desktop file
65 | cp ${GT_SRC}/deploy/getthermal.desktop ${APPDIR}/
66 |
67 | #cat > ./getthermal.desktop <<\EOF
68 | #[Desktop Entry]
69 | #Type=Application
70 | #Name=GetThermal
71 | #GenericName=GetThermal
72 | #Comment=Cross-platform USB thermal camera viewer
73 | #Icon=getthermal
74 | #Exec=GetThermal
75 | #Terminal=false
76 | #Categories=Utility;
77 | #Keywords=computer;
78 | #EOF
79 |
80 | #VERSION=$(strings ${APPDIR}/GetThermal | grep '^v[0-9*]\.[0-9*].[0-9*]' | head -n 1)
81 | pushd $GT_SRC
82 | VERSION=$(git describe --always --tags)
83 | popd
84 | echo GT Version: ${VERSION}
85 |
86 | # Go out of AppImage
87 | cd ${TMPDIR}
88 |
89 | wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
90 | chmod a+x linuxdeployqt*.AppImage
91 |
92 | ./linuxdeployqt*.AppImage ./$APP.AppDir/*.desktop -bundle-non-qt-libs
93 | ./linuxdeployqt*.AppImage ./$APP.AppDir/*.desktop -qmldir=${GT_SRC}/qml -appimage
94 |
95 | cp ${TMPDIR}/${APP}*".AppImage" ${OUTPUT_DIR}/
96 |
--------------------------------------------------------------------------------
/deploy/getthermal-start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | HERE="$(dirname "$(readlink -f "${0}")")"
3 | export LD_LIBRARY_PATH="${HERE}/usr/lib/x86_64-linux-gnu":"${HERE}/Qt/libs":$LD_LIBRARY_PATH
4 | export QML2_IMPORT_PATH="${HERE}/Qt/qml"
5 | export QT_PLUGIN_PATH="${HERE}/Qt/plugins"
6 |
7 | # hack until icon issue with AppImage is resolved
8 | mkdir -p ~/.icons && cp ${HERE}/getthermal.png ~/.icons
9 |
10 | "${HERE}/GetThermal" "$@"
11 |
--------------------------------------------------------------------------------
/deploy/getthermal.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=GetThermal
4 | GenericName=GetThermal
5 | Comment=Cross-platform Thermal Camera Viewer
6 | Icon=getthermal
7 | Exec=GetThermal
8 | Terminal=false
9 | Categories=Utility;
10 |
--------------------------------------------------------------------------------
/deployment.pri:
--------------------------------------------------------------------------------
1 | unix:!android {
2 | isEmpty(target.path) {
3 | qnx {
4 | target.path = /tmp/$${TARGET}/bin
5 | } else {
6 | target.path = /opt/$${TARGET}/bin
7 | }
8 | export(target.path)
9 | }
10 | INSTALLS += target
11 | }
12 |
13 | export(INSTALLS)
14 |
--------------------------------------------------------------------------------
/icons/getthermal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samyk/GetThermal/48453e6af6d3d16ec67a3a44c09bd83b020506ca/icons/getthermal.png
--------------------------------------------------------------------------------
/icons/macos.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samyk/GetThermal/48453e6af6d3d16ec67a3a44c09bd83b020506ca/icons/macos.icns
--------------------------------------------------------------------------------
/inc/abstractccinterface.h:
--------------------------------------------------------------------------------
1 | #ifndef ABSTRACTCCINTERFACE_H
2 | #define ABSTRACTCCINTERFACE_H
3 |
4 | #include
5 | #include
6 |
7 | class AbstractCCInterface : public QObject
8 | {
9 | Q_OBJECT
10 | public:
11 | AbstractCCInterface(QObject *parent = 0);
12 | AbstractCCInterface(const AbstractCCInterface &intf);
13 | virtual ~AbstractCCInterface() { }
14 |
15 | virtual const AbstractCCInterface &operator =(const AbstractCCInterface &format) = 0;
16 |
17 | Q_PROPERTY(const QVideoSurfaceFormat defaultFormat READ getDefaultFormat)
18 | virtual const QVideoSurfaceFormat getDefaultFormat() = 0;
19 |
20 | public slots:
21 | virtual void performFfc() = 0;
22 | };
23 |
24 | #endif // ABSTRACTCCINTERFACE_H
25 |
--------------------------------------------------------------------------------
/inc/bosonvariation.h:
--------------------------------------------------------------------------------
1 | #ifndef BOSONVARIATION_H
2 | #define BOSONVARIATION_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "abstractccinterface.h"
9 | #include "bosonvariation_types.h"
10 |
11 | extern "C" {
12 | #include "boson_sdk/Client_API.h"
13 | }
14 |
15 | #include
16 | using namespace std;
17 | using namespace std::placeholders;
18 | using namespace FLR;
19 |
20 | #define BOSON_SIMPLE_PROPERTY(type, sdk_type, name, sdk_get, sdk_set) \
21 | Q_PROPERTY(type name \
22 | READ (bind_get(sdk_get)) \
23 | WRITE (bind_set(sdk_set, (bind(&BosonVariation::name##Changed, _t, _1)))) \
24 | NOTIFY name##Changed)
25 |
26 | #define BOSON_ENUM_PROPERTY(type, name, sdk_get, sdk_set) \
27 | BOSON_SIMPLE_PROPERTY(type, FLR_##type, name, sdk_get, sdk_set)
28 |
29 | #define BOSON_UINT16_PROPERTY(name, sdk_get, sdk_set) \
30 | BOSON_SIMPLE_PROPERTY(unsigned int, uint16_t, name, sdk_get, sdk_set)
31 |
32 | class BosonVariation : public AbstractCCInterface
33 | {
34 | Q_OBJECT
35 | public:
36 | BosonVariation(uvc_context_t *ctx,
37 | uvc_device_t *dev,
38 | uvc_device_handle_t *devh);
39 |
40 | virtual ~BosonVariation();
41 |
42 | virtual const AbstractCCInterface& operator =(const AbstractCCInterface&);
43 |
44 | BOSON_ENUM_PROPERTY(COLORLUT_ID_E, colorLutId, colorLutGetId, colorLutSetId)
45 |
46 | Q_PROPERTY(const QString cameraSerialNumber READ getCameraSerialNumber)
47 | const QString getCameraSerialNumber();
48 |
49 | Q_PROPERTY(const QString cameraPartNumber READ getCameraPartNumber)
50 | const QString getCameraPartNumber();
51 |
52 | Q_PROPERTY(const QString sensorSerialNumber READ getSensorSerialNumber)
53 | const QString getSensorSerialNumber();
54 |
55 | Q_PROPERTY(const QString sensorPartNumber READ getSensorPartNumber)
56 | const QString getSensorPartNumber();
57 |
58 | Q_PROPERTY(const QString softwareRev READ getSoftwareRev)
59 | const QString getSoftwareRev();
60 |
61 | Q_PROPERTY(float cameraInternalTempC READ getCameraInternalTempC NOTIFY cameraInternalTempChanged)
62 | float getCameraInternalTempC();
63 |
64 | Q_PROPERTY(bool supportsHwPseudoColor READ getSupportsHwPseudoColor)
65 | bool getSupportsHwPseudoColor() const;
66 |
67 | Q_PROPERTY(bool supportsRadiometry READ getSupportsRadiometry)
68 | bool getSupportsRadiometry();
69 |
70 | Q_PROPERTY(const QVideoSurfaceFormat defaultFormat READ getDefaultFormat)
71 | virtual const QVideoSurfaceFormat getDefaultFormat();
72 |
73 | signals:
74 | void cameraInternalTempChanged(float temp);
75 |
76 | void colorLutIdChanged(COLORLUT_ID_E val);
77 |
78 | public slots:
79 | virtual void performFfc();
80 |
81 | private:
82 |
83 | template
84 | function bind_get(function F)
85 | {
86 | return bind(&BosonVariation::pget, this, F);
87 | }
88 |
89 | template
90 | function bind_set(function F,
91 | function E)
92 | {
93 | return bind(&BosonVariation::pset, this, F, E, _1);
94 | }
95 |
96 | template
97 | W pget(function F)
98 | {
99 | T var;
100 | F(&var);
101 | return (W)var;
102 | }
103 |
104 | template
105 | void pset(function F, function E, W var)
106 | {
107 | F((T)var);
108 | emit E(var);
109 | }
110 |
111 | uvc_context_t *ctx;
112 | uvc_device_t *dev;
113 | uvc_device_handle_t *devh;
114 | libusb_device_handle *usb_devh;
115 | uvc_device_descriptor_t *desc;
116 | };
117 |
118 | Q_DECLARE_METATYPE(COLORLUT_ID_E)
119 |
120 | #endif // BOSONVARIATION_H
121 |
--------------------------------------------------------------------------------
/inc/bosonvariation_types.h:
--------------------------------------------------------------------------------
1 | #ifndef BOSONVARIATION_TYPES_H
2 | #define BOSONVARIATION_TYPES_H
3 |
4 | #include
5 | #include
6 |
7 | extern "C" {
8 | #include "boson_sdk/ReturnCodes.h"
9 | #include "boson_sdk/EnumTypes.h"
10 | }
11 |
12 | #define QML_ENUM(name, storageType, ...)\
13 | enum class name : storageType {\
14 | __VA_ARGS__\
15 | };\
16 | class QE_##name {\
17 | Q_GADGET\
18 | Q_ENUMS(E)\
19 | public:\
20 | enum class E : storageType {\
21 | __VA_ARGS__\
22 | };\
23 | };
24 |
25 | namespace FLR {
26 |
27 | QML_ENUM(COLORLUT_ID_E, int32_t, \
28 | FLR_COLORLUT_WHITEHOT, \
29 | FLR_COLORLUT_BLACKHOT, \
30 | FLR_COLORLUT_REDHOT, \
31 | FLR_COLORLUT_RAINBOW, \
32 | FLR_COLORLUT_IRONBOW, \
33 | FLR_COLORLUT_LAVA, \
34 | FLR_COLORLUT_ARCTIC, \
35 | FLR_COLORLUT_GLOBOW, \
36 | FLR_COLORLUT_GRADEDFIRE, \
37 | FLR_COLORLUT_INSTALERT, \
38 | )
39 |
40 | }
41 | void registerBosonVariationQmlTypes();
42 |
43 | #endif // BOSONVARIATION_TYPES_H
44 |
--------------------------------------------------------------------------------
/inc/dataformatter.h:
--------------------------------------------------------------------------------
1 | #ifndef DATAFORMATTER_H
2 | #define DATAFORMATTER_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | typedef struct { const uint8_t colormap[256 * 3]; } colormap_t;
9 |
10 | class DataFormatter : public QObject
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 |
16 | DataFormatter();
17 |
18 | enum Palette {
19 | IronBlack,
20 | Rainbow,
21 | Grayscale,
22 | };
23 | Q_ENUMS(Palette)
24 | Q_PROPERTY(Palette pseudocolorPalette MEMBER m_pseudocolor_palette NOTIFY psuedocolorPaletteChanged)
25 |
26 | void FindMinMax(const uvc_frame_t *input, QPoint &minPoint, uint16_t &minVal, QPoint &maxPoint, uint16_t &maxVal) const;
27 | void AutoGain(uvc_frame_t *input_output);
28 | void FixedGain(uvc_frame_t *input_output, QPoint minpoint, ushort minval, QPoint maxpoint, ushort maxval);
29 | void Colorize(const uvc_frame_t *input, QVideoFrame &output) const;
30 |
31 | static const colormap_t* getPalette(Palette palette);
32 |
33 | Q_PROPERTY(ushort minVal READ getMinVal NOTIFY minValChanged)
34 | ushort getMinVal() const { return m_minVal; }
35 |
36 | Q_PROPERTY(ushort maxVal READ getMaxVal NOTIFY maxValChanged)
37 | ushort getMaxVal() const { return m_maxVal; }
38 |
39 | Q_PROPERTY(QPoint minPoint READ getMinPoint NOTIFY minPointChanged)
40 | QPoint getMinPoint() const { return m_minPoint; }
41 |
42 | Q_PROPERTY(QPoint maxPoint READ getMaxPoint NOTIFY maxPointChanged)
43 | QPoint getMaxPoint() const { return m_maxPoint; }
44 |
45 | signals:
46 |
47 | void psuedocolorPaletteChanged(Palette val);
48 | void minValChanged(ushort val);
49 | void maxValChanged(ushort val);
50 | void minPointChanged(QPoint point);
51 | void maxPointChanged(QPoint point);
52 |
53 | private:
54 |
55 | Palette m_pseudocolor_palette;
56 | ushort m_minVal, m_maxVal;
57 | QPoint m_minPoint, m_maxPoint;
58 | };
59 |
60 | #endif // DATAFORMATTER_H
61 |
--------------------------------------------------------------------------------
/inc/leptonvariation.h:
--------------------------------------------------------------------------------
1 | #ifndef LEPTONVARIATION_H
2 | #define LEPTONVARIATION_H
3 |
4 | #include
5 | #include
6 | #include "LEPTON_Types.h"
7 | #include "LEPTON_ErrorCodes.h"
8 | #include "LEPTON_AGC.h"
9 | #include "LEPTON_OEM.h"
10 | #include "LEPTON_RAD.h"
11 | #include "LEPTON_SYS.h"
12 | #include "LEPTON_VID.h"
13 |
14 | #include
15 |
16 | #include "abstractccinterface.h"
17 | #include "leptonvariation_types.h"
18 |
19 | #include
20 | using namespace std;
21 | using namespace std::placeholders;
22 | using namespace LEP;
23 |
24 | #define SDK_SIMPLE_PROPERTY(type, sdk_type, name, sdk_name) \
25 | Q_PROPERTY(type name \
26 | READ (bind_get(LEP_Get##sdk_name)) \
27 | WRITE (bind_set(LEP_Set##sdk_name, (bind(&LeptonVariation::name##Changed, _t, _1)))) \
28 | NOTIFY name##Changed)
29 |
30 | #define SDK_ENUM_PROPERTY(type, name, sdk_name) \
31 | SDK_SIMPLE_PROPERTY(type, LEP_##type, name, sdk_name)
32 |
33 | #define SDK_UINT16_PROPERTY(name, sdk_name) \
34 | SDK_SIMPLE_PROPERTY(unsigned int, uint16_t, name, sdk_name)
35 |
36 | class LeptonVariation : public AbstractCCInterface
37 | {
38 | Q_OBJECT
39 | public:
40 | LeptonVariation(uvc_context_t *ctx,
41 | uvc_device_t *dev,
42 | uvc_device_handle_t *devh);
43 |
44 | virtual ~LeptonVariation();
45 |
46 | LEP_RESULT UVC_GetAttribute(LEP_COMMAND_ID commandID,
47 | LEP_ATTRIBUTE_T_PTR attributePtr,
48 | LEP_UINT16 attributeWordLength);
49 |
50 | LEP_RESULT UVC_SetAttribute(LEP_COMMAND_ID commandID,
51 | LEP_ATTRIBUTE_T_PTR attributePtr,
52 | LEP_UINT16 attributeWordLength);
53 |
54 | LEP_RESULT UVC_RunCommand(LEP_COMMAND_ID commandID);
55 |
56 | LEP_CAMERA_PORT_DESC_T_PTR GetPortDescription() { return &m_portDesc; }
57 |
58 | virtual const AbstractCCInterface& operator =(const AbstractCCInterface&);
59 |
60 | SDK_ENUM_PROPERTY(AGC_ENABLE_E, agcEnable, AgcEnableState)
61 | SDK_ENUM_PROPERTY(AGC_POLICY_E, agcPolicy, AgcPolicy)
62 | SDK_ENUM_PROPERTY(AGC_HEQ_SCALE_FACTOR_E, agcHeqScaleFactor, AgcHeqScaleFactor)
63 | SDK_ENUM_PROPERTY(AGC_ENABLE_E, agcCalcEnable, AgcCalcEnableState)
64 |
65 | SDK_UINT16_PROPERTY(agcLinearHistogramTailSize, AgcLinearHistogramTailSize)
66 | SDK_UINT16_PROPERTY(agcLinearHistogramClipPercent, AgcLinearHistogramClipPercent)
67 | SDK_UINT16_PROPERTY(agcLinearMaxGain, AgcLinearMaxGain)
68 | SDK_UINT16_PROPERTY(agcLinearMidPoint, AgcLinearMidPoint)
69 | SDK_UINT16_PROPERTY(agcLinearDampeningFactor, AgcLinearDampeningFactor)
70 |
71 | SDK_UINT16_PROPERTY(agcHeqDampingFactor, AgcHeqDampingFactor)
72 | SDK_UINT16_PROPERTY(agcHeqMaxGain, AgcHeqMaxGain)
73 | SDK_UINT16_PROPERTY(agcHeqClipLimitHigh, AgcHeqClipLimitHigh)
74 | SDK_UINT16_PROPERTY(agcHeqClipLimitLow, AgcHeqClipLimitLow)
75 | SDK_UINT16_PROPERTY(agcHeqBinExtension, AgcHeqBinExtension)
76 | SDK_UINT16_PROPERTY(agcHeqMidPoint, AgcHeqMidPoint)
77 | SDK_UINT16_PROPERTY(agcHeqEmptyCount, AgcHeqEmptyCount)
78 | SDK_UINT16_PROPERTY(agcHeqNormalizationFactor, AgcHeqNormalizationFactor)
79 |
80 | Q_PROPERTY(const QString sysFlirSerialNumber READ getSysFlirSerialNumber)
81 | const QString getSysFlirSerialNumber();
82 |
83 | Q_PROPERTY(const QString oemFlirPartNumber READ getOemFlirPartNumber)
84 | const QString getOemFlirPartNumber();
85 |
86 | Q_PROPERTY(const QString oemGppSoftwareVersion READ getOemGppSoftwareVersion)
87 | const QString getOemGppSoftwareVersion();
88 |
89 | Q_PROPERTY(const QString oemDspSoftwareVersion READ getOemDspSoftwareVersion)
90 | const QString getOemDspSoftwareVersion();
91 |
92 | SDK_ENUM_PROPERTY(PCOLOR_LUT_E, vidPcolorLut, VidPcolorLut)
93 | SDK_ENUM_PROPERTY(POLARITY_E, vidPolarity, VidPolarity)
94 | SDK_ENUM_PROPERTY(VID_SBNUC_ENABLE_E, vidSbNucEnableState, VidSbNucEnableState)
95 |
96 | Q_PROPERTY(unsigned int radSpotmeterInKelvinX100 READ getRadSpotmeterObjInKelvinX100 NOTIFY radSpotmeterInKelvinX100Changed)
97 | unsigned int getRadSpotmeterObjInKelvinX100();
98 |
99 | Q_PROPERTY(const QRect& radSpotmeterRoi READ getRadSpotmeterRoi WRITE setRadSpotmeterRoi NOTIFY radSpotmeterRoiChanged)
100 | const QRect getRadSpotmeterRoi() {
101 | return QRect(m_spotmeterRoi.startCol, m_spotmeterRoi.startRow,
102 | m_spotmeterRoi.endCol - m_spotmeterRoi.startCol,
103 | m_spotmeterRoi.endRow - m_spotmeterRoi.startRow);
104 | }
105 | void setRadSpotmeterRoi(const QRect& roi);
106 |
107 | SDK_ENUM_PROPERTY(RAD_TLINEAR_RESOLUTION_E, radTLinearResolution, RadTLinearResolution)
108 |
109 | SDK_ENUM_PROPERTY(SYS_GAIN_MODE_E, sysGainMode, SysGainMode)
110 |
111 | /* board-specific properties */
112 |
113 | Q_PROPERTY(const QString ptFirmwareVersion READ getPtFirmwareVersion)
114 | const QString getPtFirmwareVersion() const;
115 |
116 | Q_PROPERTY(bool supportsHwPseudoColor READ getSupportsHwPseudoColor)
117 | bool getSupportsHwPseudoColor() const;
118 |
119 | Q_PROPERTY(bool supportsRadiometry READ getSupportsRadiometry)
120 | bool getSupportsRadiometry();
121 |
122 | Q_PROPERTY(bool supportsRuntimeAgcChange READ getSupportsRuntimeAgcChange)
123 | bool getSupportsRuntimeAgcChange() const;
124 |
125 | virtual const QVideoSurfaceFormat getDefaultFormat();
126 |
127 | signals:
128 |
129 | void agcEnableChanged(AGC_ENABLE_E val);
130 | void agcPolicyChanged(AGC_POLICY_E val);
131 | void agcHeqScaleFactorChanged(AGC_HEQ_SCALE_FACTOR_E val);
132 | void agcCalcEnableChanged(AGC_ENABLE_E val);
133 |
134 | void agcLinearHistogramTailSizeChanged(uint16_t val);
135 | void agcLinearHistogramClipPercentChanged(uint16_t val);
136 | void agcLinearMaxGainChanged(uint16_t val);
137 | void agcLinearMidPointChanged(uint16_t val);
138 | void agcLinearDampeningFactorChanged(uint16_t val);
139 |
140 | void agcHeqDampingFactorChanged(uint16_t val);
141 | void agcHeqMaxGainChanged(uint16_t val);
142 | void agcHeqClipLimitHighChanged(uint16_t val);
143 | void agcHeqClipLimitLowChanged(uint16_t val);
144 | void agcHeqBinExtensionChanged(uint16_t val);
145 | void agcHeqMidPointChanged(uint16_t val);
146 | void agcHeqEmptyCountChanged(uint16_t val);
147 | void agcHeqNormalizationFactorChanged(uint16_t val);
148 |
149 | void vidPcolorLutChanged(PCOLOR_LUT_E val);
150 | void vidPolarityChanged(POLARITY_E val);
151 | void vidSbNucEnableStateChanged(VID_SBNUC_ENABLE_E val);
152 |
153 | void radTLinearResolutionChanged(RAD_TLINEAR_RESOLUTION_E val);
154 | void radSpotmeterInKelvinX100Changed();
155 | void radSpotmeterRoiChanged();
156 |
157 | void sysGainModeChanged(SYS_GAIN_MODE_E val);
158 |
159 | public slots:
160 | virtual void performFfc();
161 | void updateSpotmeter();
162 |
163 | private:
164 |
165 | template
166 | function bind_get(function F)
167 | {
168 | return bind(&LeptonVariation::pget, this, F);
169 | }
170 |
171 | template
172 | function bind_set(function F,
173 | function E)
174 | {
175 | return bind(&LeptonVariation::pset, this, F, E, _1);
176 | }
177 |
178 | template
179 | W pget(function F)
180 | {
181 | T var;
182 | F(&m_portDesc, &var);
183 | return (W)var;
184 | }
185 |
186 | template
187 | void pset(function F, function E, W var)
188 | {
189 | F(&m_portDesc, (T)var);
190 | emit E(var);
191 | }
192 |
193 | uvc_context_t *ctx;
194 | uvc_device_t *dev;
195 | uvc_device_handle_t *devh;
196 | LEP_CAMERA_PORT_DESC_T m_portDesc;
197 | uvc_device_descriptor_t *desc;
198 | QSize m_sensorSize;
199 | QMutex m_mutex;
200 | LEP_RAD_ROI_T m_spotmeterRoi;
201 |
202 | QTimer *m_periodicTimer;
203 |
204 | uint64_t serialNumber;
205 | LEP_OEM_SW_VERSION_T swVers;
206 | LEP_OEM_PART_NUMBER_T partNumber;
207 |
208 | int leptonCommandIdToUnitId(LEP_COMMAND_ID commandID);
209 | };
210 |
211 | Q_DECLARE_METATYPE(PCOLOR_LUT_E)
212 | Q_DECLARE_METATYPE(POLARITY_E)
213 | Q_DECLARE_METATYPE(VID_SBNUC_ENABLE_E)
214 | Q_DECLARE_METATYPE(AGC_ENABLE_E)
215 | Q_DECLARE_METATYPE(AGC_POLICY_E)
216 | Q_DECLARE_METATYPE(AGC_HEQ_SCALE_FACTOR_E)
217 | Q_DECLARE_METATYPE(RAD_TLINEAR_RESOLUTION_E)
218 | Q_DECLARE_METATYPE(SYS_GAIN_MODE_E)
219 |
220 | #endif // LEPTONVARIATION_H
221 |
--------------------------------------------------------------------------------
/inc/leptonvariation_types.h:
--------------------------------------------------------------------------------
1 | #ifndef LEPTONVARIATION_TYPES_H
2 | #define LEPTONVARIATION_TYPES_H
3 |
4 | #include
5 | #include
6 |
7 | #include "LEPTON_ErrorCodes.h"
8 | #include "LEPTON_AGC.h"
9 | #include "LEPTON_VID.h"
10 | #include "LEPTON_RAD.h"
11 | #include "LEPTON_SYS.h"
12 |
13 | #define QML_ENUM(name, storageType, ...)\
14 | enum class name : storageType {\
15 | __VA_ARGS__\
16 | };\
17 | class QE_##name {\
18 | Q_GADGET\
19 | Q_ENUMS(E)\
20 | public:\
21 | enum class E : storageType {\
22 | __VA_ARGS__\
23 | };\
24 | };
25 |
26 | namespace LEP {
27 |
28 | QML_ENUM(PCOLOR_LUT_E, char, \
29 | LEP_VID_WHEEL6_LUT, \
30 | LEP_VID_FUSION_LUT, \
31 | LEP_VID_RAINBOW_LUT, \
32 | LEP_VID_GLOBOW_LUT, \
33 | LEP_VID_SEPIA_LUT, \
34 | LEP_VID_COLOR_LUT, \
35 | LEP_VID_ICE_FIRE_LUT, \
36 | LEP_VID_RAIN_LUT, \
37 | LEP_VID_USER_LUT \
38 | )
39 |
40 | QML_ENUM(POLARITY_E, char, \
41 | LEP_VID_WHITE_HOT, \
42 | LEP_VID_BLACK_HOT, \
43 | )
44 |
45 | QML_ENUM(VID_SBNUC_ENABLE_E, char, \
46 | LEP_VID_SBNUC_DISABLE, \
47 | LEP_VID_SBNUC_ENABLE, \
48 | )
49 |
50 | QML_ENUM(AGC_ENABLE_E, char, \
51 | LEP_AGC_DISABLE, \
52 | LEP_AGC_ENABLE, \
53 | )
54 |
55 | QML_ENUM(AGC_POLICY_E, char, \
56 | LEP_AGC_LINEAR, \
57 | LEP_AGC_HEQ, \
58 | )
59 |
60 | QML_ENUM(AGC_HEQ_SCALE_FACTOR_E, char, \
61 | LEP_AGC_SCALE_TO_8_BITS, \
62 | LEP_AGC_SCALE_TO_14_BITS, \
63 | )
64 |
65 | QML_ENUM(RAD_TLINEAR_RESOLUTION_E, char, \
66 | LEP_RAD_RESOLUTION_0_1, \
67 | LEP_RAD_RESOLUTION_0_01, \
68 | )
69 |
70 | QML_ENUM(SYS_GAIN_MODE_E, char, \
71 | LEP_SYS_GAIN_MODE_HIGH, \
72 | LEP_SYS_GAIN_MODE_LOW, \
73 | LEP_SYS_GAIN_MODE_AUTO, \
74 | )
75 |
76 | }
77 | void registerLeptonVariationQmlTypes();
78 |
79 | #endif // LEPTONVARIATION_TYPES_H
80 |
--------------------------------------------------------------------------------
/inc/rangeprovider.h:
--------------------------------------------------------------------------------
1 | #ifndef RANGEPROVIDER_H
2 | #define RANGEPROVIDER_H
3 |
4 | #include
5 | #include "dataformatter.h"
6 |
7 | class RangeProvider : public QQuickImageProvider
8 | {
9 | public:
10 | RangeProvider();
11 | QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize);
12 |
13 | private:
14 |
15 | QPixmap m_pixmap;
16 | };
17 |
18 | #endif // RANGEPROVIDER_H
19 |
--------------------------------------------------------------------------------
/inc/uvcacquisition.h:
--------------------------------------------------------------------------------
1 | #ifndef UVCACQUISITION_H
2 | #define UVCACQUISITION_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include
10 | #include
11 |
12 | #include "abstractccinterface.h"
13 | #include "dataformatter.h"
14 |
15 | class UvcAcquisition : public QObject
16 | {
17 | Q_OBJECT
18 |
19 | public:
20 | struct UsbId {
21 | int vid;
22 | int pid;
23 | };
24 |
25 | UvcAcquisition(QObject *parent = 0);
26 | UvcAcquisition(QList ids);
27 | virtual ~UvcAcquisition();
28 |
29 | Q_PROPERTY(const QVideoSurfaceFormat& videoFormat READ videoFormat WRITE setVideoFormat NOTIFY formatChanged)
30 | const QVideoSurfaceFormat& videoFormat() const { return m_format; }
31 |
32 | Q_PROPERTY(AbstractCCInterface* cci MEMBER m_cci NOTIFY cciChanged)
33 |
34 | Q_PROPERTY(DataFormatter* dataFormatter READ getDataFormatter() NOTIFY dataFormatterChanged)
35 | DataFormatter* getDataFormatter() { return &m_df; }
36 |
37 | Q_PROPERTY(const QSize& videoSize READ getVideoSize NOTIFY videoSizeChanged)
38 | const QSize getVideoSize() { return m_format.frameSize(); }
39 |
40 | signals:
41 | void frameReady(const QVideoFrame &frame);
42 | void formatChanged(const QVideoSurfaceFormat &format);
43 | void cciChanged(AbstractCCInterface *format);
44 | void dataFormatterChanged(AbstractCCInterface *format);
45 | void videoSizeChanged(const QSize &size);
46 |
47 | public slots:
48 | void setVideoFormat(const QVideoSurfaceFormat &format);
49 |
50 | void pauseStream();
51 | void resumeStream();
52 |
53 | protected:
54 | uvc_context_t *ctx;
55 | uvc_device_t *dev;
56 | uvc_device_handle_t *devh;
57 | uvc_stream_ctrl_t ctrl;
58 | QVideoSurfaceFormat m_format;
59 | QVideoSurfaceFormat m_uvc_format;
60 | AbstractCCInterface *m_cci;
61 | DataFormatter m_df;
62 |
63 | private:
64 | static void cb(uvc_frame_t *frame, void *ptr);
65 | void emitFrameReady(const QVideoFrame &frame);
66 | void init();
67 | QList _ids;
68 | };
69 |
70 | #endif // UVCACQUISITION_H
71 |
--------------------------------------------------------------------------------
/inc/uvcbuffer.h:
--------------------------------------------------------------------------------
1 | #ifndef UVCBUFFER_H
2 | #define UVCBUFFER_H
3 |
4 | #include
5 | #include
6 |
7 | class UvcBuffer : public QAbstractVideoBuffer
8 | {
9 | public:
10 | UvcBuffer(HandleType type = NoHandle);
11 | virtual ~UvcBuffer();
12 |
13 | virtual uchar* map(MapMode mode, int* numBytes, int* bytesPerLine);
14 | virtual MapMode mapMode() const;
15 | virtual void unmap();
16 |
17 | void setBackendBuffer(uchar* buffer, int frameWidth, int frameHeight, int stride, int numBytes);
18 |
19 | private:
20 | uchar* _backendBuffer;
21 | int _width;
22 | int _height;
23 | int _stride;
24 | int _numBytes;
25 | };
26 |
27 | class UvcPlanarBuffer : public QAbstractPlanarVideoBuffer
28 | {
29 | public:
30 | UvcPlanarBuffer(HandleType type = NoHandle);
31 | virtual ~UvcPlanarBuffer();
32 |
33 | virtual int map(MapMode mode, int *numBytes, int bytesPerLine[4], uchar *data[4]);
34 | virtual MapMode mapMode() const;
35 | virtual void unmap();
36 |
37 | void setBackendBuffer(uchar* buffer, int width[], int height[], int stride[], int planes);
38 |
39 | private:
40 | int _planes;
41 | int _numBytes;
42 | uchar* _backendBuffer[4];
43 | int _width[4];
44 | int _height[4];
45 | int _stride[4];
46 | };
47 |
48 | #endif // UVCBUFFER_H
49 |
--------------------------------------------------------------------------------
/inc/uvcvideoproducer.h:
--------------------------------------------------------------------------------
1 | #ifndef UVCVIDEOPRODUCER_H
2 | #define UVCVIDEOPRODUCER_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "uvcacquisition.h"
8 |
9 | class UvcVideoProducer : public QObject
10 | {
11 | Q_OBJECT
12 | public:
13 | explicit UvcVideoProducer(QObject *parent = 0);
14 |
15 | Q_PROPERTY(QAbstractVideoSurface *videoSurface MEMBER m_surface WRITE setVideoSurface NOTIFY surfaceChanged)
16 | void setVideoSurface(QAbstractVideoSurface *surface);
17 |
18 | Q_PROPERTY(UvcAcquisition *uvc MEMBER m_uvc WRITE setUvc NOTIFY uvcChanged)
19 | void setUvc(UvcAcquisition *uvc);
20 |
21 | signals:
22 | void surfaceChanged(QAbstractVideoSurface *surface);
23 | void uvcChanged(UvcAcquisition *uvc);
24 |
25 | public slots:
26 | void onNewVideoContentReceived(const QVideoFrame &frame);
27 |
28 | private:
29 | QAbstractVideoSurface *m_surface;
30 | UvcAcquisition *m_uvc;
31 | };
32 |
33 | #endif // UVCVIDEOPRODUCER_H
34 |
--------------------------------------------------------------------------------
/installer.pri:
--------------------------------------------------------------------------------
1 | # -------------------------------------------------
2 | # QGroundControl - Micro Air Vehicle Groundstation
3 | # Please see our website at
4 | # Maintainer:
5 | # Lorenz Meier
6 | # (c) 2009-2014 QGroundControl Developers
7 | # License terms set in COPYING.md
8 | # -------------------------------------------------
9 |
10 | installer {
11 | DEFINES += QGC_INSTALL_RELEASE
12 | MacBuild {
13 | # We cd to release directory so we can run macdeployqt without a path to the
14 | # GetThermal.app file. If you specify a path to the .app file the symbolic
15 | # links to plugins will not be created correctly.
16 | QMAKE_POST_LINK += && mkdir -p $${DESTDIR}/package
17 | QMAKE_POST_LINK += && cd $${DESTDIR} && $$dirname(QMAKE_QMAKE)/macdeployqt GetThermal.app -appstore-compliant -verbose=2 -qmldir=$${BASEDIR}/qml
18 | QMAKE_POST_LINK += && cd $${OUT_PWD}
19 | QMAKE_POST_LINK += && hdiutil create -verbose -stretch 3g -layout SPUD -srcfolder $${DESTDIR}/GetThermal.app -volname GetThermal $${DESTDIR}/package/GetThermal.dmg
20 | }
21 | WindowsBuild {
22 | # The pdb moving command are commented out for now since we are including the .pdb in the installer. This makes it much
23 | # easier to debug user crashes.
24 | #QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY $${DESTDIR_WIN}\\getthermal.pdb
25 | #QMAKE_POST_LINK += $$escape_expand(\\n) del $${DESTDIR_WIN}\\getthermal.pdb
26 | QMAKE_POST_LINK += $$escape_expand(\\n) cd $$BASEDIR_WIN && $$quote("\"C:\\Program Files \(x86\)\\NSIS\\makensis.exe\"" /NOCD "\"/XOutFile $${DESTDIR_WIN}\\GetThermal-installer.exe\"" "$$BASEDIR_WIN\\deploy\\getthermal_installer.nsi")
27 | #QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY getthermal.pdb $${DESTDIR_WIN}
28 | #QMAKE_POST_LINK += $$escape_expand(\\n) del getthermal.pdb
29 | OTHER_FILES += deploy/qgroundcontrol_installer.nsi
30 | }
31 | LinuxBuild {
32 | #-- TODO: This uses hardcoded paths. It should use $${DESTDIR}
33 | QMAKE_POST_LINK += && mkdir -p release/package
34 | QMAKE_POST_LINK += && tar -cjf release/package/GetThermal.tar.bz2 release --exclude='package' --transform 's/release/getthermal/'
35 | }
36 | AndroidBuild {
37 | #-- TODO: This uses hardcoded paths. It should use $${DESTDIR}
38 | QMAKE_POST_LINK += && mkdir -p $${DESTDIR}/package
39 | QMAKE_POST_LINK += && make install INSTALL_ROOT=$${DESTDIR}/android-build/
40 | QMAKE_POST_LINK += && androiddeployqt --input android-libGetThermal.so-deployment-settings.json --output $${DESTDIR}/android-build --deployment bundled --gradle --sign $${BASEDIR}/android/android_release.keystore dagar --storepass $$(ANDROID_STOREPASS)
41 | QMAKE_POST_LINK += && cp $${DESTDIR}/android-build/build/outputs/apk/android-build-release-signed.apk $${DESTDIR}/package/GetThermal.apk
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/lepton_sdk/Inc/LEPTON_ErrorCodes.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | *
3 | * FILE: LEPTON_ErrorCodes.h
4 | *
5 | * DESCRIPTION: Contains the Lepton SDK Error Codes
6 | *
7 | * AUTHOR:
8 | *
9 | * CREATED: 3/1/2012
10 | *
11 | * HISTORY: 3/1/2012 DWD Initial Draft
12 | *
13 | ** Copyright 2011,2012,2013,2014 FLIR Systems - Commercial
14 | ** Vision Systems. All rights reserved.
15 | **
16 | ** Proprietary - PROPRIETARY - FLIR Systems Inc..
17 | **
18 | ** This document is controlled to FLIR Technology Level 2.
19 | ** The information contained in this document pertains to a
20 | ** dual use product Controlled for export by the Export
21 | ** Administration Regulations (EAR). Diversion contrary to
22 | ** US law is prohibited. US Department of Commerce
23 | ** authorization is not required prior to export or
24 | ** transfer to foreign persons or parties unless otherwise
25 | ** prohibited.
26 | **
27 | ** Redistribution and use in source and binary forms, with
28 | ** or without modification, are permitted provided that the
29 | ** following conditions are met:
30 | **
31 | ** Redistributions of source code must retain the above
32 | ** copyright notice, this list of conditions and the
33 | ** following disclaimer.
34 | **
35 | ** Redistributions in binary form must reproduce the above
36 | ** copyright notice, this list of conditions and the
37 | ** following disclaimer in the documentation and/or other
38 | ** materials provided with the distribution.
39 | **
40 | ** Neither the name of the FLIR Systems Corporation nor the
41 | ** names of its contributors may be used to endorse or
42 | ** promote products derived from this software without
43 | ** specific prior written permission.
44 | **
45 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
46 | ** CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
47 | ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
48 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
49 | ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
50 | ** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
51 | ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
53 | ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
54 | ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
56 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
57 | ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
58 | ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
59 | ** OF SUCH DAMAGE.
60 | **
61 | *******************************************************************************/
62 | #ifndef _LEPTON_ERROR_CODES_H_
63 | #define _LEPTON_ERROR_CODES_H_
64 |
65 | #ifdef __cplusplus
66 | extern "C"
67 | {
68 | #endif
69 |
70 | /******************************************************************************/
71 | /** INCLUDE FILES **/
72 | /******************************************************************************/
73 |
74 | /******************************************************************************/
75 | /** EXPORTED DEFINES **/
76 | /******************************************************************************/
77 |
78 | /******************************************************************************/
79 | /** EXPORTED TYPE DEFINITIONS **/
80 | /******************************************************************************/
81 |
82 | /******************************************************************************/
83 | /*
84 | * Represents the different result codes the camera can return.
85 | */
86 | typedef enum Result
87 | {
88 | LEP_OK = 0, /* Camera ok */
89 | LEP_COMM_OK = LEP_OK, /* Camera comm ok (same as LEP_OK) */
90 |
91 | LEP_ERROR = -1, /* Camera general error */
92 | LEP_NOT_READY = -2, /* Camera not ready error */
93 | LEP_RANGE_ERROR = -3, /* Camera range error */
94 | LEP_CHECKSUM_ERROR = -4, /* Camera checksum error */
95 | LEP_BAD_ARG_POINTER_ERROR = -5, /* Camera Bad argument error */
96 | LEP_DATA_SIZE_ERROR = -6, /* Camera byte count error */
97 | LEP_UNDEFINED_FUNCTION_ERROR = -7, /* Camera undefined function error */
98 | LEP_FUNCTION_NOT_SUPPORTED = -8, /* Camera function not yet supported error */
99 | LEP_DATA_OUT_OF_RANGE_ERROR = -9, /* Camera input DATA is out of valid range error */
100 | LEP_COMMAND_NOT_ALLOWED = -11, /* Camera unable to execute command due to current camera state */
101 |
102 | /* OTP access errors */
103 | LEP_OTP_WRITE_ERROR = -15, /*!< Camera OTP write error */
104 | LEP_OTP_READ_ERROR = -16, /* double bit error detected (uncorrectible) */
105 |
106 | LEP_OTP_NOT_PROGRAMMED_ERROR = -18, /* Flag read as non-zero */
107 |
108 | /* I2C Errors */
109 | LEP_ERROR_I2C_BUS_NOT_READY = -20, /* I2C Bus Error - Bus Not Avaialble */
110 | LEP_ERROR_I2C_BUFFER_OVERFLOW = -22, /* I2C Bus Error - Buffer Overflow */
111 | LEP_ERROR_I2C_ARBITRATION_LOST = -23, /* I2C Bus Error - Bus Arbitration Lost */
112 | LEP_ERROR_I2C_BUS_ERROR = -24, /* I2C Bus Error - General Bus Error */
113 | LEP_ERROR_I2C_NACK_RECEIVED = -25, /* I2C Bus Error - NACK Received */
114 | LEP_ERROR_I2C_FAIL = -26, /* I2C Bus Error - General Failure */
115 |
116 | /* Processing Errors */
117 | LEP_DIV_ZERO_ERROR = -80, /* Attempted div by zero */
118 |
119 | /* Comm Errors */
120 | LEP_COMM_PORT_NOT_OPEN = -101, /* Comm port not open */
121 | LEP_COMM_INVALID_PORT_ERROR = -102, /* Comm port no such port error */
122 | LEP_COMM_RANGE_ERROR = -103, /* Comm port range error */
123 | LEP_ERROR_CREATING_COMM = -104, /* Error creating comm */
124 | LEP_ERROR_STARTING_COMM = -105, /* Error starting comm */
125 | LEP_ERROR_CLOSING_COMM = -106, /* Error closing comm */
126 | LEP_COMM_CHECKSUM_ERROR = -107, /* Comm checksum error */
127 | LEP_COMM_NO_DEV = -108, /* No comm device */
128 | LEP_TIMEOUT_ERROR = -109, /* Comm timeout error */
129 | LEP_COMM_ERROR_WRITING_COMM = -110, /* Error writing comm */
130 | LEP_COMM_ERROR_READING_COMM = -111, /* Error reading comm */
131 | LEP_COMM_COUNT_ERROR = -112, /* Comm byte count error */
132 |
133 | /* Other Errors */
134 | LEP_OPERATION_CANCELED = -126, /* Camera operation canceled */
135 | LEP_UNDEFINED_ERROR_CODE = -127 /* Undefined error */
136 |
137 | } LEP_RESULT;
138 |
139 | /** EXPORTED PUBLIC DATA **/
140 | /******************************************************************************/
141 |
142 | /******************************************************************************/
143 | /** EXPORTED PUBLIC FUNCTIONS **/
144 | /******************************************************************************/
145 |
146 |
147 | #ifdef __cplusplus
148 | }
149 | #endif
150 |
151 | #endif /* _LEPTON_ERROR_CODES_H_ */
152 |
--------------------------------------------------------------------------------
/lepton_sdk/Inc/LEPTON_Macros.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | **
3 | ** File NAME: LEPTON_Macros.h
4 | **
5 | ** AUTHOR: David Dart
6 | **
7 | ** CREATED: 7/11/2012
8 | **
9 | ** DESCRIPTION:
10 | **
11 | ** HISTORY: 7/11/2012 DWD - Initial Draft
12 | **
13 | ** Copyright 2011,2012,2013,2014 FLIR Systems - Commercial
14 | ** Vision Systems. All rights reserved.
15 | **
16 | ** Proprietary - PROPRIETARY - FLIR Systems Inc..
17 | **
18 | ** This document is controlled to FLIR Technology Level 2.
19 | ** The information contained in this document pertains to a
20 | ** dual use product Controlled for export by the Export
21 | ** Administration Regulations (EAR). Diversion contrary to
22 | ** US law is prohibited. US Department of Commerce
23 | ** authorization is not required prior to export or
24 | ** transfer to foreign persons or parties unless otherwise
25 | ** prohibited.
26 | **
27 | ** Redistribution and use in source and binary forms, with
28 | ** or without modification, are permitted provided that the
29 | ** following conditions are met:
30 | **
31 | ** Redistributions of source code must retain the above
32 | ** copyright notice, this list of conditions and the
33 | ** following disclaimer.
34 | **
35 | ** Redistributions in binary form must reproduce the above
36 | ** copyright notice, this list of conditions and the
37 | ** following disclaimer in the documentation and/or other
38 | ** materials provided with the distribution.
39 | **
40 | ** Neither the name of the FLIR Systems Corporation nor the
41 | ** names of its contributors may be used to endorse or
42 | ** promote products derived from this software without
43 | ** specific prior written permission.
44 | **
45 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
46 | ** CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
47 | ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
48 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
49 | ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
50 | ** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
51 | ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
53 | ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
54 | ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
56 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
57 | ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
58 | ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
59 | ** OF SUCH DAMAGE.
60 | **
61 | *******************************************************************************/
62 | #ifndef _LEP_MACROS_H_
63 | #define _LEP_MACROS_H_
64 |
65 | #ifdef __cplusplus
66 | extern "C"
67 | {
68 | #endif
69 |
70 | /******************************************************************************/
71 | /** INCLUDE FILES **/
72 | /******************************************************************************/
73 |
74 | /******************************************************************************/
75 | /** EXPORTED DEFINES **/
76 | /******************************************************************************/
77 |
78 | /******************************************************************
79 | *** USEFUL MACROS ***
80 | ******************************************************************/
81 |
82 | #ifndef MIN
83 | #define MIN(a, b) ((a) < (b)? (a): (b))
84 | #endif
85 | #ifndef MAX
86 | #define MAX(a, b) ((a) > (b)? (a): (b))
87 | #endif
88 |
89 | #ifndef LOW_WORD
90 | #define LOW_WORD(longVariable) ((LEP_UINT16)longVariable)
91 | #endif
92 | #ifndef HIGH_WORD
93 | #define HIGH_WORD(longVariable) ((LEP_UINT16)(longVariable>>16))
94 | #endif
95 | #ifndef LOW_BYTE
96 | #define LOW_BYTE(w) ((LEP_UINT8)(w))
97 | #endif
98 | #ifndef HIGH_BYTE
99 | #define HIGH_BYTE(w) ((LEP_UINT8)(((w) >> 8) & 0xFF))
100 | #endif
101 |
102 | #ifndef LOW_NIBBLE
103 | #define LOW_NIBBLE(w) ((LEP_UINT8)(w) & 0x0F)
104 | #endif
105 | #ifndef HIGH_NIBBLE
106 | #define HIGH_NIBBLE(w) ((LEP_UINT8)(((w) >> 4) & 0x0F))
107 | #endif
108 |
109 | #define CLR_BIT(_port,_bit) ((_port) & ~(_bit))
110 |
111 |
112 | #define REVERSE_ENDIENESS_UINT16(uint16Var) \
113 | ( ( ((LEP_UINT16)LOW_BYTE(uint16Var))<<8) + (LEP_UINT16)HIGH_BYTE(uint16Var))
114 |
115 | #define REVERSE_ENDIENESS_UINT32(uint32Var) \
116 | ( ((LEP_UINT32)REVERSE_ENDIENESS_UINT16(LOW_WORD(uint32Var)) << 16) + \
117 | (LEP_UINT32)REVERSE_ENDIENESS_UINT16(HIGH_WORD(uint32Var) ) )
118 |
119 | #define REVERSE_NIBBLE_UINT8(uint8Var) \
120 | ( ( ((LEP_UINT8)LOW_NIBBLE(uint8Var))<<4) + (LEP_UINT8)HIGH_NIBBLE(uint8Var))
121 |
122 | #define REVERSE_BYTEORDER_UINT32(uint32Var) \
123 | ( (((LEP_UINT32)LOW_BYTE(uint32Var))<<24) + (((LEP_UINT32)HIGH_BYTE(uint32Var))<<16) + \
124 | (((LEP_UINT32)LOW_BYTE(HIGH_WORD(uint32Var)))<<8) + (LEP_UINT32)HIGH_BYTE(HIGH_WORD(uint32Var)) )
125 |
126 | #define WORD_SWAP_16(uint32Var) \
127 | ( ((LEP_UINT16)LOW_WORD(uint32Var) << 16) + ((LEP_UINT16)HIGH_WORD(uint32Var)) )
128 |
129 |
130 | #ifndef NUM_ELEMENTS_IN_ARRAY
131 | #define NUM_ELEMENTS_IN_ARRAY(array) (sizeof (array) / sizeof ((array) [0]))
132 | #endif /* NUM_ELEMENTS_IN_ARRAY */
133 |
134 | #ifndef NELEMENTS
135 | #define NELEMENTS(array) /* number of elements in an array */ \
136 | (sizeof (array) / sizeof ((array) [0]))
137 | #endif /* NELEMENTS */
138 |
139 |
140 | /******************************************************************************/
141 | /** EXPORTED TYPE DEFINITIONS **/
142 | /******************************************************************************/
143 |
144 | /******************************************************************************/
145 | /** EXPORTED PUBLIC DATA **/
146 | /******************************************************************************/
147 |
148 | /******************************************************************************/
149 | /** EXPORTED PUBLIC FUNCTIONS **/
150 | /******************************************************************************/
151 |
152 |
153 | /******************************************************************************/
154 | #ifdef __cplusplus
155 | }
156 | #endif
157 |
158 | #endif /* _LEP_MACROS_H_ */
159 |
160 |
--------------------------------------------------------------------------------
/lepton_sdk/Inc/LEPTON_SDK.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | *
3 | * FILE: LEPTON_SDK.h
4 | *
5 | * DESCRIPTION:
6 | *
7 | * AUTHOR:
8 | *
9 | * CREATED: 3/1/2012
10 | *
11 | * HISTORY: 3/1/2012 DWD Initial Draft
12 | *
13 | ** Copyright 2011,2012,2013,2014 FLIR Systems - Commercial
14 | ** Vision Systems. All rights reserved.
15 | **
16 | ** Proprietary - PROPRIETARY - FLIR Systems Inc..
17 | **
18 | ** This document is controlled to FLIR Technology Level 2.
19 | ** The information contained in this document pertains to a
20 | ** dual use product Controlled for export by the Export
21 | ** Administration Regulations (EAR). Diversion contrary to
22 | ** US law is prohibited. US Department of Commerce
23 | ** authorization is not required prior to export or
24 | ** transfer to foreign persons or parties unless otherwise
25 | ** prohibited.
26 | **
27 | ** Redistribution and use in source and binary forms, with
28 | ** or without modification, are permitted provided that the
29 | ** following conditions are met:
30 | **
31 | ** Redistributions of source code must retain the above
32 | ** copyright notice, this list of conditions and the
33 | ** following disclaimer.
34 | **
35 | ** Redistributions in binary form must reproduce the above
36 | ** copyright notice, this list of conditions and the
37 | ** following disclaimer in the documentation and/or other
38 | ** materials provided with the distribution.
39 | **
40 | ** Neither the name of the FLIR Systems Corporation nor the
41 | ** names of its contributors may be used to endorse or
42 | ** promote products derived from this software without
43 | ** specific prior written permission.
44 | **
45 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
46 | ** CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
47 | ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
48 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
49 | ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
50 | ** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
51 | ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
53 | ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
54 | ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
56 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
57 | ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
58 | ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
59 | ** OF SUCH DAMAGE.
60 | **
61 | *******************************************************************************/
62 | #ifndef _LEPTON_SDK_H_
63 | #define _LEPTON_SDK_H_
64 |
65 | #ifdef __cplusplus
66 | extern "C"
67 | {
68 | #endif
69 |
70 | /******************************************************************************/
71 | /** INCLUDE FILES **/
72 | /******************************************************************************/
73 | #include "LEPTON_Types.h"
74 | #include "LEPTON_ErrorCodes.h"
75 | #include "LEPTON_SDKConfig.h"
76 |
77 | /******************************************************************************/
78 | /**
79 | * If defined then the CCI and SPI port drivers require opening
80 | * and closing with each access; otherwise the ports are opened
81 | * once and left open for future accesses
82 | */
83 | // #define LEP_USE_DYNAMIC_ALLOCATION
84 |
85 | #define LEP_JOVA_I2C
86 | #define LEP_SDK_VERSION_MAJOR 3
87 | #define LEP_SDK_VERSION_MINOR 3
88 | #define LEP_SDK_VERSION_BUILD 13
89 |
90 | /* SDK Module Command IDs
91 | */
92 | #define LEP_SDK_MODULE_BASE 0x0000
93 |
94 | #define LEP_SDK_ENABLE_STATE (LEP_SDK_MODULE_BASE + 0x0000 )
95 |
96 |
97 | /******************************************************************************/
98 | /** EXPORTED TYPEDEFS **/
99 | /******************************************************************************/
100 | typedef struct LEP_SDK_VERSION_TAG
101 | {
102 | LEP_UINT8 major;
103 | LEP_UINT8 minor;
104 | LEP_UINT8 build;
105 | LEP_UINT8 reserved;
106 |
107 | }LEP_SDK_VERSION_T, *LEP_SDK_VERSION_T_PTR;
108 |
109 | typedef enum LEP_SDK_BOOT_STATUS_E_TAG
110 | {
111 | LEP_BOOT_STATUS_NOT_BOOTED = 0,
112 | LEP_BOOT_STATUS_BOOTED = 1,
113 |
114 | LEP_END_BOOT_STATUS,
115 | }LEP_SDK_BOOT_STATUS_E, *LEP_SDK_BOOT_STATUS_E_PTR;
116 | /******************************************************************************/
117 | /** EXPORTED DEFINES **/
118 | /******************************************************************************/
119 |
120 | /******************************************************************************/
121 | /** EXPORTED PUBLIC DATA **/
122 | /******************************************************************************/
123 | extern LEP_SDK_VERSION_T sdkVersion;
124 | /******************************************************************************/
125 | /** EXPORTED PUBLIC FUNCTIONS **/
126 | /******************************************************************************/
127 |
128 | extern LEP_RESULT LEP_SelectDevice(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
129 | LEP_PROTOCOL_DEVICE_E device);
130 |
131 | extern LEP_RESULT LEP_OpenPort(LEP_UINT16 portID,
132 | LEP_CAMERA_PORT_E portType,
133 | LEP_UINT16 portBaudRate,
134 | LEP_CAMERA_PORT_DESC_T_PTR portDescPtr);
135 |
136 | extern LEP_RESULT LEP_ClosePort(LEP_CAMERA_PORT_DESC_T_PTR pd);
137 |
138 | extern LEP_RESULT LEP_ResetPort(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr);
139 |
140 | extern LEP_RESULT LEP_GetPortStatus(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
141 | LEP_UINT16 *status);
142 |
143 | extern LEP_RESULT LEP_GetDeviceAddress(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
144 | LEP_UINT8* deviceAddress);
145 |
146 | extern LEP_RESULT LEP_GetAttribute(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
147 | LEP_COMMAND_ID commandID,
148 | LEP_ATTRIBUTE_T_PTR attributePtr,
149 | LEP_UINT16 attributeWordLength);
150 |
151 | extern LEP_RESULT LEP_SetAttribute(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
152 | LEP_COMMAND_ID commandID,
153 | LEP_ATTRIBUTE_T_PTR attributePtr,
154 | LEP_UINT16 attributeWordLength);
155 |
156 | extern LEP_RESULT LEP_RunCommand(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
157 | LEP_COMMAND_ID commandID);
158 |
159 | extern LEP_RESULT LEP_DirectWriteBuffer(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
160 | LEP_ATTRIBUTE_T_PTR attributePtr,
161 | LEP_UINT16 attributeWordLength);
162 |
163 | extern LEP_RESULT LEP_DirectWriteRegister(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
164 | LEP_UINT16 registerAddress,
165 | LEP_UINT16 regValue);
166 |
167 | extern LEP_RESULT LEP_DirectReadRegister(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
168 | LEP_UINT16 registerAddress,
169 | LEP_UINT16* regValue);
170 |
171 | extern LEP_RESULT LEP_GetSDKVersion(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
172 | LEP_SDK_VERSION_T_PTR sdkVersionPtr);
173 |
174 | extern LEP_RESULT LEP_GetCameraBootStatus(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
175 | LEP_SDK_BOOT_STATUS_E_PTR bootStatusPtr);
176 |
177 | /******************************************************************************/
178 |
179 | #ifdef __cplusplus
180 | }
181 | #endif
182 |
183 | #endif /* _LEPTON_SDK_H_ */
184 |
--------------------------------------------------------------------------------
/lepton_sdk/Inc/LEPTON_SDKConfig.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | **
3 | ** File NAME: _LEPTON_SDKCONFIG_H_.h
4 | **
5 | ** AUTHOR: hthomson
6 | **
7 | ** CREATED: 3/28/2014
8 | **
9 | ** DESCRIPTION: typedefs for coding style/conventions
10 | **
11 | ** HISTORY: 3/28/2014 HT - Initial Draft
12 | **
13 | ** Copyright 2011,2012,2013,2014 FLIR Systems - Commercial
14 | ** Vision Systems. All rights reserved.
15 | **
16 | ** Proprietary - PROPRIETARY - FLIR Systems Inc..
17 | **
18 | ** This document is controlled to FLIR Technology Level 2.
19 | ** The information contained in this document pertains to a
20 | ** dual use product Controlled for export by the Export
21 | ** Administration Regulations (EAR). Diversion contrary to
22 | ** US law is prohibited. US Department of Commerce
23 | ** authorization is not required prior to export or
24 | ** transfer to foreign persons or parties unless otherwise
25 | ** prohibited.
26 | **
27 | ** Redistribution and use in source and binary forms, with
28 | ** or without modification, are permitted provided that the
29 | ** following conditions are met:
30 | **
31 | ** Redistributions of source code must retain the above
32 | ** copyright notice, this list of conditions and the
33 | ** following disclaimer.
34 | **
35 | ** Redistributions in binary form must reproduce the above
36 | ** copyright notice, this list of conditions and the
37 | ** following disclaimer in the documentation and/or other
38 | ** materials provided with the distribution.
39 | **
40 | ** Neither the name of the FLIR Systems Corporation nor the
41 | ** names of its contributors may be used to endorse or
42 | ** promote products derived from this software without
43 | ** specific prior written permission.
44 | **
45 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
46 | ** CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
47 | ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
48 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
49 | ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
50 | ** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
51 | ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
53 | ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
54 | ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
56 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
57 | ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
58 | ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
59 | ** OF SUCH DAMAGE.
60 | **
61 | *******************************************************************************/
62 | #ifndef _LEPTON_SDKCONFIG_H_
63 | #define _LEPTON_SDKCONFIG_H_
64 |
65 | #ifdef __cplusplus
66 | extern "C"
67 | {
68 | #endif
69 |
70 | /******************************************************************************/
71 | /** INCLUDE FILES **/
72 | /******************************************************************************/
73 |
74 |
75 | /******************************************************************************/
76 | /** EXPORTED DEFINES **/
77 | /******************************************************************************/
78 |
79 | #define USE_DEPRECATED_SERIAL_NUMBER_INTERFACE 0
80 | #define USE_DEPRECATED_PART_NUMBER_INTERFACE 0
81 | #define USE_DEPRECATED_ASICID_INTERFACE 0
82 | #define USE_DEPRECATED_HOUSING_TCP_INTERFACE 0
83 | #define USE_BORESIGHT_MEASUREMENT_FUNCTIONS 1
84 |
85 | /******************************************************************************/
86 | /** EXPORTED TYPE DEFINITIONS **/
87 | /******************************************************************************/
88 |
89 |
90 | /******************************************************************************/
91 | /** EXPORTED PUBLIC DATA **/
92 | /******************************************************************************/
93 |
94 | /******************************************************************************/
95 | /** EXPORTED PUBLIC FUNCTIONS **/
96 | /******************************************************************************/
97 |
98 |
99 | /******************************************************************************/
100 | #ifdef __cplusplus
101 | }
102 | #endif
103 | #endif // _LEPTON_SDKCONFIG_H_
104 |
105 |
106 |
--------------------------------------------------------------------------------
/lepton_sdk/Inc/LEPTON_SYS.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samyk/GetThermal/48453e6af6d3d16ec67a3a44c09bd83b020506ca/lepton_sdk/Inc/LEPTON_SYS.h
--------------------------------------------------------------------------------
/lepton_sdk/Inc/LEPTON_Types.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | **
3 | ** File NAME: LEPTON_Types.h
4 | **
5 | ** AUTHOR: pwolf
6 | **
7 | ** CREATED: 2/01/2011
8 | **
9 | ** DESCRIPTION: typedefs for coding style/conventions
10 | **
11 | ** HISTORY: 2/01/2012 PW - Initial Draft
12 | **
13 | ** Copyright 2011,2012,2013,2014 FLIR Systems - Commercial
14 | ** Vision Systems. All rights reserved.
15 | **
16 | ** Proprietary - PROPRIETARY - FLIR Systems Inc..
17 | **
18 | ** This document is controlled to FLIR Technology Level 2.
19 | ** The information contained in this document pertains to a
20 | ** dual use product Controlled for export by the Export
21 | ** Administration Regulations (EAR). Diversion contrary to
22 | ** US law is prohibited. US Department of Commerce
23 | ** authorization is not required prior to export or
24 | ** transfer to foreign persons or parties unless otherwise
25 | ** prohibited.
26 | **
27 | ** Redistribution and use in source and binary forms, with
28 | ** or without modification, are permitted provided that the
29 | ** following conditions are met:
30 | **
31 | ** Redistributions of source code must retain the above
32 | ** copyright notice, this list of conditions and the
33 | ** following disclaimer.
34 | **
35 | ** Redistributions in binary form must reproduce the above
36 | ** copyright notice, this list of conditions and the
37 | ** following disclaimer in the documentation and/or other
38 | ** materials provided with the distribution.
39 | **
40 | ** Neither the name of the FLIR Systems Corporation nor the
41 | ** names of its contributors may be used to endorse or
42 | ** promote products derived from this software without
43 | ** specific prior written permission.
44 | **
45 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
46 | ** CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
47 | ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
48 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
49 | ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
50 | ** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
51 | ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
53 | ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
54 | ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
56 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
57 | ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
58 | ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
59 | ** OF SUCH DAMAGE.
60 | **
61 | *******************************************************************************/
62 | #ifndef _LEPTON_TYPES_H_
63 | #define _LEPTON_TYPES_H_
64 |
65 | #ifdef __cplusplus
66 | extern "C"
67 | {
68 | #endif
69 |
70 | // #define AVR_IAR_BUILD
71 | /******************************************************************************/
72 | /** INCLUDE FILES **/
73 | /******************************************************************************/
74 |
75 | #ifdef AVR_IAR_BUILD
76 | #include "avr_compiler.h"
77 | #endif
78 |
79 | #if defined(_WIN32) || defined (_WIN64)
80 | #include
81 | #define WINDOWSS 1;
82 | #else
83 | #include
84 | #include
85 | #endif
86 |
87 | /******************************************************************************/
88 | /** EXPORTED DEFINES **/
89 | /******************************************************************************/
90 | #define LEP_FAILURE -1
91 | #define LEP_SUCCESS 0
92 | #define LEP_TRUE 1
93 | #define LEP_FALSE 0
94 | #define LEP_NULL 0
95 |
96 | /******************************************************************************/
97 | /** EXPORTED TYPE DEFINITIONS **/
98 | /******************************************************************************/
99 |
100 | #ifdef _STDINT_H
101 | typedef uint8_t LEP_UINT8;
102 | typedef uint8_t LEP_UCHAR;
103 | typedef int8_t LEP_INT8;
104 | typedef char LEP_CHAR8;
105 |
106 | typedef uint16_t LEP_UINT16;
107 | typedef uint16_t LEP_USHORT;
108 | typedef int16_t LEP_INT16;
109 | typedef short LEP_SHORT;
110 |
111 | typedef uint32_t LEP_UINT32;
112 | typedef uint32_t LEP_UINT;
113 | typedef int32_t LEP_INT32;
114 | typedef int LEP_INT;
115 |
116 | typedef uint64_t LEP_UINT64;
117 | typedef uint64_t LEP_ULONG64;
118 | typedef uint32_t LEP_ULONG32;
119 | typedef uint32_t LEP_ULONG;
120 | typedef int64_t LEP_LONG32;
121 | typedef long LEP_LONG;
122 |
123 | typedef float LEP_FLOAT32;
124 | typedef double LEP_FLOAT64;
125 | #else
126 | typedef unsigned char LEP_UINT8;
127 | typedef unsigned char LEP_UCHAR;
128 | typedef signed char LEP_INT8;
129 | typedef char LEP_CHAR8;
130 |
131 | typedef unsigned short LEP_UINT16;
132 | typedef unsigned short LEP_USHORT;
133 | typedef signed short LEP_INT16;
134 | typedef short LEP_SHORT;
135 |
136 | typedef unsigned int LEP_UINT32;
137 | typedef unsigned int LEP_UINT;
138 | typedef signed int LEP_INT32;
139 | typedef int LEP_INT;
140 |
141 | typedef unsigned long long LEP_UINT64;
142 | typedef unsigned long long LEP_ULONG64;
143 | typedef unsigned long LEP_ULONG32;
144 | typedef unsigned long LEP_ULONG;
145 | typedef signed long LEP_LONG32;
146 | typedef long LEP_LONG;
147 |
148 | typedef float LEP_FLOAT32;
149 | typedef double LEP_FLOAT64;
150 | #endif
151 |
152 |
153 | #ifdef _STDBOOL_H
154 | typedef bool LEP_BOOL, *LEP_BOOL_PTR;
155 | #else
156 | typedef unsigned char LEP_BOOL, *LEP_BOOL_PTR;
157 | #endif
158 |
159 | /* NULL
160 | */
161 | #ifndef NULL
162 | #define NULL '\0'
163 | #endif
164 |
165 |
166 | typedef LEP_UINT16 LEP_COMMAND_ID;
167 | typedef LEP_UINT16 LEP_ATTRIBUTE_T,*LEP_ATTRIBUTE_T_PTR;
168 |
169 | #define LEP_GET_TYPE 0x0000
170 | #define LEP_SET_TYPE 0x0001
171 | #define LEP_RUN_TYPE 0x0002
172 |
173 | typedef enum
174 | {
175 | LEP_LSB_FIRST=0,
176 | LEP_MSB_FIRST
177 |
178 | }LEP_BYTE_ORDER_T, *LEP_BYTE_ORDER_T_PTR;
179 |
180 | typedef enum
181 | {
182 | LEP_READY = 0,
183 | LEP_BUSY,
184 | LEP_WAITING
185 |
186 | }LEP_OPERATION_STATE;
187 |
188 | typedef enum
189 | {
190 | LEP_DISABLED = 0,
191 | LEP_ENABLED
192 |
193 | }LEP_ENABLE_STATE;
194 |
195 | typedef enum
196 | {
197 | LEP_OFF = 0,
198 | LEP_ON
199 |
200 | }LEP_ON_STATE;
201 |
202 |
203 | /* Lepton physical tranport interfaces
204 | */
205 | typedef enum LEP_CAMERA_PORT_E_TAG
206 | {
207 | LEP_CCI_TWI=0,
208 | LEP_CCI_SPI,
209 | LEP_CCI_UVC,
210 | LEP_END_CCI_PORTS
211 | }LEP_CAMERA_PORT_E, *LEP_CAMERA_PORT_E_PTR;
212 |
213 | /* Device entries
214 | */
215 | typedef enum LEP_PROTOCOL_DEVICE_E_TAG
216 | {
217 | /* I2C Devices */
218 | AARDVARK_I2C = 0,
219 | DEV_BOARD_FTDI_V2,
220 | //C232HM_DDHSL_0,
221 | TCP_IP,
222 |
223 | /* SPI Devices */
224 |
225 | LEP_END_PROTOCOL_DEVICE,
226 | } LEP_PROTOCOL_DEVICE_E, *LEP_PROTOCOL_DEVICE_E_PTR;
227 |
228 | /* Lepton supported TWI clock rates
229 | */
230 | typedef enum LEP_TWI_CLOCK_RATE_T_TAG
231 | {
232 | LEP_TWI_CLOCK_100KHZ=0,
233 | LEP_TWI_CLOCK_400KHZ,
234 | LEP_TWI_CLOCK_1MHZ,
235 | LEP_END_TWI_CLOCK_RATE
236 |
237 | }LEP_TWI_CLOCK_RATE_T, *LEP_TWI_CLOCK_RATE_T_PTR;
238 |
239 | /* Lepton supported SPI clock rates
240 | */
241 | typedef enum LEP_SPI_CLOCK_RATE_T_TAG
242 | {
243 | LEP_SPI_CLOCK_2MHZ=0,
244 | LEP_SPI_CLOCK_10MHZ,
245 | LEP_SPI_CLOCK_20MHZ,
246 | LEP_END_SPI_CLOCK_RATE
247 |
248 | }LEP_SPI_CLOCK_RATE_T, *LEP_SPI_CLOCK_RATE_T_PTR;
249 |
250 | /* Communications Port Descriptor Type
251 | */
252 | typedef struct LEP_CAMERA_PORT_DESC_T_TAG
253 | {
254 | LEP_UINT16 portID;
255 | LEP_CAMERA_PORT_E portType;
256 | void* userPtr;
257 | }LEP_CAMERA_PORT_DESC_T, *LEP_CAMERA_PORT_DESC_T_PTR;
258 |
259 |
260 | /******************************************************************************/
261 | /** EXPORTED PUBLIC DATA **/
262 | /******************************************************************************/
263 |
264 | /******************************************************************************/
265 | /** EXPORTED PUBLIC FUNCTIONS **/
266 | /******************************************************************************/
267 |
268 |
269 | /******************************************************************************/
270 | #ifdef __cplusplus
271 | }
272 | #endif
273 | #endif // _FLIR_TYPES_H_
274 |
275 |
276 |
--------------------------------------------------------------------------------
/lepton_sdk/Inc/crc16.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Filename: crc16.h
4 | Description: Cyclic Redundancy Check 16 functions
5 | Created: 24-Feb-1999
6 |
7 | ** Copyright 2011,2012,2013,2014 FLIR Systems - Commercial
8 | ** Vision Systems. All rights reserved.
9 | **
10 | ** Proprietary - PROPRIETARY - FLIR Systems Inc..
11 | **
12 | ** This document is controlled to FLIR Technology Level 2.
13 | ** The information contained in this document pertains to a
14 | ** dual use product Controlled for export by the Export
15 | ** Administration Regulations (EAR). Diversion contrary to
16 | ** US law is prohibited. US Department of Commerce
17 | ** authorization is not required prior to export or
18 | ** transfer to foreign persons or parties unless otherwise
19 | ** prohibited.
20 | **
21 | ** Redistribution and use in source and binary forms, with
22 | ** or without modification, are permitted provided that the
23 | ** following conditions are met:
24 | **
25 | ** Redistributions of source code must retain the above
26 | ** copyright notice, this list of conditions and the
27 | ** following disclaimer.
28 | **
29 | ** Redistributions in binary form must reproduce the above
30 | ** copyright notice, this list of conditions and the
31 | ** following disclaimer in the documentation and/or other
32 | ** materials provided with the distribution.
33 | **
34 | ** Neither the name of the FLIR Systems Corporation nor the
35 | ** names of its contributors may be used to endorse or
36 | ** promote products derived from this software without
37 | ** specific prior written permission.
38 | **
39 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
40 | ** CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
41 | ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
42 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
43 | ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
44 | ** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
45 | ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
46 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
47 | ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
48 | ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
49 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
50 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
51 | ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
52 | ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
53 | ** OF SUCH DAMAGE.
54 |
55 | ****************************************************************************/
56 |
57 | #ifndef __CRC16_H__
58 | #define __CRC16_H__
59 |
60 | #ifdef __cplusplus
61 | extern "C"
62 | {
63 | #endif
64 |
65 | typedef unsigned short CRC16;
66 |
67 | int ByteCRC16(int value, int crcin);
68 | CRC16 CalcCRC16Words(unsigned int count, short *buffer);
69 | CRC16 CalcCRC16Bytes(unsigned int count, char *buffer);
70 |
71 | #ifdef __cplusplus
72 | }
73 | #endif
74 |
75 | #endif /* __CRC16_H__ */
76 |
--------------------------------------------------------------------------------
/lepton_sdk/Inc/uvc_sdk.h:
--------------------------------------------------------------------------------
1 | #ifndef UVC_SDK_H
2 | #define UVC_SDK_H
3 |
4 | #ifdef __cplusplus
5 | extern "C"
6 | {
7 | #endif
8 |
9 | #include "LEPTON_Types.h"
10 | #include "LEPTON_ErrorCodes.h"
11 | #include "LEPTON_SDKConfig.h"
12 |
13 | LEP_RESULT UVC_GetAttribute(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
14 | LEP_COMMAND_ID commandID,
15 | LEP_ATTRIBUTE_T_PTR attributePtr,
16 | LEP_UINT16 attributeWordLength);
17 |
18 | LEP_RESULT UVC_SetAttribute(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
19 | LEP_COMMAND_ID commandID,
20 | LEP_ATTRIBUTE_T_PTR attributePtr,
21 | LEP_UINT16 attributeWordLength);
22 |
23 | LEP_RESULT UVC_RunCommand(LEP_CAMERA_PORT_DESC_T_PTR portDescPtr,
24 | LEP_COMMAND_ID commandID);
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 |
30 | #endif // UVC_SDK_H
31 |
--------------------------------------------------------------------------------
/lepton_sdk/Src/crc16fast.c:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Filename: crc16fast.c
4 | Description: Cyclic Redundancy Check 16 functions
5 | Created: 24-Feb-1999
6 |
7 | ** Copyright 2011,2012,2013,2014 FLIR Systems - Commercial
8 | ** Vision Systems. All rights reserved.
9 | **
10 | ** Proprietary - PROPRIETARY - FLIR Systems Inc..
11 | **
12 | ** This document is controlled to FLIR Technology Level 2.
13 | ** The information contained in this document pertains to a
14 | ** dual use product Controlled for export by the Export
15 | ** Administration Regulations (EAR). Diversion contrary to
16 | ** US law is prohibited. US Department of Commerce
17 | ** authorization is not required prior to export or
18 | ** transfer to foreign persons or parties unless otherwise
19 | ** prohibited.
20 | **
21 | ** Redistribution and use in source and binary forms, with
22 | ** or without modification, are permitted provided that the
23 | ** following conditions are met:
24 | **
25 | ** Redistributions of source code must retain the above
26 | ** copyright notice, this list of conditions and the
27 | ** following disclaimer.
28 | **
29 | ** Redistributions in binary form must reproduce the above
30 | ** copyright notice, this list of conditions and the
31 | ** following disclaimer in the documentation and/or other
32 | ** materials provided with the distribution.
33 | **
34 | ** Neither the name of the FLIR Systems Corporation nor the
35 | ** names of its contributors may be used to endorse or
36 | ** promote products derived from this software without
37 | ** specific prior written permission.
38 | **
39 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
40 | ** CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
41 | ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
42 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
43 | ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
44 | ** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
45 | ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
46 | ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
47 | ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
48 | ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
49 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
50 | ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
51 | ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
52 | ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
53 | ** OF SUCH DAMAGE.
54 | **
55 | ****************************************************************************/
56 |
57 | #include "crc16.h"
58 |
59 | const CRC16 ccitt_16Table[] = {
60 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
61 | 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
62 | 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
63 | 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
64 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
65 | 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
66 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
67 | 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
68 | 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
69 | 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
70 | 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
71 | 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
72 | 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
73 | 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
74 | 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
75 | 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
76 | 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
77 | 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
78 | 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
79 | 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
80 | 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
81 | 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
82 | 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
83 | 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
84 | 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
85 | 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
86 | 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
87 | 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
88 | 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
89 | 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
90 | 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
91 | 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
92 | };
93 |
94 | /*
95 | * ===== ByteCRC16 =====
96 | * Calculate (update) the CRC16 for a single 8-bit byte
97 | */
98 | int ByteCRC16(int value, int crcin)
99 | {
100 | return (unsigned short)((crcin << 8) ^ ccitt_16Table[((crcin >> 8) ^ (value)) & 255]);
101 | }
102 |
103 | /*
104 | * ===== CalcCRC16Words =====
105 | * Calculate the CRC for a buffer of 16-bit words. Supports both
106 | * Little and Big Endian formats using conditional compilation.
107 | * Note: minimum count is 1 (0 case not handled)
108 | */
109 | CRC16 CalcCRC16Words(unsigned int count, short *buffer) {
110 |
111 | int crc = 0;
112 |
113 | do {
114 |
115 | int value = *buffer++;
116 | #ifdef _BIG_ENDIAN
117 | crc = ByteCRC16(value >> 8, crc);
118 | crc = ByteCRC16(value, crc);
119 | #else
120 | crc = ByteCRC16(value, crc);
121 | crc = ByteCRC16(value >> 8, crc);
122 | #endif
123 | }
124 | while (--count);
125 | return (CRC16) crc;
126 | }
127 |
128 | /*
129 | * ===== CalcCRC16Bytes =====
130 | * Calculate the CRC for a buffer of 8-bit words.
131 | * Note: minimum count is 1 (0 case not handled)
132 | */
133 | CRC16 CalcCRC16Bytes(unsigned int count, char *buffer) {
134 |
135 | int crc = 0;
136 |
137 | do {
138 |
139 | int value = *buffer++;
140 | crc = ByteCRC16(value, crc);
141 | }
142 | while (--count);
143 | return crc;
144 | }
145 |
--------------------------------------------------------------------------------
/qml/Viewer.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.7
2 | import QtMultimedia 5.5
3 | import GetThermal 1.0
4 |
5 | ViewerForm {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/qml/ViewerForm.ui.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.7
2 | import QtQuick.Controls 2.0
3 | import QtQuick.Layouts 1.0
4 | import QtMultimedia 5.5
5 | import GetThermal 1.0
6 | import "qrc:/controls"
7 | import "qrc:/images"
8 |
9 | Item {
10 | id: item1
11 | anchors.fill: parent
12 |
13 | property alias acq: acq
14 | property alias player: player
15 | property alias videoOutput: videoOutput
16 | width: 640
17 |
18 | UvcAcquisition {
19 | id: acq
20 | }
21 |
22 | UvcVideoProducer {
23 | id: player
24 | uvc: acq
25 | }
26 |
27 | RowLayout {
28 | spacing: 0
29 | anchors.fill: parent
30 |
31 | CameraControls {
32 | Layout.minimumWidth: 240
33 | Layout.fillHeight: true
34 | acq: acq
35 | }
36 |
37 | Pane {
38 | x: 220
39 | width: 400
40 | bottomPadding: 5
41 | rightPadding: 5
42 | leftPadding: 5
43 | topPadding: 5
44 | Layout.fillWidth: true
45 | Layout.fillHeight: true
46 | VideoOutput {
47 | id: videoOutput
48 | anchors.fill: parent
49 | fillMode: VideoOutput.PreserveAspectFit
50 | source: player
51 | VideoRoi {
52 | id: radRoi
53 | visible: acq.cci.supportsRadiometry
54 | acq: acq
55 | anchors.horizontalCenter: parent.horizontalCenter
56 | anchors.verticalCenter: parent.verticalCenter
57 | }
58 | }
59 | }
60 |
61 |
62 |
63 |
64 | Pane {
65 | width: 130
66 | Layout.minimumWidth: 130
67 | Layout.fillHeight: true
68 | visible: acq.cci.supportsRadiometry
69 |
70 | SpotInfo {
71 | id: spotInfo
72 | anchors.top: parent.top
73 | anchors.left: parent.left
74 | anchors.right: parent.right
75 | acq: acq
76 | farenheitTemps: rangeDisplay.farenheitTemps
77 | }
78 |
79 | RangeDisplay {
80 | id: rangeDisplay
81 | anchors.top: spotInfo.bottom
82 | anchors.left: parent.left
83 | anchors.right: parent.right
84 | anchors.bottom: parent.bottom
85 | acq: acq
86 | }
87 | }
88 |
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/qml/boson/BosonTabs.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 | import "qrc:/boson"
5 |
6 | Page {
7 | id: root
8 | clip: true
9 |
10 | width: 220
11 | height: 480
12 |
13 | property UvcAcquisition acq: null
14 |
15 | header: TabBar {
16 | id: tabBar
17 | currentIndex: swipeView.currentIndex
18 |
19 | TabButton {
20 | text: qsTr("Vid")
21 | }
22 |
23 | TabButton {
24 | text: qsTr("Info")
25 | }
26 | }
27 |
28 | SwipeView {
29 | id: swipeView
30 | x: 0
31 | y: 40
32 | currentIndex: tabBar.currentIndex
33 | anchors.fill: parent
34 |
35 | VidControls {
36 | id: vidControls1
37 | anchors.bottom: parent.bottom
38 | anchors.left: parent.left
39 | anchors.top: parent.top
40 | acq: root.acq
41 | }
42 |
43 | InfoControls {
44 | id: infoControls1
45 | anchors.bottom: parent.bottom
46 | anchors.left: vidControls1.right
47 | anchors.top: parent.top
48 | acq: root.acq
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/qml/boson/InfoControls.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 |
5 | Item {
6 | id: root
7 | width: 200
8 | property UvcAcquisition acq: null
9 |
10 | GroupBox {
11 | id: groupBox1
12 | clip: true
13 |
14 | anchors.margins: 5
15 | anchors.fill: parent
16 | title: qsTr("FLIR Boson")
17 |
18 | Grid {
19 | id: grid
20 |
21 | columns: 1
22 | rows: 8
23 | anchors.fill: parent
24 | spacing: 10
25 | flow: Grid.TopToBottom
26 |
27 | Label {
28 | text: qsTr("Sensor PN: ") + acq.cci.sensorPartNumber
29 | }
30 |
31 | Label {
32 | text: qsTr("Sensor SN: ") + acq.cci.sensorSerialNumber
33 | }
34 |
35 | Label {
36 | text: qsTr("Cam PN: ") + acq.cci.cameraPartNumber
37 | }
38 |
39 | Label {
40 | text: qsTr("Cam SN: ") + acq.cci.cameraSerialNumber
41 | }
42 |
43 | Label {
44 | text: qsTr("Software: ") + acq.cci.softwareRev
45 | }
46 | }
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/qml/boson/VidControls.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 |
5 | Item {
6 | id: root
7 | width: 200
8 | property UvcAcquisition acq: null
9 |
10 | Flow {
11 | id: flow1
12 | spacing: 5
13 | anchors.fill: parent
14 | anchors.margins: 5
15 |
16 | Label {
17 | id: labelPcolor
18 | width: parent.width
19 | text: qsTr("Pseudo-Color Palette:")
20 | }
21 |
22 | ComboBox {
23 | id: comboColorLutId
24 | width: parent.width
25 | visible: acq.cci.supportsHwPseudoColor
26 |
27 | model: ListModel {
28 | ListElement { text: "White Hot"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_WHITEHOT }
29 | ListElement { text: "Black Hot"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_BLACKHOT }
30 | ListElement { text: "Red Hot"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_REDHOT }
31 | ListElement { text: "Rainbow"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_RAINBOW }
32 | ListElement { text: "Ironbow"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_IRONBOW }
33 | ListElement { text: "Lava"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_LAVA }
34 | ListElement { text: "Arctic"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_ARCTIC }
35 | ListElement { text: "Globow"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_GLOBOW }
36 | ListElement { text: "Graded Fire"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_GRADEDFIRE }
37 | ListElement { text: "Instalert"; data: FLR_COLORLUT_ID_E.FLR_COLORLUT_INSTALERT }
38 | }
39 | textRole: qsTr("text")
40 |
41 | currentIndex: acq.cci.colorLutId
42 | }
43 |
44 | ComboBox {
45 | id: comboSwPcolorLut
46 | width: parent.width
47 | visible: !acq.cci.supportsHwPseudoColor
48 |
49 | model: ListModel {
50 | ListElement { text: "Iron Black"; data: DataFormatter.IronBlack }
51 | ListElement { text: "Rainbow"; data: DataFormatter.Rainbow }
52 | ListElement { text: "Grayscale"; data: DataFormatter.Grayscale }
53 | }
54 | textRole: qsTr("text")
55 |
56 | currentIndex: acq.dataFormatter.pseudocolorPalette
57 | }
58 |
59 | Button {
60 | id: buttonFfc
61 | text: qsTr("Perform FFC")
62 | }
63 | }
64 |
65 |
66 | Connections {
67 | target: comboColorLutId
68 | onCurrentIndexChanged: {
69 | var currentItem = target.model.get(target.currentIndex);
70 | acq.cci.colorLutId = currentItem.data;
71 | }
72 | }
73 |
74 | Connections {
75 | target: comboSwPcolorLut
76 | onCurrentIndexChanged: {
77 | var currentItem = target.model.get(target.currentIndex);
78 | acq.dataFormatter.pseudocolorPalette = currentItem.data;
79 | }
80 | }
81 |
82 | Connections {
83 | target: buttonFfc
84 | onClicked: {
85 | acq.cci.performFfc();
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/qml/controls/CameraControls.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 | import "qrc:/lepton"
5 | import "qrc:/boson"
6 | import "qrc:/images"
7 |
8 | Pane {
9 | id: root
10 |
11 | property UvcAcquisition acq: null
12 |
13 | width: 220
14 | height: 480
15 |
16 | rightPadding: 5
17 | topPadding: 12
18 | bottomPadding: 12
19 | leftPadding: 12
20 | padding: 0
21 |
22 | Image {
23 | id: imageLogo
24 | anchors.left: parent.left
25 | anchors.top: parent.top
26 | anchors.right: parent.right
27 | height: 50
28 | fillMode: Image.PreserveAspectFit
29 | source: "/images/images/brand-logo.png"
30 | }
31 |
32 | Component {
33 | id: leptonControls1
34 | LeptonTabs {
35 | acq: root.acq
36 | }
37 | }
38 |
39 | Component {
40 | id: bosonControls1
41 | BosonTabs {
42 | acq: root.acq
43 | }
44 | }
45 |
46 | Loader {
47 | id: controls
48 | asynchronous: true
49 | anchors.top: imageLogo.bottom
50 | anchors.left: parent.left
51 | anchors.right: parent.right
52 | anchors.bottom: parent.bottom
53 | }
54 |
55 | onAcqChanged: {
56 | if (acq.cci.objectName === "LeptonVariation")
57 | {
58 | controls.sourceComponent = leptonControls1;
59 | }
60 | else if (acq.cci.objectName === "BosonVariation")
61 | {
62 | controls.sourceComponent = bosonControls1;
63 | }
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/qml/controls/RangeDisplay.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 | import QtQml 2.2
5 |
6 | Item {
7 | id: item1
8 |
9 | property UvcAcquisition acq: null
10 | property bool farenheitTemps: false
11 | property bool radiometryLowGain: acq.cci.radTLinearResolution == LEP_RAD_TLINEAR_RESOLUTION_E.LEP_RAD_RESOLUTION_0_1
12 |
13 | width: 160
14 |
15 | function ktof(val) {
16 | return (1.8 * ktoc(val) + 32.0);
17 | }
18 |
19 | function ktoc(val) {
20 | if (radiometryLowGain) {
21 | return (val - 2731.5) / 10.0;
22 | } else {
23 | return (val - 27315) / 100.0;
24 | }
25 | }
26 |
27 | function localtemp(k) {
28 | if (farenheitTemps) {
29 | return "" + ktof(k).toFixed(1) + "°F";
30 | }
31 | else {
32 | return "" + ktoc(k).toFixed(2) + "°C";
33 | }
34 | }
35 |
36 | Image {
37 | id: image1
38 | width: 25
39 | anchors.left: parent.left
40 | anchors.leftMargin: 8
41 | anchors.bottom: parent.bottom
42 | anchors.bottomMargin: 8
43 | anchors.top: parent.top
44 | anchors.topMargin: 8
45 | source: "image://palettes/" + acq.dataFormatter.pseudocolorPalette;
46 | }
47 |
48 | Item {
49 | anchors.left: image1.right
50 | anchors.leftMargin: 8
51 | anchors.right: parent.right
52 | anchors.rightMargin: 8
53 | anchors.bottom: parent.bottom
54 | anchors.bottomMargin: 8
55 | anchors.top: parent.top
56 | anchors.topMargin: 8
57 |
58 | Label {
59 | id: labelMax
60 | text: localtemp(acq.dataFormatter.maxVal)
61 | anchors.left: parent.left
62 | anchors.leftMargin: 0
63 | anchors.top: parent.top
64 | anchors.topMargin: 0
65 | }
66 |
67 | Label {
68 | id: labelMid
69 | text: localtemp(acq.dataFormatter.minVal + (acq.dataFormatter.maxVal - acq.dataFormatter.minVal) / 2)
70 | anchors.verticalCenter: parent.verticalCenter
71 | anchors.left: parent.left
72 | anchors.leftMargin: 0
73 | }
74 |
75 | Label {
76 | id: labelMin
77 | text: localtemp(acq.dataFormatter.minVal)
78 | anchors.left: parent.left
79 | anchors.leftMargin: 0
80 | anchors.bottom: parent.bottom
81 | anchors.bottomMargin: 0
82 | }
83 |
84 | MouseArea {
85 | anchors.fill: parent
86 | onClicked: farenheitTemps = !farenheitTemps
87 | }
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/qml/controls/SpotInfo.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 | import QtQml 2.2
5 |
6 | Item {
7 | id: item1
8 |
9 | property UvcAcquisition acq: null
10 | property bool farenheitTemps: false
11 | property bool radiometryLowGain: acq.cci.radTLinearResolution == LEP_RAD_TLINEAR_RESOLUTION_E.LEP_RAD_RESOLUTION_0_1
12 |
13 | width: 160
14 | height: 60
15 |
16 | function ktof(val) {
17 | return (1.8 * ktoc(val) + 32.0);
18 | }
19 |
20 | function ktoc(val) {
21 | if (radiometryLowGain) {
22 | return (val - 2731.5) / 10.0;
23 | } else {
24 | return (val - 27315) / 100.0;
25 | }
26 | }
27 |
28 | function localtemp(k) {
29 | if (farenheitTemps) {
30 | return "" + ktof(k).toFixed(1) + "°F";
31 | }
32 | else {
33 | return "" + ktoc(k).toFixed(2) + "°C";
34 | }
35 | }
36 |
37 | GroupBox {
38 | id: groupBox
39 | anchors.fill: parent
40 | title: qsTr("Spot Temp")
41 |
42 | Label {
43 | id: labelSpot
44 | x: -89
45 | y: -14
46 | text: localtemp(acq.cci.radSpotmeterInKelvinX100)
47 | anchors.horizontalCenter: parent.horizontalCenter
48 | anchors.verticalCenter: parent.verticalCenter
49 | verticalAlignment: Text.AlignVCenter
50 | horizontalAlignment: Text.AlignHCenter
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/qml/controls/ValueSlider.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 |
5 | Pane {
6 | id: valueSlider
7 |
8 | property string description: qsTr("Value")
9 | property real value: 0
10 | property real minimumValue: 0
11 | property real maximumValue: 65536
12 | property real stepSize: 1
13 | property var model: null
14 | property string binding: ""
15 |
16 | width: 220
17 | height: 58
18 | padding: 0
19 |
20 | Binding {
21 | target: valueSlider.model
22 | property: valueSlider.binding
23 | value: valueSlider.value
24 | }
25 |
26 | function updateValue() {
27 | model[binding] = value;
28 | }
29 |
30 | onModelChanged: {
31 | if (model !== null)
32 | {
33 | var val = model[binding];
34 | console.log("model: " + model + " property: " + binding + " value: " + val);
35 | value = val;
36 | onValueChanged.connect(updateValue);
37 | }
38 | }
39 |
40 | Label {
41 | id: label
42 | text: valueSlider.description
43 | }
44 |
45 | Slider {
46 | id: slider
47 | width: parent.width / 2
48 | anchors.bottom: parent.bottom
49 | to: valueSlider.maximumValue
50 | from: valueSlider.minimumValue
51 | anchors.margins: 0
52 | anchors.left: parent.left
53 | anchors.top: label.bottom
54 | value: valueSlider.value
55 | stepSize: valueSlider.stepSize
56 | onValueChanged: {
57 | spin.value = value
58 | valueSlider.value = value
59 | }
60 | }
61 |
62 | SpinBox {
63 | id: spin
64 | anchors.bottom: parent.bottom
65 | to: valueSlider.maximumValue
66 | from: valueSlider.minimumValue
67 | anchors.margins: 0
68 | anchors.right: parent.right
69 | anchors.left: slider.right
70 | anchors.top: label.bottom
71 | value: valueSlider.value
72 | stepSize: valueSlider.stepSize
73 | onValueChanged: {
74 | slider.value = value
75 | valueSlider.value = value
76 | }
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/qml/controls/VideoRoi.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 |
5 | Item {
6 | id: root
7 |
8 | anchors.fill: parent
9 |
10 | property UvcAcquisition acq: null
11 | property rect roi: acq && acq.cci ? acq.cci.radSpotmeterRoi : Qt.rect(0, 0, 80, 60)
12 | property size videoSize: acq ? acq.videoSize : Qt.size(80, 60)
13 |
14 | function moveUnscaledRoiTo(dispX, dispY) {
15 | var nx = Math.floor(dispX * (videoSize.width / scaledvid.width))
16 | var ny = Math.floor(dispY * (videoSize.height / scaledvid.height))
17 | if (roi.x === nx && roi.y === ny) {
18 | return
19 | }
20 | acq.cci.radSpotmeterRoi = Qt.rect(nx, ny, roi.width, roi.height)
21 | }
22 |
23 | Item {
24 | id: scaledvid
25 |
26 | width: root.width
27 | height: (root.width * videoSize.height) / videoSize.width
28 | anchors.centerIn: root
29 |
30 | MouseArea {
31 | cursorShape: Qt.CrossCursor
32 | anchors.fill: parent
33 | onClicked: {
34 | moveUnscaledRoiTo(mouse.x, mouse.y)
35 | }
36 | }
37 |
38 | Rectangle {
39 | id: roidisp
40 |
41 | x: roi.x * (scaledvid.width / videoSize.width)
42 | y: roi.y * (scaledvid.height / videoSize.height)
43 | width: roi.width * (scaledvid.width / videoSize.width)
44 | height: roi.height * (scaledvid.height / videoSize.height)
45 |
46 | color: "#80ffffff"
47 | border.color: "#80000000"
48 |
49 | MouseArea {
50 | cursorShape: drag.active ? Qt.ClosedHandCursor : Qt.OpenHandCursor
51 | anchors.fill: parent
52 | drag.target: roidisp
53 | drag.axis: Drag.XAndYAxis
54 | drag.smoothed: false
55 | drag.threshold: 1
56 | onPositionChanged: {
57 | moveUnscaledRoiTo(roidisp.x, roidisp.y)
58 | }
59 | }
60 | }
61 | Rectangle {
62 | id: maxpoint
63 | x: acq.dataFormatter.maxPoint.x * (scaledvid.width / videoSize.width)
64 | y: acq.dataFormatter.maxPoint.y * (scaledvid.width / videoSize.width)
65 | color: "#80ff0000"
66 | border.color: "#80000000"
67 | width: roi.width * (scaledvid.width / videoSize.width)
68 | height: roi.height * (scaledvid.height / videoSize.height)
69 | visible: false
70 |
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/qml/images/brand-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samyk/GetThermal/48453e6af6d3d16ec67a3a44c09bd83b020506ca/qml/images/brand-logo.png
--------------------------------------------------------------------------------
/qml/lepton/AgcControls.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 | import "qrc:/controls"
5 |
6 | Item {
7 | id: root
8 | width: 200
9 | property UvcAcquisition acq: null
10 | anchors.margins: 5
11 | enabled: !acq.cci.supportsRadiometry
12 |
13 | Flow {
14 | id: flow1
15 | spacing: 5
16 | anchors.fill: parent
17 | anchors.margins: 5
18 |
19 | Switch {
20 | id: checkAgcEnable
21 | height: 30
22 | text: "AGC Enable"
23 | checked: (acq.cci.agcEnable == LEP_AGC_ENABLE_E.LEP_AGC_ENABLE)
24 | }
25 |
26 |
27 | Switch {
28 | id: checkAgcCalcEnable
29 | height: 30
30 | text: qsTr("AGC Calc Enable")
31 | checked: (acq.cci.agcCalcEnable == LEP_AGC_ENABLE_E.LEP_AGC_ENABLE)
32 | }
33 |
34 |
35 | Label {
36 | id: labelAgcPolicy
37 | height: comboAgcPolicy.height
38 | text: qsTr("Policy")
39 | verticalAlignment: Text.AlignVCenter
40 | }
41 |
42 | ComboBox {
43 | id: comboAgcPolicy
44 | width: parent.width - labelAgcPolicy.width - 5
45 | height: 30
46 |
47 | model: ListModel {
48 | ListElement { text: "Linear"; data: LEP_AGC_POLICY_E.LEP_AGC_LINEAR }
49 | ListElement { text: "Histogram Eql"; data: LEP_AGC_POLICY_E.LEP_AGC_HEQ }
50 | }
51 | textRole: qsTr("text")
52 |
53 | currentIndex: acq.cci.agcPolicy
54 | }
55 |
56 |
57 |
58 | SwipeView {
59 | id: swipeView
60 | currentIndex: comboAgcPolicy.currentIndex
61 | width: parent.width
62 | height: parent.height - y
63 | clip: true
64 |
65 | Pane {
66 | id: frameAgcLinear
67 | anchors.bottom: parent.bottom
68 | anchors.bottomMargin: 0
69 | anchors.left: parent.left
70 | anchors.leftMargin: 0
71 | anchors.top: parent.top
72 | anchors.topMargin: 0
73 |
74 | ValueSlider {
75 | id: linearHistogramTailSize
76 | anchors.right: parent.right
77 | anchors.rightMargin: 0
78 | anchors.left: parent.left
79 | anchors.leftMargin: 0
80 | anchors.top: parent.top
81 | anchors.topMargin: 0
82 | description: qsTr("Histogram tail size (pixels)")
83 | minimumValue: 0
84 | maximumValue: (80*60)
85 | model: acq.cci
86 | binding: "agcLinearHistogramTailSize"
87 | }
88 |
89 | ValueSlider {
90 | id: linearHistogramClipPercent
91 | anchors.right: parent.right
92 | anchors.rightMargin: 0
93 | anchors.left: parent.left
94 | anchors.leftMargin: 0
95 | anchors.top: linearHistogramTailSize.bottom
96 | anchors.topMargin: 0
97 | description: qsTr("Histogram Clip Percent")
98 | minimumValue: 0
99 | maximumValue: 100
100 | model: acq.cci
101 | binding: "agcLinearHistogramClipPercent"
102 | }
103 |
104 | ValueSlider {
105 | id: linearMaxGain
106 | anchors.right: parent.right
107 | anchors.rightMargin: 0
108 | anchors.left: parent.left
109 | anchors.leftMargin: 0
110 | anchors.top: linearHistogramClipPercent.bottom
111 | anchors.topMargin: 0
112 | description: qsTr("Max Gain")
113 | minimumValue: 1
114 | maximumValue: 4
115 | model: acq.cci
116 | binding: "agcLinearMaxGain"
117 | }
118 |
119 | ValueSlider {
120 | id: linearMidPoint
121 | anchors.right: parent.right
122 | anchors.rightMargin: 0
123 | anchors.left: parent.left
124 | anchors.leftMargin: 0
125 | anchors.top: linearMaxGain.bottom
126 | anchors.topMargin: 0
127 | description: qsTr("Midpoint")
128 | maximumValue: 254
129 | minimumValue: 1
130 | model: acq.cci
131 | binding: "agcLinearMidPoint"
132 | }
133 |
134 | ValueSlider {
135 | id: linearDampeningFactor
136 | anchors.right: parent.right
137 | anchors.rightMargin: 0
138 | anchors.left: parent.left
139 | anchors.leftMargin: 0
140 | anchors.top: linearMidPoint.bottom
141 | anchors.topMargin: 0
142 | description: qsTr("Dampening Factor")
143 | maximumValue: 100
144 | minimumValue: 0
145 | model: acq.cci
146 | binding: "agcLinearDampeningFactor"
147 | }
148 | }
149 |
150 | Flow {
151 | id: frameAgcHist
152 | anchors.bottom: parent.bottom
153 | anchors.bottomMargin: 0
154 | anchors.left: frameAgcLinear.right
155 | anchors.leftMargin: 0
156 | anchors.top: parent.top
157 | anchors.topMargin: 0
158 |
159 | ComboBox {
160 | id: comboAgcHeqScaleFactor
161 |
162 | model: ListModel {
163 | ListElement { text: "8-bits"; data: LEP_AGC_HEQ_SCALE_FACTOR_E.LEP_AGC_SCALE_TO_8_BITS }
164 | ListElement { text: "14-bits"; data: LEP_AGC_HEQ_SCALE_FACTOR_E.LEP_AGC_SCALE_TO_14_BITS }
165 | }
166 | textRole: qsTr("text")
167 |
168 | currentIndex: acq.cci.agcHeqScaleFactor
169 | }
170 |
171 | ValueSlider {
172 | id: agcHeqDampingFactor
173 | description: qsTr("Dampening Factor")
174 | maximumValue: 100
175 | minimumValue: 0
176 | model: acq.cci
177 | binding: "agcHeqDampingFactor"
178 | }
179 |
180 | ValueSlider {
181 | id: agcHeqMaxGain
182 | description: qsTr("Max Gain")
183 | maximumValue: 4
184 | minimumValue: 1
185 | model: acq.cci
186 | binding: "agcHeqMaxGain"
187 | }
188 |
189 | ValueSlider {
190 | id: agcHeqClipLimitHigh
191 | description: qsTr("Clip Limit High")
192 | maximumValue: (80*60)
193 | minimumValue: 0
194 | model: acq.cci
195 | binding: "agcHeqClipLimitHigh"
196 | }
197 |
198 | ValueSlider {
199 | id: agcHeqClipLimitLow
200 | description: qsTr("Clip Limit Low")
201 | maximumValue: (80*60)
202 | minimumValue: 0
203 | model: acq.cci
204 | binding: "agcHeqClipLimitLow"
205 | }
206 |
207 | ValueSlider {
208 | id: agcHeqBinExtension
209 | description: qsTr("Bin Extension")
210 | maximumValue: 16
211 | minimumValue: 0
212 | model: acq.cci
213 | binding: "agcHeqBinExtension"
214 | }
215 |
216 | ValueSlider {
217 | id: agcHeqMidPoint
218 | description: qsTr("Midpoint")
219 | maximumValue: 65534
220 | minimumValue: 127
221 | model: acq.cci
222 | binding: "agcHeqMidPoint"
223 | }
224 |
225 | ValueSlider {
226 | id: agcHeqEmptyCount
227 | description: qsTr("Empty Count")
228 | maximumValue: 65535
229 | minimumValue: 0
230 | model: acq.cci
231 | binding: "agcHeqEmptyCount"
232 | }
233 |
234 | ValueSlider {
235 | id: agcHeqNormalizationFactor
236 | description: qsTr("Normalization Factor")
237 | maximumValue: 65535
238 | minimumValue: 0
239 | model: acq.cci
240 | binding: "agcHeqNormalizationFactor"
241 | }
242 | }
243 | }
244 |
245 |
246 | }
247 |
248 | Binding {
249 | target: acq.cci
250 | property: "agcEnable"
251 | value: checkAgcEnable.checked ? LEP_AGC_ENABLE_E.LEP_AGC_ENABLE : LEP_AGC_ENABLE_E.LEP_AGC_DISABLE
252 | }
253 |
254 | Binding {
255 | target: acq.cci
256 | property: "agcPolicy"
257 | value: comboAgcPolicy.model.get(comboAgcPolicy.currentIndex).data
258 | }
259 |
260 | Binding {
261 | target: acq.cci
262 | property: "agcHeqScaleFactor"
263 | value: comboAgcHeqScaleFactor.model.get(comboAgcHeqScaleFactor.currentIndex).data
264 | }
265 | }
266 |
--------------------------------------------------------------------------------
/qml/lepton/InfoControls.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 |
5 | Item {
6 | id: root
7 | width: 200
8 | property UvcAcquisition acq: null
9 |
10 | GroupBox {
11 | id: groupBox1
12 | clip: true
13 |
14 | anchors.margins: 5
15 | anchors.top: parent.top
16 | anchors.right: parent.right
17 | anchors.left: parent.left
18 | title: qsTr("Lepton")
19 |
20 | Grid {
21 | id: grid
22 |
23 | columns: 1
24 | rows: 8
25 | anchors.fill: parent
26 | spacing: 10
27 | flow: Grid.TopToBottom
28 |
29 | Label {
30 | id: labelPartNumber
31 | text: qsTr("Part: ") + acq.cci.oemFlirPartNumber
32 | }
33 |
34 | Label {
35 | id: labelSerialNumber
36 | text: qsTr("Serial Number: ") + acq.cci.sysFlirSerialNumber
37 | }
38 |
39 | Label {
40 | id: labelGppSoftwareVers
41 | text: qsTr("GPP Version: ") + acq.cci.oemGppSoftwareVersion
42 | }
43 |
44 | Label {
45 | id: labelDspSoftwareVers
46 | text: qsTr("DSP Version: ") + acq.cci.oemDspSoftwareVersion
47 | }
48 |
49 | Label {
50 | id: labelPtFirwmareVers
51 | text: qsTr("PT1 FW Version: ") + acq.cci.ptFirmwareVersion
52 | }
53 | }
54 |
55 |
56 | }
57 |
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/qml/lepton/LeptonTabs.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 | import "qrc:/lepton"
5 |
6 | Page {
7 | id: root
8 | clip: true
9 |
10 | width: 220
11 | height: 480
12 |
13 | property UvcAcquisition acq: null
14 |
15 | header: TabBar {
16 | id: tabBar
17 | currentIndex: swipeView.currentIndex
18 | TabButton {
19 | text: qsTr("VID")
20 | }
21 | TabButton {
22 | text: qsTr("AGC")
23 | }
24 | TabButton {
25 | text: qsTr("Info")
26 | }
27 | }
28 |
29 | SwipeView {
30 | id: swipeView
31 | x: 0
32 | y: 40
33 | currentIndex: tabBar.currentIndex
34 | anchors.fill: parent
35 |
36 |
37 | VidControls {
38 | id: vidControls1
39 | anchors.left: parent.left
40 | anchors.bottom: parent.bottom
41 | anchors.top: parent.top
42 | acq: root.acq
43 | }
44 |
45 | AgcControls {
46 | id: agcControls1
47 | anchors.bottom: parent.bottom
48 | anchors.left: vidControls1.right
49 | anchors.top: parent.top
50 | acq: root.acq
51 | }
52 |
53 |
54 | InfoControls {
55 | id: leptonControls1
56 | anchors.bottom: parent.bottom
57 | anchors.left: agcControls1.right
58 | anchors.top: parent.top
59 | acq: root.acq
60 | }
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/qml/lepton/VidControls.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Controls 2.0
3 | import GetThermal 1.0
4 |
5 | Item {
6 | id: root
7 | width: 200
8 | property UvcAcquisition acq: null
9 | anchors.margins: 5
10 |
11 | Flow {
12 | id: flow1
13 | spacing: 5
14 | anchors.fill: parent
15 | anchors.margins: 5
16 |
17 | Label {
18 | id: labelPcolor
19 | width: parent.width
20 | text: qsTr("Pseudo-Color Palette:")
21 | }
22 |
23 | ComboBox {
24 | id: comboVidPcolorLut
25 | width: parent.width
26 | visible: acq.cci.supportsHwPseudoColor && !acq.cci.supportsRadiometry
27 |
28 | model: ListModel {
29 | ListElement { text: "Wheel"; data: LEP_PCOLOR_LUT_E.LEP_VID_WHEEL6_LUT }
30 | ListElement { text: "Fusion"; data: LEP_PCOLOR_LUT_E.LEP_VID_FUSION_LUT }
31 | ListElement { text: "Rainbow"; data: LEP_PCOLOR_LUT_E.LEP_VID_RAINBOW_LUT }
32 | ListElement { text: "Glowbow"; data: LEP_PCOLOR_LUT_E.LEP_VID_GLOBOW_LUT }
33 | ListElement { text: "Sepia"; data: LEP_PCOLOR_LUT_E.LEP_VID_SEPIA_LUT }
34 | ListElement { text: "Color"; data: LEP_PCOLOR_LUT_E.LEP_VID_COLOR_LUT }
35 | ListElement { text: "Ice & Fire"; data: LEP_PCOLOR_LUT_E.LEP_VID_ICE_FIRE_LUT }
36 | ListElement { text: "Rain"; data: LEP_PCOLOR_LUT_E.LEP_VID_RAIN_LUT }
37 | ListElement { text: "User"; data: LEP_PCOLOR_LUT_E.LEP_VID_USER_LUT }
38 | }
39 | textRole: qsTr("text")
40 |
41 | currentIndex: acq.cci.vidPcolorLut
42 | }
43 |
44 | ComboBox {
45 | id: comboSwPcolorLut
46 | width: parent.width
47 | visible: !acq.cci.supportsHwPseudoColor || acq.cci.supportsRadiometry
48 |
49 | model: ListModel {
50 | ListElement { text: "Iron Black"; data: DataFormatter.IronBlack }
51 | ListElement { text: "Rainbow"; data: DataFormatter.Rainbow }
52 | ListElement { text: "Grayscale"; data: DataFormatter.Grayscale }
53 | }
54 | textRole: qsTr("text")
55 |
56 | currentIndex: acq.dataFormatter.pseudocolorPalette
57 | }
58 |
59 | Label {
60 | id: labelRadGain
61 | width: parent.width
62 | visible: acq.cci.supportsRadiometry
63 | text: qsTr("Radiometry TLinear Resolution:")
64 | }
65 |
66 | ComboBox {
67 | id: comboRadTLinearResolution
68 | width: parent.width
69 | visible: acq.cci.supportsRadiometry
70 |
71 | model: ListModel {
72 | ListElement { text: "Low (0.1K)"; data: LEP_RAD_TLINEAR_RESOLUTION_E.LEP_RAD_RESOLUTION_0_1 }
73 | ListElement { text: "High (0.01K)"; data: LEP_RAD_TLINEAR_RESOLUTION_E.LEP_RAD_RESOLUTION_0_01 }
74 | }
75 | textRole: qsTr("text")
76 |
77 | currentIndex: acq.cci.radTLinearResolution
78 | }
79 |
80 | Label {
81 | id: labelGainMode
82 | width: parent.width
83 | text: qsTr("Gain state:")
84 | }
85 |
86 | ComboBox {
87 | id: comboSysGainMode
88 | width: parent.width
89 |
90 | model: ListModel {
91 | ListElement { text: "High"; data: LEP_SYS_GAIN_MODE_E.LEP_SYS_GAIN_MODE_HIGH }
92 | ListElement { text: "Low"; data: LEP_SYS_GAIN_MODE_E.LEP_SYS_GAIN_MODE_LOW }
93 | ListElement { text: "Auto"; data: LEP_SYS_GAIN_MODE_E.LEP_SYS_GAIN_MODE_AUTO }
94 | }
95 | textRole: qsTr("text")
96 |
97 | currentIndex: acq.cci.sysGainMode
98 | }
99 |
100 | Switch {
101 | id: switchSbNuc
102 | text: qsTr("Scene-based NUC")
103 | width: parent.width
104 | checked: (acq.cci.vidSbNucEnableState == LEP_VID_SBNUC_ENABLE_E.LEP_VID_SBNUC_ENABLE)
105 | }
106 |
107 | Button {
108 | id: buttonFfc
109 | text: qsTr("Perform FFC")
110 | }
111 |
112 | BusyIndicator {
113 | id: busyFfc
114 | height: buttonFfc.height
115 | anchors.verticalCenter: buttonFfc.verticalCenter
116 | anchors.horizontalCenter: buttonFfc.horizontalCenter
117 | visible: false
118 | width: height
119 | }
120 | }
121 |
122 | Binding {
123 | target: acq.cci
124 | property: "vidPcolorLut"
125 | value: comboVidPcolorLut.model.get(comboVidPcolorLut.currentIndex).data
126 | }
127 |
128 | Binding {
129 | target: acq.dataFormatter
130 | property: "pseudocolorPalette"
131 | value: comboSwPcolorLut.model.get(comboSwPcolorLut.currentIndex).data
132 | }
133 |
134 | Binding {
135 | target: acq.cci
136 | property: "vidSbNucEnableState"
137 | value: switchSbNuc.checked ? LEP_VID_SBNUC_ENABLE_E.LEP_VID_SBNUC_ENABLE : LEP_VID_SBNUC_ENABLE_E.LEP_VID_SBNUC_DISABLE
138 | }
139 |
140 | Binding {
141 | target: acq.cci
142 | property: "radTLinearResolution"
143 | value: comboRadTLinearResolution.model.get(comboRadTLinearResolution.currentIndex).data
144 | }
145 |
146 | Binding {
147 | target: acq.cci
148 | property: "sysGainMode"
149 | value: comboSysGainMode.model.get(comboSysGainMode.currentIndex).data
150 | }
151 |
152 | function delay(delayTime, cb) {
153 | function Timer() {
154 | return Qt.createQmlObject("import QtQuick 2.0; Timer {}", root);
155 | }
156 | var timer = new Timer();
157 | timer.interval = delayTime;
158 | timer.repeat = false;
159 | timer.triggered.connect(cb);
160 | timer.start();
161 | }
162 |
163 | Connections {
164 | target: buttonFfc
165 | onClicked: {
166 | busyFfc.visible = true;
167 | acq.pauseStream();
168 | delay(150, function(){
169 | acq.cci.performFfc();
170 | delay(1500, function() {
171 | acq.resumeStream();
172 | busyFfc.visible = false;
173 | });
174 | });
175 | }
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/qml/main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.7
2 | import QtQuick.Controls 2.0
3 | import QtQuick.Layouts 1.0
4 |
5 | ApplicationWindow {
6 | visible: true
7 | width: 960
8 | height: 540
9 | title: qsTr("GetThermal")
10 |
11 | Viewer {
12 | anchors.fill: parent
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/qml/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | Viewer.qml
5 | ViewerForm.ui.qml
6 | qtquickcontrols2.conf
7 | boson/BosonTabs.qml
8 | boson/InfoControls.qml
9 | controls/CameraControls.qml
10 | controls/RangeDisplay.qml
11 | controls/ValueSlider.qml
12 | lepton/AgcControls.qml
13 | lepton/InfoControls.qml
14 | lepton/LeptonTabs.qml
15 | lepton/VidControls.qml
16 | boson/VidControls.qml
17 | controls/SpotInfo.qml
18 | controls/VideoRoi.qml
19 |
20 |
21 | images/brand-logo.png
22 |
23 |
24 |
--------------------------------------------------------------------------------
/qml/qtquickcontrols2.conf:
--------------------------------------------------------------------------------
1 | [Controls]
2 | Style=Material
3 |
4 | [Universal]
5 | Theme=Light
6 | Accent=Blue
7 |
8 | [Material]
9 | Theme=Light
10 | Accent=Blue
11 |
--------------------------------------------------------------------------------
/setup.pri:
--------------------------------------------------------------------------------
1 | # -------------------------------------------------
2 | # QGroundControl - Micro Air Vehicle Groundstation
3 | # Please see our website at
4 | # Maintainer:
5 | # Lorenz Meier
6 | # (c) 2009-2011 QGroundControl Developers
7 | # License terms set in COPYING.md
8 | # -------------------------------------------------
9 |
10 | QMAKE_POST_LINK += echo "Copying files"
11 |
12 | #
13 | # Copy the application resources to the associated place alongside the application
14 | #
15 |
16 | LinuxBuild {
17 | DESTDIR_COPY_RESOURCE_LIST = $$DESTDIR
18 | }
19 |
20 | MacBuild {
21 | DESTDIR_COPY_RESOURCE_LIST = $$DESTDIR/$${TARGET}.app/Contents/MacOS
22 | }
23 |
24 | #
25 | # Perform platform specific setup
26 | #
27 |
28 | iOSBuild | MacBuild {
29 | # Update version info in bundle
30 | QMAKE_POST_LINK += && /usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $${MAC_VERSION}\" $$DESTDIR/$${TARGET}.app/Contents/Info.plist
31 | QMAKE_POST_LINK += && /usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $${MAC_BUILD}\" $$DESTDIR/$${TARGET}.app/Contents/Info.plist
32 | }
33 |
34 | MacBuild {
35 | # Copy non-standard frameworks into app package
36 | QMAKE_POST_LINK += && rsync -a --delete $$BASEDIR/libuvc/build/*.dylib $$DESTDIR/$${TARGET}.app/Contents/
37 | }
38 |
39 | WindowsBuild {
40 | BASEDIR_WIN = $$replace(BASEDIR, "/", "\\")
41 | DESTDIR_WIN = $$replace(DESTDIR, "/", "\\")
42 | QT_BIN_DIR = $$dirname(QMAKE_QMAKE)
43 |
44 | # Copy dependencies
45 | DebugBuild: DLL_QT_DEBUGCHAR = "d"
46 | ReleaseBuild: DLL_QT_DEBUGCHAR = ""
47 | COPY_FILE_LIST = \
48 | $$BASEDIR\\libs\\lib\\sdl2\\msvc\\lib\\x86\\SDL2.dll \
49 | $$BASEDIR\\libs\\thirdParty\\libxbee\\lib\\libxbee.dll \
50 | $$BASEDIR\\deploy\\libeay32.dll
51 |
52 | for(COPY_FILE, COPY_FILE_LIST) {
53 | QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"$$COPY_FILE\" \"$$DESTDIR_WIN\"
54 | }
55 |
56 | ReleaseBuild {
57 | # Copy Visual Studio DLLs
58 | # Note that this is only done for release because the debugging versions of these DLLs cannot be redistributed.
59 | win32-msvc2010 {
60 | QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp100.dll\" \"$$DESTDIR_WIN\"
61 | QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr100.dll\" \"$$DESTDIR_WIN\"
62 | }
63 | else:win32-msvc2012 {
64 | QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp110.dll\" \"$$DESTDIR_WIN\"
65 | QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr110.dll\" \"$$DESTDIR_WIN\"
66 | }
67 | else:win32-msvc2013 {
68 | QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcp120.dll\" \"$$DESTDIR_WIN\"
69 | QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY \"C:\\Windows\\System32\\msvcr120.dll\" \"$$DESTDIR_WIN\"
70 | }
71 | else {
72 | error("Visual studio version not supported, installation cannot be completed.")
73 | }
74 | }
75 |
76 | DEPLOY_TARGET = $$shell_quote($$shell_path($$DESTDIR_WIN\\$${TARGET}.exe))
77 | QMAKE_POST_LINK += $$escape_expand(\\n) $$QT_BIN_DIR\\windeployqt --no-compiler-runtime --qmldir=$${BASEDIR_WIN}\\src $${DEPLOY_TARGET}
78 |
79 | }
80 |
81 | LinuxBuild {
82 | installer {
83 | QMAKE_POST_LINK += && mkdir -p $$DESTDIR/Qt/libs && mkdir -p $$DESTDIR/Qt/plugins
84 |
85 | # QT_INSTALL_LIBS
86 | QT_LIB_LIST = \
87 | libQt5Core.so.5 \
88 | libQt5DBus.so.5 \
89 | libQt5Gui.so.5 \
90 | libQt5Multimedia.so.5 \
91 | libQt5MultimediaQuick_p.so.5 \
92 | libQt5OpenGL.so.5 \
93 | libQt5Qml.so.5 \
94 | libQt5Quick.so.5 \
95 | libQt5QuickControls2.so.5 \
96 | libQt5QuickTemplates2.so.5 \
97 | libQt5QuickWidgets.so.5 \
98 | libQt5XcbQpa.so.5
99 |
100 | for(QT_LIB, QT_LIB_LIST) {
101 | QMAKE_POST_LINK += && $$QMAKE_COPY --dereference $$[QT_INSTALL_LIBS]/$$QT_LIB $$DESTDIR/Qt/libs/
102 | }
103 |
104 | # QT_INSTALL_PLUGINS
105 | QT_PLUGIN_LIST = \
106 | bearer \
107 | imageformats \
108 | platforminputcontexts \
109 | platforms
110 |
111 | !contains(DEFINES, __rasp_pi2__) {
112 | QT_PLUGIN_LIST += xcbglintegrations
113 | }
114 |
115 | for(QT_PLUGIN, QT_PLUGIN_LIST) {
116 | QMAKE_POST_LINK += && $$QMAKE_COPY --dereference --recursive $$[QT_INSTALL_PLUGINS]/$$QT_PLUGIN $$DESTDIR/Qt/plugins/
117 | }
118 |
119 | # QT_INSTALL_QML
120 | QMAKE_POST_LINK += && $$QMAKE_COPY --dereference --recursive $$[QT_INSTALL_QML] $$DESTDIR/Qt/
121 |
122 | # GetThermal start script
123 | QMAKE_POST_LINK += && $$QMAKE_COPY $$BASEDIR/deploy/getthermal-start.sh $$DESTDIR
124 | QMAKE_POST_LINK += && $$QMAKE_COPY $$BASEDIR/deploy/getthermal.desktop $$DESTDIR
125 | QMAKE_POST_LINK += && $$QMAKE_COPY $$BASEDIR/icons/getthermal.png $$DESTDIR
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/src/abstractccinterface.cpp:
--------------------------------------------------------------------------------
1 | #include "abstractccinterface.h"
2 |
3 | AbstractCCInterface::AbstractCCInterface(QObject *parent)
4 | : QObject(parent)
5 | {
6 |
7 | }
8 |
9 | AbstractCCInterface::AbstractCCInterface(const AbstractCCInterface &intf)
10 | : QObject(intf.parent())
11 | {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/bosonvariation.cpp:
--------------------------------------------------------------------------------
1 | #include "bosonvariation.h"
2 |
3 | extern "C" {
4 | #include "boson_sdk/Client_API.h"
5 | #include "boson_sdk/EnumTypes.h"
6 | #include "boson_sdk/UART_Connector.h"
7 | int boson_example();
8 | }
9 |
10 | #define QML_REGISTER_ENUM(name) \
11 | qmlRegisterUncreatableType("GetThermal", 1,0, "FLR_" #name, "You can't create enumeration " #name); \
12 | qRegisterMetaType("FLR_" #name);
13 |
14 | void registerBosonVariationQmlTypes()
15 | {
16 | QML_REGISTER_ENUM(COLORLUT_ID_E)
17 | }
18 |
19 | BosonVariation::BosonVariation(uvc_context_t *ctx,
20 | uvc_device_t *dev,
21 | uvc_device_handle_t *devh)
22 | : ctx(ctx)
23 | , dev(dev)
24 | , devh(devh)
25 | , usb_devh(uvc_get_libusb_handle(devh))
26 | {
27 | printf("Initializing Boson with UVC backend...\n");
28 |
29 | uvc_get_device_descriptor(dev, &desc);
30 | printf("Using %s %s with firmware %s\n", desc->manufacturer, desc->product, desc->serialNumber);
31 |
32 | FLR_RESULT result;
33 |
34 | result = Initialize(usb_devh);
35 | printf("Initialize: 0x%08X\n", result);
36 | if (result)
37 | {
38 | printf("Failed to initialize CCI interface\n");
39 | }
40 |
41 | this->setObjectName("BosonVariation");
42 | }
43 |
44 | BosonVariation::~BosonVariation()
45 | {
46 | printf("\n\nClosing...\n");
47 | Close();
48 |
49 | uvc_free_device_descriptor(desc);
50 | }
51 |
52 | const AbstractCCInterface& BosonVariation::operator =(const AbstractCCInterface&)
53 | {
54 | return BosonVariation(ctx, dev, devh);
55 | }
56 |
57 | const QString BosonVariation::getCameraPartNumber()
58 | {
59 | FLR_BOSON_PARTNUMBER_T pn;
60 | bosonGetCameraPN(&pn);
61 | return QString::fromLatin1((char*)pn.value, sizeof(pn.value));
62 | }
63 |
64 | const QString BosonVariation::getCameraSerialNumber()
65 | {
66 | uint32_t sn;
67 | bosonGetCameraSN(&sn);
68 | return QString::asprintf("%d", sn);
69 | }
70 |
71 | const QString BosonVariation::getSensorPartNumber()
72 | {
73 |
74 | FLR_BOSON_SENSOR_PARTNUMBER_T pn;
75 | bosonGetSensorPN(&pn);
76 | return QString::fromLatin1((char*)pn.value, sizeof(pn.value));
77 | }
78 |
79 | const QString BosonVariation::getSensorSerialNumber()
80 | {
81 | uint32_t sn;
82 | bosonGetSensorSN(&sn);
83 | return QString::asprintf("%d", sn);
84 | }
85 |
86 | const QString BosonVariation::getSoftwareRev()
87 | {
88 | uint32_t maj, min, rev;
89 | bosonGetSoftwareRev(&maj, &min, &rev);
90 | return QString::asprintf("%d.%d.%d", maj, min, rev);
91 | }
92 |
93 |
94 | bool BosonVariation::getSupportsHwPseudoColor() const
95 | {
96 | return true;
97 | }
98 |
99 | bool BosonVariation::getSupportsRadiometry()
100 | {
101 | return false;
102 | }
103 |
104 | const QVideoSurfaceFormat BosonVariation::getDefaultFormat()
105 | {
106 | return QVideoSurfaceFormat(QSize(640,512), QVideoFrame::Format_YUV420P);
107 | }
108 |
109 | float BosonVariation::getCameraInternalTempC()
110 | {
111 | int16_t temp_c_x10;
112 | bosonlookupFPATempDegCx10(&temp_c_x10);
113 | return (float)temp_c_x10 / 10.0f;
114 | }
115 |
116 | void BosonVariation::performFfc()
117 | {
118 | FLR_RESULT result = bosonRunFFC();
119 | printf("RunFFC: 0x%08X \n", result);
120 | }
121 |
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include "uvcvideoproducer.h"
8 | #include "uvcacquisition.h"
9 | #include "bosonvariation.h"
10 | #include "leptonvariation.h"
11 | #include "dataformatter.h"
12 | #include "rangeprovider.h"
13 |
14 | int main(int argc, char *argv[])
15 | {
16 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
17 | QGuiApplication app(argc, argv);
18 |
19 | qmlRegisterType("GetThermal", 1,0, "UvcVideoProducer");
20 | qmlRegisterType("GetThermal", 1,0, "UvcAcquisition");
21 | qmlRegisterUncreatableType("GetThermal", 1,0, "BosonVariation", "");
22 | qmlRegisterUncreatableType("GetThermal", 1,0, "LeptonVariation", "");
23 | qmlRegisterUncreatableType("GetThermal", 1,0, "AbstractCCInterface", "");
24 | qmlRegisterUncreatableType("GetThermal", 1,0, "DataFormatter", "");
25 |
26 | registerLeptonVariationQmlTypes();
27 | registerBosonVariationQmlTypes();
28 |
29 | QQmlApplicationEngine engine;
30 | engine.addImageProvider(QLatin1String("palettes"), new RangeProvider);
31 | engine.load(QUrl(QLatin1String("qrc:/main.qml")));
32 |
33 | return app.exec();
34 | }
35 |
--------------------------------------------------------------------------------
/src/rangeprovider.cpp:
--------------------------------------------------------------------------------
1 | #include "rangeprovider.h"
2 |
3 | #include
4 |
5 | RangeProvider::RangeProvider()
6 | : QQuickImageProvider(QQuickImageProvider::Pixmap)
7 | {
8 | }
9 |
10 | QPixmap RangeProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
11 | {
12 | int width = 1;
13 | int height = 255;
14 |
15 | DataFormatter::Palette e_palette = (DataFormatter::Palette)id.toUInt();
16 | const colormap_t* colormap = DataFormatter::getPalette(e_palette);
17 |
18 | width = requestedSize.width() > 0 ? requestedSize.width() : width;
19 | height = requestedSize.height() > 0 ? requestedSize.height() : height;
20 |
21 | if (size)
22 | *size = QSize(width, height);
23 |
24 | if (m_pixmap.size() != *size)
25 | {
26 | m_pixmap = QPixmap(width, height);
27 | }
28 |
29 | QPainter painter(&m_pixmap);
30 |
31 | for (int i = 0; i < m_pixmap.height(); i++)
32 | {
33 | const uint8_t *rgb = &colormap->colormap[i * 3];
34 | painter.setPen(QColor(rgb[0], rgb[1], rgb[2]));
35 | painter.drawPoint(0, m_pixmap.height() - i - 1);
36 | }
37 |
38 | return m_pixmap;
39 | }
40 |
--------------------------------------------------------------------------------
/src/uvcacquisition.cpp:
--------------------------------------------------------------------------------
1 | #include "uvcacquisition.h"
2 | #include "uvcbuffer.h"
3 | #include
4 | #include
5 |
6 | #include "leptonvariation.h"
7 | #include "bosonvariation.h"
8 | #include "dataformatter.h"
9 |
10 | //#define PLANAR_BUFFER 1
11 | //#define ACQ_RGB 1
12 | #define ACQ_Y16 1
13 |
14 | #define PT1_VID 0x1e4e
15 | #define PT1_PID 0x0100
16 | #define FLIR_VID 0x09cb
17 |
18 | UvcAcquisition::UvcAcquisition(QObject *parent)
19 | : QObject(parent)
20 | , ctx(NULL)
21 | , dev(NULL)
22 | , devh(NULL)
23 | , m_cci(NULL)
24 | {
25 | _ids.append({ PT1_VID, PT1_PID });
26 | _ids.append({ FLIR_VID, 0x0000 }); // any flir camera
27 | init();
28 | }
29 |
30 | UvcAcquisition::UvcAcquisition(QList ids)
31 | : ctx(NULL)
32 | , dev(NULL)
33 | , devh(NULL)
34 | , m_cci(NULL)
35 | , _ids(ids)
36 | {
37 | init();
38 | }
39 |
40 | UvcAcquisition::~UvcAcquisition()
41 | {
42 | if (m_cci != NULL)
43 | {
44 | delete m_cci;
45 | }
46 |
47 | if (devh != NULL)
48 | {
49 | uvc_stop_streaming(devh);
50 | puts("Done streaming.");
51 |
52 | /* Release our handle on the device */
53 | uvc_close(devh);
54 | puts("Device closed");
55 | }
56 |
57 | if (dev != NULL)
58 | {
59 | /* Release the device descriptor */
60 | uvc_unref_device(dev);
61 | }
62 |
63 | if (ctx != NULL)
64 | {
65 | /* Close the UVC context. This closes and cleans up any existing device handles,
66 | * and it closes the libusb context if one was not provided. */
67 | uvc_exit(ctx);
68 | puts("UVC exited");
69 | }
70 | }
71 |
72 | void UvcAcquisition::init()
73 | {
74 | uvc_error_t res;
75 |
76 | /* Initialize a UVC service context. Libuvc will set up its own libusb
77 | * context. Replace NULL with a libusb_context pointer to run libuvc
78 | * from an existing libusb context. */
79 | res = uvc_init(&ctx, NULL);
80 |
81 | if (res < 0) {
82 | uvc_perror(res, "uvc_init");
83 | return;
84 | }
85 |
86 | puts("UVC initialized");
87 |
88 | /* Locates the first attached UVC device, stores in dev */
89 | for (int i = 0; i < _ids.size(); ++i) {
90 | res = uvc_find_device(ctx, &dev, _ids[i].vid, _ids[i].pid, NULL);
91 | if (res >= 0)
92 | break;
93 | }
94 |
95 | if (res < 0) {
96 | uvc_perror(res, "uvc_find_device"); /* no devices found */
97 | return;
98 | }
99 |
100 | puts("Device found");
101 |
102 | /* Try to open the device: requires exclusive access */
103 | res = uvc_open(dev, &devh);
104 |
105 | if (res < 0) {
106 | uvc_perror(res, "uvc_open"); /* unable to open device */
107 |
108 | /* Release the device descriptor */
109 | uvc_unref_device(dev);
110 | dev = NULL;
111 | return;
112 | }
113 |
114 | puts("Device opened");
115 |
116 | /* Print out a message containing all the information that libuvc
117 | * knows about the device */
118 | uvc_print_diag(devh, stderr);
119 |
120 | uvc_device_descriptor_t *desc;
121 | uvc_get_device_descriptor(dev, &desc);
122 |
123 | switch (desc->idVendor)
124 | {
125 | case PT1_VID:
126 | m_cci = new LeptonVariation(ctx, dev, devh);
127 | break;
128 | case FLIR_VID:
129 | m_cci = new BosonVariation(ctx, dev, devh);
130 | break;
131 | default:
132 | break;
133 | }
134 |
135 | uvc_free_device_descriptor(desc);
136 |
137 | if (m_cci != NULL)
138 | {
139 | setVideoFormat(m_cci->getDefaultFormat());
140 | }
141 | }
142 |
143 | void UvcAcquisition::setVideoFormat(const QVideoSurfaceFormat &format)
144 | {
145 | uvc_error_t res;
146 | enum uvc_frame_format uvcFormat;
147 |
148 | uvc_stop_streaming(devh);
149 |
150 | switch(format.pixelFormat())
151 | {
152 | case QVideoFrame::Format_YUV420P:
153 | uvcFormat = UVC_FRAME_FORMAT_I420;
154 | break;
155 | case QVideoFrame::Format_RGB24:
156 | uvcFormat = UVC_FRAME_FORMAT_RGB;
157 | break;
158 | case QVideoFrame::Format_Y16:
159 | uvcFormat = UVC_FRAME_FORMAT_Y16;
160 | break;
161 | default:
162 | uvcFormat = UVC_FRAME_FORMAT_UNKNOWN;
163 | break;
164 | }
165 |
166 | res = uvc_get_stream_ctrl_format_size(
167 | devh, &ctrl, /* result stored in ctrl */
168 | uvcFormat,
169 | format.frameWidth(), format.frameHeight(), 0);
170 |
171 | /* Print out the result */
172 | uvc_print_stream_ctrl(&ctrl, stderr);
173 |
174 | if (res < 0) {
175 | uvc_perror(res, "get_mode"); /* device doesn't provide a matching stream */
176 | return;
177 | }
178 |
179 | m_uvc_format = format;
180 |
181 | switch(format.pixelFormat())
182 | {
183 | case QVideoFrame::Format_YUV420P:
184 | m_format = QVideoSurfaceFormat(format.frameSize(), format.pixelFormat());
185 | break;
186 | case QVideoFrame::Format_RGB24:
187 | m_format = QVideoSurfaceFormat(format.frameSize(), QVideoFrame::Format_RGB32);
188 | break;
189 | case QVideoFrame::Format_Y16:
190 | m_format = QVideoSurfaceFormat(format.frameSize(), QVideoFrame::Format_RGB32);
191 | break;
192 | case QVideoFrame::Format_YV12:
193 | m_format = QVideoSurfaceFormat(format.frameSize(), format.pixelFormat());
194 | break;
195 | default:
196 | m_format = QVideoSurfaceFormat(format.frameSize(), QVideoFrame::Format_Invalid);
197 | break;
198 | }
199 |
200 | // Notify connections of format change
201 | emit formatChanged(m_format);
202 | emit videoSizeChanged(m_format.frameSize());
203 |
204 | /* Start the video stream. The library will call user function cb:
205 | * cb(frame, (void*) 12345)
206 | */
207 | res = uvc_start_streaming(devh, &ctrl, UvcAcquisition::cb, this, 0);
208 |
209 | if (res < 0) {
210 | uvc_perror(res, "start_streaming"); /* unable to start stream */
211 | uvc_close(devh);
212 | puts("Device closed");
213 |
214 | return;
215 | }
216 |
217 | puts("Streaming...");
218 | }
219 |
220 | /* This callback function runs once per frame. Use it to perform any
221 | * quick processing you need, or have it put the frame into your application's
222 | * input queue. If this function takes too long, you'll start losing frames. */
223 | void UvcAcquisition::cb(uvc_frame_t *frame, void *ptr) {
224 |
225 | UvcAcquisition *_this = static_cast(ptr);
226 |
227 | Q_ASSERT((int)frame->width == _this->m_format.frameWidth());
228 | Q_ASSERT((int)frame->height == _this->m_format.frameHeight());
229 |
230 | // QImage image((uchar*)frame->data, frame->width, frame->height, QImage::Format_RGB888);
231 | // QImage image("/Users/kurt/Desktop/uvc.png");
232 | // QVideoFrame qframe(image.convertToFormat(QImage::Format_ARGB32));
233 |
234 | // Need to reshape UVC input
235 | if (_this->m_uvc_format.pixelFormat() != _this->m_format.pixelFormat())
236 | {
237 | // we don't have a reason to handle frame buffers other than RGBA for now
238 | Q_ASSERT(_this->m_format.pixelFormat() == QVideoFrame::Format_RGB32);
239 |
240 | QVideoFrame qframe(_this->m_format.frameWidth() * _this->m_format.frameHeight() * 4,
241 | _this->m_format.frameSize(),
242 | _this->m_format.frameWidth() * 4,
243 | _this->m_format.pixelFormat());
244 |
245 | if (_this->m_uvc_format.pixelFormat() == QVideoFrame::Format_Y16)
246 | {
247 | _this->m_df.AutoGain(frame);
248 | _this->m_df.Colorize(frame, qframe);
249 | }
250 | else if (_this->m_uvc_format.pixelFormat() == QVideoFrame::Format_RGB24)
251 | {
252 | qframe.map(QAbstractVideoBuffer::WriteOnly);
253 | for (int i = 0; i < qframe.height(); i++)
254 | {
255 | uchar* rgb_line = &((uchar*)frame->data)[frame->step * i];
256 | uchar* rgba_line = &qframe.bits()[qframe.bytesPerLine() * i];
257 |
258 | for (int j = 0; j < qframe.width(); j++)
259 | {
260 | rgba_line[j * 4 + 0] = rgb_line[j * 3 + 0];
261 | rgba_line[j * 4 + 1] = rgb_line[j * 3 + 1];
262 | rgba_line[j * 4 + 2] = rgb_line[j * 3 + 2];
263 | rgba_line[j * 4 + 3] = 0;
264 | }
265 | }
266 | qframe.unmap();
267 | }
268 | _this->emitFrameReady(qframe);
269 | }
270 | else
271 | {
272 | UvcBuffer *buffer = new UvcBuffer();
273 | buffer->setBackendBuffer((uchar*)frame->data, frame->width, frame->height, frame->step, frame->data_bytes);
274 | QVideoFrame qframe(buffer, _this->m_format.frameSize(), _this->m_format.pixelFormat());
275 | _this->emitFrameReady(qframe);
276 | }
277 | }
278 |
279 | void UvcAcquisition::emitFrameReady(const QVideoFrame &frame)
280 | {
281 | emit frameReady(frame);
282 | }
283 |
284 | void UvcAcquisition::pauseStream() {
285 | uvc_stop_streaming(devh);
286 | }
287 |
288 | void UvcAcquisition::resumeStream() {
289 | uvc_error_t res = uvc_start_streaming(devh, &ctrl, UvcAcquisition::cb, this, 0);
290 |
291 | if (res < 0) {
292 | uvc_perror(res, "start_streaming"); /* unable to start stream */
293 | uvc_close(devh);
294 | puts("Device closed");
295 |
296 | return;
297 | }
298 | }
299 |
--------------------------------------------------------------------------------
/src/uvcbuffer.cpp:
--------------------------------------------------------------------------------
1 | #include "uvcbuffer.h"
2 |
3 | UvcBuffer::UvcBuffer(HandleType type)
4 | : QAbstractVideoBuffer(type)
5 | {
6 | }
7 |
8 | UvcBuffer::~UvcBuffer()
9 | {
10 | }
11 |
12 | uchar* UvcBuffer::map(MapMode mode, int* numBytes, int* bytesPerLine)
13 | {
14 | if (numBytes != NULL)
15 | *numBytes = _numBytes;
16 |
17 | if (bytesPerLine != NULL)
18 | *bytesPerLine = _stride;
19 |
20 | return (uchar*)_backendBuffer;
21 | }
22 |
23 | QAbstractVideoBuffer::MapMode UvcBuffer::mapMode() const
24 | {
25 | return ReadOnly;
26 | }
27 |
28 | void UvcBuffer::unmap()
29 | {
30 | }
31 |
32 | void UvcBuffer::setBackendBuffer(uchar* buffer, int width, int height, int stride, int numBytes)
33 | {
34 | _backendBuffer = buffer;
35 | _width = width;
36 | _height = height;
37 | _stride = stride;
38 | _numBytes = numBytes;
39 | }
40 |
41 | UvcPlanarBuffer::UvcPlanarBuffer(HandleType type)
42 | : QAbstractPlanarVideoBuffer(type)
43 | {
44 | }
45 |
46 | UvcPlanarBuffer::~UvcPlanarBuffer()
47 | {
48 | }
49 |
50 | int UvcPlanarBuffer::map(MapMode mode, int *numBytes, int bytesPerLine[4], uchar *data[4])
51 | {
52 | if (numBytes != NULL)
53 | *numBytes = _numBytes;
54 |
55 | if (bytesPerLine != NULL)
56 | memcpy(bytesPerLine, _stride, _planes * sizeof(int));
57 |
58 | if (data != NULL)
59 | memcpy(data, _backendBuffer, _planes * sizeof(int));
60 |
61 | return _planes;
62 | }
63 |
64 | QAbstractVideoBuffer::MapMode UvcPlanarBuffer::mapMode() const
65 | {
66 | return ReadOnly;
67 | }
68 |
69 | void UvcPlanarBuffer::unmap()
70 | {
71 | }
72 |
73 | void UvcPlanarBuffer::setBackendBuffer(uchar* buffer, int width[], int height[], int stride[], int planes)
74 | {
75 | int numBytes = 0;
76 | for (int i = 0; i < planes; i++)
77 | {
78 | _backendBuffer[i] = buffer;
79 | for (int j = 0; j < i; j++)
80 | {
81 | _backendBuffer[i] += _stride[j] * _height[j];
82 | }
83 | _width[i] = width[i];
84 | _height[i] = height[i];
85 | _stride[i] = stride[i];
86 | numBytes += _stride[i] * _height[i];
87 | }
88 | _planes = planes;
89 | _numBytes = numBytes;
90 | }
91 |
--------------------------------------------------------------------------------
/src/uvcvideoproducer.cpp:
--------------------------------------------------------------------------------
1 | #include "uvcvideoproducer.h"
2 | #include "uvcacquisition.h"
3 |
4 | UvcVideoProducer::UvcVideoProducer(QObject *parent)
5 | : QObject(parent)
6 | , m_surface(NULL)
7 | , m_uvc(NULL)
8 | {
9 | }
10 |
11 | void UvcVideoProducer::setVideoSurface(QAbstractVideoSurface *surface)
12 | {
13 | if (m_surface != surface && m_surface && m_surface->isActive()) {
14 | m_surface->stop();
15 | }
16 |
17 | m_surface = surface;
18 | printf("Surface set. Supported formats:");
19 | QList formats = surface->supportedPixelFormats();
20 | for (int i = 0; i < formats.length(); i++)
21 | printf(" %d", formats[i]);
22 | printf("\n");
23 | fflush(stdout);
24 |
25 | if (m_uvc)
26 | m_surface->start(m_uvc->videoFormat());
27 |
28 | emit surfaceChanged(m_surface);
29 | }
30 |
31 | void UvcVideoProducer::setUvc(UvcAcquisition *uvc)
32 | {
33 | if (m_uvc)
34 | disconnect(m_uvc, &UvcAcquisition::frameReady,
35 | this, &UvcVideoProducer::onNewVideoContentReceived);
36 |
37 | m_uvc = uvc;
38 | emit uvcChanged(uvc);
39 |
40 | if (m_surface)
41 | {
42 | if (m_surface->isActive()) {
43 | m_surface->stop();
44 | }
45 |
46 | QVideoSurfaceFormat new_format = m_surface->nearestFormat(uvc->videoFormat());
47 | printf("Surface supports format %d width %d height %d",
48 | new_format.pixelFormat(),
49 | new_format.frameWidth(), new_format.frameHeight());
50 | fflush(stdout);
51 |
52 | m_surface->start(uvc->videoFormat());
53 | }
54 |
55 | connect(m_uvc, &UvcAcquisition::frameReady,
56 | this, &UvcVideoProducer::onNewVideoContentReceived);
57 | }
58 |
59 | void UvcVideoProducer::onNewVideoContentReceived(const QVideoFrame &frame)
60 | {
61 | if (m_surface)
62 | m_surface->present(frame);
63 | }
64 |
--------------------------------------------------------------------------------