Browse Source

Linux Technion 0.99

AGP
Evgeny Gagua 6 years ago
parent
commit
10261be6c1
  1. 2
      Linux_Workspace.vpw
  2. 902
      Projects/3dClientGui/makefile
  3. 1
      Projects/Pathfinder/Debug/data
  4. 47
      Projects/Pathfinder/Debug/default.conf
  5. BIN
      Projects/Pathfinder/Debug/pathfinder
  6. 1
      Projects/Pathfinder/Debug/server.pid
  7. 372
      Projects/Pathfinder/Pathfinder.vpj
  8. 6
      Projects/Pathfinder/Pathfinder.vpw
  9. BIN
      Projects/Pathfinder/Release/pathfinder
  10. 9
      Projects/Pathfinder/build
  11. 339
      Projects/Pathfinder/makefile
  12. BIN
      Projects/Pathfinder/spi-test/spidev_test
  13. 210
      Projects/Pathfinder/spi-test/spidev_test.c
  14. 22
      Projects/Pathfinder/spi-test/test_me
  15. BIN
      Projects/Pathfinder/wiringpi-latest.deb
  16. 24
      Projects/argus/argus.vpj
  17. 148
      Projects/argus/makefile
  18. 275
      lib/App/Pathfinder/PathfinderBackend.cpp
  19. 46
      lib/App/Pathfinder/PathfinderBackend.h
  20. 736
      lib/App/Pathfinder/Pathfinder_Kernel.cpp
  21. 155
      lib/App/Pathfinder/Pathfinder_Kernel.h
  22. 55
      lib/App/argus/RGoose_Kernel.cpp
  23. 16
      lib/App/argus/RGoose_Kernel.h
  24. 95
      lib/alg/generic/heapDebug.cpp
  25. 45
      lib/alg/generic/heapDebug.h
  26. 1
      lib/components/base/basicFunctionality.cpp
  27. 53
      lib/components/base/basicFunctionality.h
  28. 4
      lib/components/base/basicTimeStamp.cpp
  29. 155
      lib/components/base/basicTypes.h
  30. 9
      lib/components/object/objectKernelResource.cpp
  31. 36
      lib/components/object/objectKernelResource.h
  32. 16
      lib/components/object/objectKernelResourcesCage.cpp
  33. 17
      lib/components/object/objectKernelResourcesCage.h
  34. 130
      lib/components/object/objectLGS.h
  35. 250
      lib/components/object/objectPathfinderBinaryLog.cpp
  36. 57
      lib/components/object/objectPathfinderBinaryLog.h
  37. 3
      lib/data/curl/curlRequest.h
  38. 16
      lib/data/mysql/database_class.cpp
  39. 1
      lib/data/mysql/database_class.h
  40. 17
      lib/data/protocol/protocol.cpp
  41. 23
      lib/data/protocol/protocolHTTP.cpp
  42. 131
      lib/data/protocol/protocolZLMEDIA.cpp
  43. 22
      lib/data/protocol/protocolZLMEDIA.h
  44. 2
      lib/data/servletWS/servletClientHandlerWS.h
  45. 2
      lib/data/ssdp/ssdpAnnouncer.cpp
  46. 6437
      lib/data/stbi/stb_image.h
  47. 730
      lib/data/stbi/stb_image_write.h
  48. 6
      lib/data/transport/transportBus.cpp
  49. 2
      lib/data/transport/transportBus.h
  50. 10
      lib/data/transport/transportSerial.cpp
  51. 35
      lib/data/zlMediaServer/zlMediaConnector.cpp
  52. 24
      lib/data/zlMediaServer/zlMediaConnector.h
  53. 187
      lib/hardware/i2c/i2cPort.cpp
  54. 39
      lib/hardware/i2c/i2cPort.h
  55. 957
      lib/hardware/sensors/9dof/BNO055.cpp
  56. 494
      lib/hardware/sensors/9dof/BNO055.h
  57. 19255
      lib/hardware/sensors/9dof/bno055.c
  58. 8138
      lib/hardware/sensors/9dof/bno055_.h
  59. 643
      lib/hardware/sensors/9dof/bno055_support.c
  60. 2167
      lib/hardware/sensors/gphoto/actions.c
  61. 112
      lib/hardware/sensors/gphoto/actions.h
  62. 2545
      lib/hardware/sensors/gphoto/gPhotoCamera.cpp
  63. 287
      lib/hardware/sensors/gphoto/gPhotoCamera.h
  64. 19
      lib/hardware/sensors/gphoto/globals.h
  65. 545
      lib/hardware/sensors/gphoto/gp-params.c
  66. 93
      lib/hardware/sensors/gphoto/gp-params.h
  67. 21
      lib/hardware/sensors/gphoto/gphoto2-master/.cvsignore
  68. 84
      lib/hardware/sensors/gphoto/gphoto2-master/.gitignore
  69. 42
      lib/hardware/sensors/gphoto/gphoto2-master/.travis.yml
  70. 7
      lib/hardware/sensors/gphoto/gphoto2-master/AUTHORS
  71. 340
      lib/hardware/sensors/gphoto/gphoto2-master/COPYING
  72. 484
      lib/hardware/sensors/gphoto/gphoto2-master/ChangeLog
  73. 7
      lib/hardware/sensors/gphoto/gphoto2-master/Makefile.am
  74. 269
      lib/hardware/sensors/gphoto/gphoto2-master/NEWS
  75. 43
      lib/hardware/sensors/gphoto/gphoto2-master/README.md
  76. 15
      lib/hardware/sensors/gphoto/gphoto2-master/TODO
  77. 427
      lib/hardware/sensors/gphoto/gphoto2-master/configure.ac
  78. 7
      lib/hardware/sensors/gphoto/gphoto2-master/contrib/Makefile.am
  79. 24
      lib/hardware/sensors/gphoto/gphoto2-master/contrib/README
  80. 3
      lib/hardware/sensors/gphoto/gphoto2-master/contrib/multi-capture/Makefile-files
  81. 3
      lib/hardware/sensors/gphoto/gphoto2-master/contrib/simple-mtpupload/Makefile-files
  82. 113
      lib/hardware/sensors/gphoto/gphoto2-master/contrib/simple-mtpupload/uploadmp3s.pl
  83. 2
      lib/hardware/sensors/gphoto/gphoto2-master/doc/.cvsignore
  84. 3
      lib/hardware/sensors/gphoto/gphoto2-master/doc/Makefile.am
  85. 929
      lib/hardware/sensors/gphoto/gphoto2-master/doc/gphoto2.1
  86. 30
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/Makefile-files
  87. 7
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/Makefile.am
  88. 140
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/README.md
  89. 450
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-byteorder.m4
  90. 170
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-camlibs.m4
  91. 21
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-check-doxygen.m4
  92. 456
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-check-library.m4
  93. 241
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-check-popt.m4
  94. 48
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-check-shell-environment.m4
  95. 102
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-config-msg.m4
  96. 113
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-documentation.m4
  97. 60
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-dynamic-libraries.m4
  98. 78
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-gettext-hack.m4
  99. 29
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-internal-docs.m4
  100. 59
      lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-libltdl.m4

2
Linux_Workspace.vpw

@ -8,6 +8,8 @@
<Project File="Projects/DirectPRU/DirectPRU.vpj"/>
<Project File="Projects/JustADCTest/JustADCTest.vpj"/>
<Project File="Projects/LRF_Server/LRF_Server.vpj"/>
<Project File="Projects/MastBaum/MastBaum.vpj"/>
<Project File="Projects/Pathfinder/Pathfinder.vpj"/>
<Project File="Projects/PRU_CORES/PRU_CORES.vpj"/>
</Projects>
</Workspace>

902
Projects/3dClientGui/makefile

@ -1,579 +1,323 @@
# SlickEdit generated file. Do not edit this file except in designated areas.
# Make command to use for dependencies
MAKE=make
RM=rm
MKDIR=mkdir
# -----Begin user-editable area-----
# -----End user-editable area-----
# If no configuration is specified, "Debug" will be used
ifndef CFG
CFG=Debug
endif
#
# Configuration: Debug
#
ifeq "$(CFG)" "Debug"
OUTDIR=Debug
OUTFILE=$(OUTDIR)/3dClientGui
CFG_INC=-I/usr/local/Qt-5.9.5/include -I/usr/local/include \
-I/usr/include
CFG_LIB=-lssl -lcrypto -lpthread `pkg-config --libs libavcodec \
libavdevice libavfilter libavformat libavresample libavutil \
libswresample libswscale libconfig++ libcurl opencv Qt53DAnimation \
Qt53DCore Qt53DExtras Qt53DInput Qt53DLogic Qt53DQuickAnimation \
Qt53DQuickExtras Qt53DQuickInput Qt53DQuick Qt53DQuickRender \
Qt53DQuickScene2D Qt53DRender Qt5Bluetooth Qt5Charts Qt5Concurrent \
Qt5Core Qt5DataVisualization Qt5DBus Qt5Gamepad Qt5Gui Qt5Help \
Qt5Location Qt5Multimedia Qt5MultimediaWidgets Qt5NetworkAuth \
Qt5Network Qt5Nfc Qt5OpenGLExtensions Qt5OpenGL Qt5Positioning \
Qt5PrintSupport Qt5Purchasing Qt5Qml Qt5QuickControls2 Qt5Quick \
Qt5QuickTest Qt5QuickWidgets Qt5RemoteObjects Qt5Script \
Qt5ScriptTools Qt5Scxml Qt5Sensors Qt5SerialBus Qt5SerialPort Qt5Sql \
Qt5Svg Qt5Test Qt5TextToSpeech Qt5UiTools Qt5WaylandClient \
Qt5WaylandCompositor Qt5WebChannel Qt5WebSockets Qt5Widgets \
Qt5X11Extras Qt5XmlPatterns Qt5Xml` -lGL -lGLU -lc -lm -lz
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/arrowpoint.o $(OUTDIR)/bingapimapadapter.o \
$(OUTDIR)/circlepoint.o $(OUTDIR)/curve.o \
$(OUTDIR)/emptymapadapter.o $(OUTDIR)/fixedimageoverlay.o \
$(OUTDIR)/geometry.o $(OUTDIR)/geometrylayer.o \
$(OUTDIR)/googleapimapadapter.o $(OUTDIR)/googlemapadapter.o \
$(OUTDIR)/gps_position.o $(OUTDIR)/imagemanager.o \
$(OUTDIR)/imagepoint.o $(OUTDIR)/invisiblepoint.o $(OUTDIR)/layer.o \
$(OUTDIR)/layermanager.o $(OUTDIR)/linestring.o \
$(OUTDIR)/mapadapter.o $(OUTDIR)/mapcontrol.o \
$(OUTDIR)/mapcontrol_moc.o $(OUTDIR)/maplayer.o \
$(OUTDIR)/mapnetwork.o $(OUTDIR)/openaerialmapadapter.o \
$(OUTDIR)/osmmapadapter.o $(OUTDIR)/point.o \
$(OUTDIR)/tilemapadapter.o $(OUTDIR)/wmsmapadapter.o \
$(OUTDIR)/addDeviceDialog.o $(OUTDIR)/addSourceDialog.o \
$(OUTDIR)/DeviceChooser.o $(OUTDIR)/EventViewWidget.o \
$(OUTDIR)/FSVideoWidget.o $(OUTDIR)/LrfSensorWidget.o \
$(OUTDIR)/OGLCameraWidget.o $(OUTDIR)/OGLRadarWidget.o \
$(OUTDIR)/point2dWidget.o $(OUTDIR)/RadarMapWidget.o \
$(OUTDIR)/RangeMapWidget.o $(OUTDIR)/ReportsManagerWindow.o \
$(OUTDIR)/SettingsCamera.o $(OUTDIR)/SettingsLGS.o \
$(OUTDIR)/targetDisplay.o $(OUTDIR)/TimeShowWidget.o \
$(OUTDIR)/VideoSourceChooser.o $(OUTDIR)/VideoThumbWidget.o \
$(OUTDIR)/VideoWidget.o $(OUTDIR)/guiClass.o $(OUTDIR)/mask.o \
$(OUTDIR)/base64.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/basicCamera.o \
$(OUTDIR)/basicCameraInfo.o $(OUTDIR)/basicCameraPTZ.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicEvtDispatcher.o $(OUTDIR)/basicFIFO.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLIBAV.o \
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
$(OUTDIR)/basicMediaDestination.o $(OUTDIR)/basicMediaSource.o \
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicReportRecord.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/basicVideoAnalyzer.o \
$(OUTDIR)/OnvifVideoSourceFinder.o $(OUTDIR)/lapsedVideoRecorder.o \
$(OUTDIR)/mediaVideoSourceManager.o \
$(OUTDIR)/videoAVLIBDestination.o $(OUTDIR)/videoAVLIBSource.o \
$(OUTDIR)/videoNode.o $(OUTDIR)/objectCameraPTZ.o \
$(OUTDIR)/objectDVR.o $(OUTDIR)/objectEventReport.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectLGS.o \
$(OUTDIR)/objectSensorsEnumirator.o $(OUTDIR)/objectStaticCamera.o \
$(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/storageProvider.o \
$(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/joystick.o \
$(OUTDIR)/serialPort.o $(OUTDIR)/transportSerial.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/dom.o $(OUTDIR)/duration.o \
$(OUTDIR)/mecevp.o $(OUTDIR)/nsmap.o $(OUTDIR)/onvifclientdevice.o \
$(OUTDIR)/onvifclientevent.o $(OUTDIR)/onvifclientimaging.o \
$(OUTDIR)/onvifclientmedia.o $(OUTDIR)/onvifclientptz.o \
$(OUTDIR)/onvifclientreceiver.o $(OUTDIR)/onvifclientrecording.o \
$(OUTDIR)/onvifclientremotediscovery.o $(OUTDIR)/onvifclientreplay.o \
$(OUTDIR)/onvifclientsearch.o $(OUTDIR)/smdevp.o $(OUTDIR)/soapC.o \
$(OUTDIR)/soapDeviceBindingProxy.o $(OUTDIR)/soapMediaBindingProxy.o \
$(OUTDIR)/soapMediaBindingService.o $(OUTDIR)/soapPTZBindingProxy.o \
$(OUTDIR)/soapPTZBindingService.o \
$(OUTDIR)/soapPullPointSubscriptionBindingProxy.o \
$(OUTDIR)/soapPullPointSubscriptionBindingService.o \
$(OUTDIR)/soapReceiverBindingProxy.o \
$(OUTDIR)/soapReceiverBindingService.o \
$(OUTDIR)/soapRecordingBindingProxy.o \
$(OUTDIR)/soapRecordingBindingService.o \
$(OUTDIR)/soapRemoteDiscoveryBindingProxy.o \
$(OUTDIR)/soapRemoteDiscoveryBindingService.o \
$(OUTDIR)/soapReplayBindingProxy.o \
$(OUTDIR)/soapReplayBindingService.o \
$(OUTDIR)/soapSearchBindingProxy.o \
$(OUTDIR)/soapSearchBindingService.o $(OUTDIR)/soapwsddProxy.o \
$(OUTDIR)/soapwsddService.o $(OUTDIR)/stdsoap2.o $(OUTDIR)/threads.o \
$(OUTDIR)/wsaapi.o $(OUTDIR)/wsseapi.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolLGS.o \
$(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \
$(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \
$(OUTDIR)/xmlParser.o $(OUTDIR)/main-qt.o $(OUTDIR)/main_window.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/arrowpoint.o $(OUTDIR)/bingapimapadapter.o \
$(OUTDIR)/circlepoint.o $(OUTDIR)/curve.o \
$(OUTDIR)/emptymapadapter.o $(OUTDIR)/fixedimageoverlay.o \
$(OUTDIR)/geometry.o $(OUTDIR)/geometrylayer.o \
$(OUTDIR)/googleapimapadapter.o $(OUTDIR)/googlemapadapter.o \
$(OUTDIR)/gps_position.o $(OUTDIR)/imagemanager.o \
$(OUTDIR)/imagepoint.o $(OUTDIR)/invisiblepoint.o $(OUTDIR)/layer.o \
$(OUTDIR)/layermanager.o $(OUTDIR)/linestring.o \
$(OUTDIR)/mapadapter.o $(OUTDIR)/mapcontrol.o \
$(OUTDIR)/mapcontrol_moc.o $(OUTDIR)/maplayer.o \
$(OUTDIR)/mapnetwork.o $(OUTDIR)/openaerialmapadapter.o \
$(OUTDIR)/osmmapadapter.o $(OUTDIR)/point.o \
$(OUTDIR)/tilemapadapter.o $(OUTDIR)/wmsmapadapter.o \
$(OUTDIR)/addDeviceDialog.o $(OUTDIR)/addSourceDialog.o \
$(OUTDIR)/DeviceChooser.o $(OUTDIR)/EventViewWidget.o \
$(OUTDIR)/FSVideoWidget.o $(OUTDIR)/LrfSensorWidget.o \
$(OUTDIR)/OGLCameraWidget.o $(OUTDIR)/OGLRadarWidget.o \
$(OUTDIR)/point2dWidget.o $(OUTDIR)/RadarMapWidget.o \
$(OUTDIR)/RangeMapWidget.o $(OUTDIR)/ReportsManagerWindow.o \
$(OUTDIR)/SettingsCamera.o $(OUTDIR)/SettingsLGS.o \
$(OUTDIR)/targetDisplay.o $(OUTDIR)/TimeShowWidget.o \
$(OUTDIR)/VideoSourceChooser.o $(OUTDIR)/VideoThumbWidget.o \
$(OUTDIR)/VideoWidget.o $(OUTDIR)/guiClass.o $(OUTDIR)/mask.o \
$(OUTDIR)/base64.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/basicCamera.o \
$(OUTDIR)/basicCameraInfo.o $(OUTDIR)/basicCameraPTZ.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicEvtDispatcher.o $(OUTDIR)/basicFIFO.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLIBAV.o \
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
$(OUTDIR)/basicMediaDestination.o $(OUTDIR)/basicMediaSource.o \
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicReportRecord.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/basicVideoAnalyzer.o \
$(OUTDIR)/OnvifVideoSourceFinder.o $(OUTDIR)/lapsedVideoRecorder.o \
$(OUTDIR)/mediaVideoSourceManager.o \
$(OUTDIR)/videoAVLIBDestination.o $(OUTDIR)/videoAVLIBSource.o \
$(OUTDIR)/videoNode.o $(OUTDIR)/objectCameraPTZ.o \
$(OUTDIR)/objectDVR.o $(OUTDIR)/objectEventReport.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectLGS.o \
$(OUTDIR)/objectSensorsEnumirator.o $(OUTDIR)/objectStaticCamera.o \
$(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/storageProvider.o \
$(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/joystick.o \
$(OUTDIR)/serialPort.o $(OUTDIR)/transportSerial.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/dom.o $(OUTDIR)/duration.o \
$(OUTDIR)/mecevp.o $(OUTDIR)/nsmap.o $(OUTDIR)/onvifclientdevice.o \
$(OUTDIR)/onvifclientevent.o $(OUTDIR)/onvifclientimaging.o \
$(OUTDIR)/onvifclientmedia.o $(OUTDIR)/onvifclientptz.o \
$(OUTDIR)/onvifclientreceiver.o $(OUTDIR)/onvifclientrecording.o \
$(OUTDIR)/onvifclientremotediscovery.o $(OUTDIR)/onvifclientreplay.o \
$(OUTDIR)/onvifclientsearch.o $(OUTDIR)/smdevp.o $(OUTDIR)/soapC.o \
$(OUTDIR)/soapDeviceBindingProxy.o $(OUTDIR)/soapMediaBindingProxy.o \
$(OUTDIR)/soapMediaBindingService.o $(OUTDIR)/soapPTZBindingProxy.o \
$(OUTDIR)/soapPTZBindingService.o \
$(OUTDIR)/soapPullPointSubscriptionBindingProxy.o \
$(OUTDIR)/soapPullPointSubscriptionBindingService.o \
$(OUTDIR)/soapReceiverBindingProxy.o \
$(OUTDIR)/soapReceiverBindingService.o \
$(OUTDIR)/soapRecordingBindingProxy.o \
$(OUTDIR)/soapRecordingBindingService.o \
$(OUTDIR)/soapRemoteDiscoveryBindingProxy.o \
$(OUTDIR)/soapRemoteDiscoveryBindingService.o \
$(OUTDIR)/soapReplayBindingProxy.o \
$(OUTDIR)/soapReplayBindingService.o \
$(OUTDIR)/soapSearchBindingProxy.o \
$(OUTDIR)/soapSearchBindingService.o $(OUTDIR)/soapwsddProxy.o \
$(OUTDIR)/soapwsddService.o $(OUTDIR)/stdsoap2.o $(OUTDIR)/threads.o \
$(OUTDIR)/wsaapi.o $(OUTDIR)/wsseapi.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolLGS.o \
$(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \
$(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \
$(OUTDIR)/xmlParser.o $(OUTDIR)/main-qt.o $(OUTDIR)/main_window.o \
-lssl -lcrypto -lpthread `pkg-config --libs libavcodec libavdevice \
libavfilter libavformat libavresample libavutil libswresample \
libswscale libconfig++ libcurl opencv Qt53DAnimation Qt53DCore \
Qt53DExtras Qt53DInput Qt53DLogic Qt53DQuickAnimation \
Qt53DQuickExtras Qt53DQuickInput Qt53DQuick Qt53DQuickRender \
Qt53DQuickScene2D Qt53DRender Qt5Bluetooth Qt5Charts Qt5Concurrent \
Qt5Core Qt5DataVisualization Qt5DBus Qt5Gamepad Qt5Gui Qt5Help \
Qt5Location Qt5Multimedia Qt5MultimediaWidgets Qt5NetworkAuth \
Qt5Network Qt5Nfc Qt5OpenGLExtensions Qt5OpenGL Qt5Positioning \
Qt5PrintSupport Qt5Purchasing Qt5Qml Qt5QuickControls2 Qt5Quick \
Qt5QuickTest Qt5QuickWidgets Qt5RemoteObjects Qt5Script \
Qt5ScriptTools Qt5Scxml Qt5Sensors Qt5SerialBus Qt5SerialPort Qt5Sql \
Qt5Svg Qt5Test Qt5TextToSpeech Qt5UiTools Qt5WaylandClient \
Qt5WaylandCompositor Qt5WebChannel Qt5WebSockets Qt5Widgets \
Qt5X11Extras Qt5XmlPatterns Qt5Xml` -lGL -lGLU -lc -lm -lz
COMPILE=g++ -c "-DDEBUG" "-D__GUI__" "-D__STDC_CONSTANT_MACROS" "-DWITH_OPENSSL" "-D_CLIENT_APPLICATION_" "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_CONSTANT_MACROS" "-DWITH_PURE_VIRTUAL" -g -fPIC `pkg-config --cflags Qt53DAnimation Qt53DCore Qt53DExtras Qt53DInput Qt53DLogic Qt53DQuickAnimation Qt53DQuickExtras Qt53DQuickInput Qt53DQuick Qt53DQuickRender Qt53DQuickScene2D Qt53DRender Qt5Bluetooth Qt5Charts Qt5Concurrent Qt5Core Qt5DataVisualization Qt5DBus Qt5Gamepad Qt5Gui Qt5Help Qt5Location Qt5Multimedia Qt5MultimediaWidgets Qt5NetworkAuth Qt5Network Qt5Nfc Qt5OpenGLExtensions Qt5OpenGL Qt5Positioning Qt5PrintSupport Qt5Purchasing Qt5Qml Qt5QuickControls2 Qt5Quick Qt5QuickTest Qt5QuickWidgets Qt5RemoteObjects Qt5Script Qt5ScriptTools Qt5Scxml Qt5Sensors Qt5SerialBus Qt5SerialPort Qt5Sql Qt5Svg Qt5Test Qt5TextToSpeech Qt5UiTools Qt5WaylandClient Qt5WaylandCompositor Qt5WebChannel Qt5WebSockets Qt5Widgets opencv Qt5X11Extras Qt5XmlPatterns Qt5Xml` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -g -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/data/storage/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/net/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/onvif/onvifgen/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/gui/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/lgs/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/media/video/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/transport/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/gui/controls/mapControl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/gui/controls/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/onvif/gsoap/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/3dGUI/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/onvif/include/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/uart/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/stick/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/media/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
$(OUTFILE): $(OUTDIR) $(OBJ)
$(LINK)
$(OUTDIR):
$(MKDIR) -p "$(OUTDIR)"
# Rebuild this project
rebuild: cleanall all
# Clean this project
clean:
$(RM) -f $(OUTFILE)
$(RM) -f $(OBJ)
# Clean this project and all dependencies
cleanall: clean
endif
#
# Configuration: Release
#
ifeq "$(CFG)" "Release"
OUTDIR=Release
OUTFILE=$(OUTDIR)/3dClientGui
CFG_INC=-I/usr/local/Qt-5.9.5/include -I/usr/local/include \
-I/usr/include
CFG_LIB=-lssl -lcrypto -lpthread `pkg-config --libs libavcodec \
libavdevice libavfilter libavformat libavresample libavutil \
libswresample libswscale libconfig++ libcurl opencv Qt53DAnimation \
Qt53DCore Qt53DExtras Qt53DInput Qt53DLogic Qt53DQuickAnimation \
Qt53DQuickExtras Qt53DQuickInput Qt53DQuick Qt53DQuickRender \
Qt53DQuickScene2D Qt53DRender Qt5Bluetooth Qt5Charts Qt5Concurrent \
Qt5Core Qt5DataVisualization Qt5DBus Qt5Gamepad Qt5Gui Qt5Help \
Qt5Location Qt5Multimedia Qt5MultimediaWidgets Qt5NetworkAuth \
Qt5Network Qt5Nfc Qt5OpenGLExtensions Qt5OpenGL Qt5Positioning \
Qt5PrintSupport Qt5Purchasing Qt5Qml Qt5QuickControls2 Qt5Quick \
Qt5QuickTest Qt5QuickWidgets Qt5RemoteObjects Qt5Script \
Qt5ScriptTools Qt5Scxml Qt5Sensors Qt5SerialBus Qt5SerialPort Qt5Sql \
Qt5Svg Qt5Test Qt5TextToSpeech Qt5UiTools Qt5WaylandClient \
Qt5WaylandCompositor Qt5WebChannel Qt5WebSockets Qt5Widgets \
Qt5X11Extras Qt5XmlPatterns Qt5Xml` -lGL -lGLU -lc -lm -lz
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/arrowpoint.o $(OUTDIR)/bingapimapadapter.o \
$(OUTDIR)/circlepoint.o $(OUTDIR)/curve.o \
$(OUTDIR)/emptymapadapter.o $(OUTDIR)/fixedimageoverlay.o \
$(OUTDIR)/geometry.o $(OUTDIR)/geometrylayer.o \
$(OUTDIR)/googleapimapadapter.o $(OUTDIR)/googlemapadapter.o \
$(OUTDIR)/gps_position.o $(OUTDIR)/imagemanager.o \
$(OUTDIR)/imagepoint.o $(OUTDIR)/invisiblepoint.o $(OUTDIR)/layer.o \
$(OUTDIR)/layermanager.o $(OUTDIR)/linestring.o \
$(OUTDIR)/mapadapter.o $(OUTDIR)/mapcontrol.o \
$(OUTDIR)/mapcontrol_moc.o $(OUTDIR)/maplayer.o \
$(OUTDIR)/mapnetwork.o $(OUTDIR)/openaerialmapadapter.o \
$(OUTDIR)/osmmapadapter.o $(OUTDIR)/point.o \
$(OUTDIR)/tilemapadapter.o $(OUTDIR)/wmsmapadapter.o \
$(OUTDIR)/addDeviceDialog.o $(OUTDIR)/addSourceDialog.o \
$(OUTDIR)/DeviceChooser.o $(OUTDIR)/EventViewWidget.o \
$(OUTDIR)/FSVideoWidget.o $(OUTDIR)/LrfSensorWidget.o \
$(OUTDIR)/OGLCameraWidget.o $(OUTDIR)/OGLRadarWidget.o \
$(OUTDIR)/point2dWidget.o $(OUTDIR)/RadarMapWidget.o \
$(OUTDIR)/RangeMapWidget.o $(OUTDIR)/ReportsManagerWindow.o \
$(OUTDIR)/SettingsCamera.o $(OUTDIR)/SettingsLGS.o \
$(OUTDIR)/targetDisplay.o $(OUTDIR)/TimeShowWidget.o \
$(OUTDIR)/VideoSourceChooser.o $(OUTDIR)/VideoThumbWidget.o \
$(OUTDIR)/VideoWidget.o $(OUTDIR)/guiClass.o $(OUTDIR)/mask.o \
$(OUTDIR)/base64.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/basicCamera.o \
$(OUTDIR)/basicCameraInfo.o $(OUTDIR)/basicCameraPTZ.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicEvtDispatcher.o $(OUTDIR)/basicFIFO.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLIBAV.o \
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
$(OUTDIR)/basicMediaDestination.o $(OUTDIR)/basicMediaSource.o \
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicReportRecord.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/basicVideoAnalyzer.o \
$(OUTDIR)/OnvifVideoSourceFinder.o $(OUTDIR)/lapsedVideoRecorder.o \
$(OUTDIR)/mediaVideoSourceManager.o \
$(OUTDIR)/videoAVLIBDestination.o $(OUTDIR)/videoAVLIBSource.o \
$(OUTDIR)/videoNode.o $(OUTDIR)/objectCameraPTZ.o \
$(OUTDIR)/objectDVR.o $(OUTDIR)/objectEventReport.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectLGS.o \
$(OUTDIR)/objectSensorsEnumirator.o $(OUTDIR)/objectStaticCamera.o \
$(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/storageProvider.o \
$(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/joystick.o \
$(OUTDIR)/serialPort.o $(OUTDIR)/transportSerial.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/dom.o $(OUTDIR)/duration.o \
$(OUTDIR)/mecevp.o $(OUTDIR)/nsmap.o $(OUTDIR)/onvifclientdevice.o \
$(OUTDIR)/onvifclientevent.o $(OUTDIR)/onvifclientimaging.o \
$(OUTDIR)/onvifclientmedia.o $(OUTDIR)/onvifclientptz.o \
$(OUTDIR)/onvifclientreceiver.o $(OUTDIR)/onvifclientrecording.o \
$(OUTDIR)/onvifclientremotediscovery.o $(OUTDIR)/onvifclientreplay.o \
$(OUTDIR)/onvifclientsearch.o $(OUTDIR)/smdevp.o $(OUTDIR)/soapC.o \
$(OUTDIR)/soapDeviceBindingProxy.o $(OUTDIR)/soapMediaBindingProxy.o \
$(OUTDIR)/soapMediaBindingService.o $(OUTDIR)/soapPTZBindingProxy.o \
$(OUTDIR)/soapPTZBindingService.o \
$(OUTDIR)/soapPullPointSubscriptionBindingProxy.o \
$(OUTDIR)/soapPullPointSubscriptionBindingService.o \
$(OUTDIR)/soapReceiverBindingProxy.o \
$(OUTDIR)/soapReceiverBindingService.o \
$(OUTDIR)/soapRecordingBindingProxy.o \
$(OUTDIR)/soapRecordingBindingService.o \
$(OUTDIR)/soapRemoteDiscoveryBindingProxy.o \
$(OUTDIR)/soapRemoteDiscoveryBindingService.o \
$(OUTDIR)/soapReplayBindingProxy.o \
$(OUTDIR)/soapReplayBindingService.o \
$(OUTDIR)/soapSearchBindingProxy.o \
$(OUTDIR)/soapSearchBindingService.o $(OUTDIR)/soapwsddProxy.o \
$(OUTDIR)/soapwsddService.o $(OUTDIR)/stdsoap2.o $(OUTDIR)/threads.o \
$(OUTDIR)/wsaapi.o $(OUTDIR)/wsseapi.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolLGS.o \
$(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \
$(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \
$(OUTDIR)/xmlParser.o $(OUTDIR)/main-qt.o $(OUTDIR)/main_window.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/arrowpoint.o $(OUTDIR)/bingapimapadapter.o \
$(OUTDIR)/circlepoint.o $(OUTDIR)/curve.o \
$(OUTDIR)/emptymapadapter.o $(OUTDIR)/fixedimageoverlay.o \
$(OUTDIR)/geometry.o $(OUTDIR)/geometrylayer.o \
$(OUTDIR)/googleapimapadapter.o $(OUTDIR)/googlemapadapter.o \
$(OUTDIR)/gps_position.o $(OUTDIR)/imagemanager.o \
$(OUTDIR)/imagepoint.o $(OUTDIR)/invisiblepoint.o $(OUTDIR)/layer.o \
$(OUTDIR)/layermanager.o $(OUTDIR)/linestring.o \
$(OUTDIR)/mapadapter.o $(OUTDIR)/mapcontrol.o \
$(OUTDIR)/mapcontrol_moc.o $(OUTDIR)/maplayer.o \
$(OUTDIR)/mapnetwork.o $(OUTDIR)/openaerialmapadapter.o \
$(OUTDIR)/osmmapadapter.o $(OUTDIR)/point.o \
$(OUTDIR)/tilemapadapter.o $(OUTDIR)/wmsmapadapter.o \
$(OUTDIR)/addDeviceDialog.o $(OUTDIR)/addSourceDialog.o \
$(OUTDIR)/DeviceChooser.o $(OUTDIR)/EventViewWidget.o \
$(OUTDIR)/FSVideoWidget.o $(OUTDIR)/LrfSensorWidget.o \
$(OUTDIR)/OGLCameraWidget.o $(OUTDIR)/OGLRadarWidget.o \
$(OUTDIR)/point2dWidget.o $(OUTDIR)/RadarMapWidget.o \
$(OUTDIR)/RangeMapWidget.o $(OUTDIR)/ReportsManagerWindow.o \
$(OUTDIR)/SettingsCamera.o $(OUTDIR)/SettingsLGS.o \
$(OUTDIR)/targetDisplay.o $(OUTDIR)/TimeShowWidget.o \
$(OUTDIR)/VideoSourceChooser.o $(OUTDIR)/VideoThumbWidget.o \
$(OUTDIR)/VideoWidget.o $(OUTDIR)/guiClass.o $(OUTDIR)/mask.o \
$(OUTDIR)/base64.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/basicCamera.o \
$(OUTDIR)/basicCameraInfo.o $(OUTDIR)/basicCameraPTZ.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicEvtDispatcher.o $(OUTDIR)/basicFIFO.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLIBAV.o \
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
$(OUTDIR)/basicMediaDestination.o $(OUTDIR)/basicMediaSource.o \
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicReportRecord.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/basicVideoAnalyzer.o \
$(OUTDIR)/OnvifVideoSourceFinder.o $(OUTDIR)/lapsedVideoRecorder.o \
$(OUTDIR)/mediaVideoSourceManager.o \
$(OUTDIR)/videoAVLIBDestination.o $(OUTDIR)/videoAVLIBSource.o \
$(OUTDIR)/videoNode.o $(OUTDIR)/objectCameraPTZ.o \
$(OUTDIR)/objectDVR.o $(OUTDIR)/objectEventReport.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectLGS.o \
$(OUTDIR)/objectSensorsEnumirator.o $(OUTDIR)/objectStaticCamera.o \
$(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/storageProvider.o \
$(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/joystick.o \
$(OUTDIR)/serialPort.o $(OUTDIR)/transportSerial.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/dom.o $(OUTDIR)/duration.o \
$(OUTDIR)/mecevp.o $(OUTDIR)/nsmap.o $(OUTDIR)/onvifclientdevice.o \
$(OUTDIR)/onvifclientevent.o $(OUTDIR)/onvifclientimaging.o \
$(OUTDIR)/onvifclientmedia.o $(OUTDIR)/onvifclientptz.o \
$(OUTDIR)/onvifclientreceiver.o $(OUTDIR)/onvifclientrecording.o \
$(OUTDIR)/onvifclientremotediscovery.o $(OUTDIR)/onvifclientreplay.o \
$(OUTDIR)/onvifclientsearch.o $(OUTDIR)/smdevp.o $(OUTDIR)/soapC.o \
$(OUTDIR)/soapDeviceBindingProxy.o $(OUTDIR)/soapMediaBindingProxy.o \
$(OUTDIR)/soapMediaBindingService.o $(OUTDIR)/soapPTZBindingProxy.o \
$(OUTDIR)/soapPTZBindingService.o \
$(OUTDIR)/soapPullPointSubscriptionBindingProxy.o \
$(OUTDIR)/soapPullPointSubscriptionBindingService.o \
$(OUTDIR)/soapReceiverBindingProxy.o \
$(OUTDIR)/soapReceiverBindingService.o \
$(OUTDIR)/soapRecordingBindingProxy.o \
$(OUTDIR)/soapRecordingBindingService.o \
$(OUTDIR)/soapRemoteDiscoveryBindingProxy.o \
$(OUTDIR)/soapRemoteDiscoveryBindingService.o \
$(OUTDIR)/soapReplayBindingProxy.o \
$(OUTDIR)/soapReplayBindingService.o \
$(OUTDIR)/soapSearchBindingProxy.o \
$(OUTDIR)/soapSearchBindingService.o $(OUTDIR)/soapwsddProxy.o \
$(OUTDIR)/soapwsddService.o $(OUTDIR)/stdsoap2.o $(OUTDIR)/threads.o \
$(OUTDIR)/wsaapi.o $(OUTDIR)/wsseapi.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolLGS.o \
$(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \
$(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \
$(OUTDIR)/xmlParser.o $(OUTDIR)/main-qt.o $(OUTDIR)/main_window.o \
-lssl -lcrypto -lpthread `pkg-config --libs libavcodec libavdevice \
libavfilter libavformat libavresample libavutil libswresample \
libswscale libconfig++ libcurl opencv Qt53DAnimation Qt53DCore \
Qt53DExtras Qt53DInput Qt53DLogic Qt53DQuickAnimation \
Qt53DQuickExtras Qt53DQuickInput Qt53DQuick Qt53DQuickRender \
Qt53DQuickScene2D Qt53DRender Qt5Bluetooth Qt5Charts Qt5Concurrent \
Qt5Core Qt5DataVisualization Qt5DBus Qt5Gamepad Qt5Gui Qt5Help \
Qt5Location Qt5Multimedia Qt5MultimediaWidgets Qt5NetworkAuth \
Qt5Network Qt5Nfc Qt5OpenGLExtensions Qt5OpenGL Qt5Positioning \
Qt5PrintSupport Qt5Purchasing Qt5Qml Qt5QuickControls2 Qt5Quick \
Qt5QuickTest Qt5QuickWidgets Qt5RemoteObjects Qt5Script \
Qt5ScriptTools Qt5Scxml Qt5Sensors Qt5SerialBus Qt5SerialPort Qt5Sql \
Qt5Svg Qt5Test Qt5TextToSpeech Qt5UiTools Qt5WaylandClient \
Qt5WaylandCompositor Qt5WebChannel Qt5WebSockets Qt5Widgets \
Qt5X11Extras Qt5XmlPatterns Qt5Xml` -lGL -lGLU -lc -lm -lz
COMPILE=g++ -c "-D__GUI__" "-D__STDC_CONSTANT_MACROS" "-DWITH_OPENSSL" "-D_CLIENT_APPLICATION_" "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_CONSTANT_MACROS" "-DWITH_PURE_VIRTUAL" -fPIC `pkg-config --cflags Qt53DAnimation Qt53DCore Qt53DExtras Qt53DInput Qt53DLogic Qt53DQuickAnimation Qt53DQuickExtras Qt53DQuickInput Qt53DQuick Qt53DQuickRender Qt53DQuickScene2D Qt53DRender Qt5Bluetooth Qt5Charts Qt5Concurrent Qt5Core Qt5DataVisualization Qt5DBus Qt5Gamepad Qt5Gui Qt5Help Qt5Location Qt5Multimedia Qt5MultimediaWidgets Qt5NetworkAuth Qt5Network Qt5Nfc Qt5OpenGLExtensions Qt5OpenGL Qt5Positioning Qt5PrintSupport Qt5Purchasing Qt5Qml Qt5QuickControls2 Qt5Quick Qt5QuickTest Qt5QuickWidgets Qt5RemoteObjects Qt5Script Qt5ScriptTools Qt5Scxml Qt5Sensors Qt5SerialBus Qt5SerialPort Qt5Sql Qt5Svg Qt5Test Qt5TextToSpeech Qt5UiTools Qt5WaylandClient Qt5WaylandCompositor Qt5WebChannel Qt5WebSockets Qt5Widgets opencv Qt5X11Extras Qt5XmlPatterns Qt5Xml` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/data/storage/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/net/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/onvif/onvifgen/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/gui/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/lgs/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/media/video/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/transport/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/gui/controls/mapControl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/gui/controls/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/onvif/gsoap/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/3dGUI/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/onvif/include/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/uart/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/stick/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/media/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
$(OUTFILE): $(OUTDIR) $(OBJ)
$(LINK)
$(OUTDIR):
$(MKDIR) -p "$(OUTDIR)"
# Rebuild this project
rebuild: cleanall all
# Clean this project
clean:
$(RM) -f $(OUTFILE)
$(RM) -f $(OBJ)
# Clean this project and all dependencies
cleanall: clean
endif
# SlickEdit generated file. Do not edit this file except in designated areas.
# Make command to use for dependencies
MAKE=make
RM=rm
MKDIR=mkdir
# -----Begin user-editable area-----
# -----End user-editable area-----
# If no configuration is specified, "Debug" will be used
ifndef CFG
CFG=Debug
endif
#
# Configuration: Debug
#
ifeq "$(CFG)" "Debug"
OUTDIR=Debug
OUTFILE=$(OUTDIR)/pathfinder
CFG_INC=
CFG_LIB=-lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig \
-lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice \
libavfilter libavformat libavutil libpostproc libswresample \
libswscale --libs` -lssl -lwiringPi -lwiringPiDev -lgphoto2 \
-lgphoto2_port
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicDualThread.o \
$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \
$(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \
$(OUTDIR)/basicObject.o $(OUTDIR)/basicPosition.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/BNO055.o $(OUTDIR)/clientPort.o \
$(OUTDIR)/curlRequest.o $(OUTDIR)/curlRequestsManager.o \
$(OUTDIR)/database_class.o $(OUTDIR)/gPhotoCamera.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/i2cPort.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o \
$(OUTDIR)/lrfScanner.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectPathfinderBinaryLog.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/Pathfinder_Kernel.o $(OUTDIR)/PathfinderBackend.o \
$(OUTDIR)/pathfinderDBConnector.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o $(OUTDIR)/serialPort.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o \
$(OUTDIR)/transportBus.o $(OUTDIR)/transportSerial.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/UBLOX_I2C.o $(OUTDIR)/utm.o \
$(OUTDIR)/xmlParser.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicDualThread.o \
$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \
$(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \
$(OUTDIR)/basicObject.o $(OUTDIR)/basicPosition.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/BNO055.o $(OUTDIR)/clientPort.o \
$(OUTDIR)/curlRequest.o $(OUTDIR)/curlRequestsManager.o \
$(OUTDIR)/database_class.o $(OUTDIR)/gPhotoCamera.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/i2cPort.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o \
$(OUTDIR)/lrfScanner.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectPathfinderBinaryLog.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/Pathfinder_Kernel.o $(OUTDIR)/PathfinderBackend.o \
$(OUTDIR)/pathfinderDBConnector.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o $(OUTDIR)/serialPort.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o \
$(OUTDIR)/transportBus.o $(OUTDIR)/transportSerial.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/UBLOX_I2C.o $(OUTDIR)/utm.o \
$(OUTDIR)/xmlParser.o -lpthread -lmysqlclient -lssl -lcurl -lm \
-lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config \
libavcodec libavdevice libavfilter libavformat libavutil libpostproc \
libswresample libswscale --libs` -lssl -lwiringPi -lwiringPiDev \
-lgphoto2 -lgphoto2_port
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -g -ggdb -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -g -ggdb -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/hardware/sensors/gps/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/transport/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/9dof/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/lgs/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/pathfinder/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/Pathfinder/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/i2c/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/uart/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/gphoto/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/lrf/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/net/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
$(OUTFILE): $(OUTDIR) $(OBJ)
$(LINK)
$(OUTDIR):
$(MKDIR) -p "$(OUTDIR)"
# Rebuild this project
rebuild: cleanall all
# Clean this project
clean:
$(RM) -f $(OUTFILE)
$(RM) -f $(OBJ)
# Clean this project and all dependencies
cleanall: clean
endif
#
# Configuration: Release
#
ifeq "$(CFG)" "Release"
OUTDIR=Release
OUTFILE=$(OUTDIR)/pathfinder
CFG_INC=
CFG_LIB=-lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig \
-lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice \
libavfilter libavformat libavutil libpostproc libswresample \
libswscale --libs` -lssl -lwiringPi -lwiringPiDev -lgphoto2 \
-lgphoto2_port
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicDualThread.o \
$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \
$(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \
$(OUTDIR)/basicObject.o $(OUTDIR)/basicPosition.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/BNO055.o $(OUTDIR)/clientPort.o \
$(OUTDIR)/curlRequest.o $(OUTDIR)/curlRequestsManager.o \
$(OUTDIR)/database_class.o $(OUTDIR)/gPhotoCamera.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/i2cPort.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o \
$(OUTDIR)/lrfScanner.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectPathfinderBinaryLog.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/Pathfinder_Kernel.o $(OUTDIR)/PathfinderBackend.o \
$(OUTDIR)/pathfinderDBConnector.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o $(OUTDIR)/serialPort.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o \
$(OUTDIR)/transportBus.o $(OUTDIR)/transportSerial.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/UBLOX_I2C.o $(OUTDIR)/utm.o \
$(OUTDIR)/xmlParser.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicDualThread.o \
$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \
$(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \
$(OUTDIR)/basicObject.o $(OUTDIR)/basicPosition.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/BNO055.o $(OUTDIR)/clientPort.o \
$(OUTDIR)/curlRequest.o $(OUTDIR)/curlRequestsManager.o \
$(OUTDIR)/database_class.o $(OUTDIR)/gPhotoCamera.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/i2cPort.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o \
$(OUTDIR)/lrfScanner.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectPathfinderBinaryLog.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/Pathfinder_Kernel.o $(OUTDIR)/PathfinderBackend.o \
$(OUTDIR)/pathfinderDBConnector.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o $(OUTDIR)/serialPort.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o \
$(OUTDIR)/transportBus.o $(OUTDIR)/transportSerial.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/UBLOX_I2C.o $(OUTDIR)/utm.o \
$(OUTDIR)/xmlParser.o -lpthread -lmysqlclient -lssl -lcurl -lm \
-lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config \
libavcodec libavdevice libavfilter libavformat libavutil libpostproc \
libswresample libswscale --libs` -lssl -lwiringPi -lwiringPiDev \
-lgphoto2 -lgphoto2_port
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -ggdb -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -ggdb -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/hardware/sensors/gps/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/transport/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/9dof/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/lgs/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/pathfinder/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/Pathfinder/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/i2c/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/uart/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/gphoto/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/lrf/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/net/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
$(OUTFILE): $(OUTDIR) $(OBJ)
$(LINK)
$(OUTDIR):
$(MKDIR) -p "$(OUTDIR)"
# Rebuild this project
rebuild: cleanall all
# Clean this project
clean:
$(RM) -f $(OUTFILE)
$(RM) -f $(OBJ)
# Clean this project and all dependencies
cleanall: clean
endif

1
Projects/Pathfinder/Debug/data

@ -0,0 +1 @@
/srv/samba/data

47
Projects/Pathfinder/Debug/default.conf

@ -0,0 +1,47 @@
KERNEL :
{
SSDP :
{
SERVER_STRING = "POSIX UPnP/1.0 Pathfinder/1.0.5";
DEVICE_TYPE = "urn:schemas-upnp-org:device:InternetGatewayDevice:1";
DEVICE_FRIENDLY_NAME = "Pathfinder LRF surface Scaner";
DEVICE_UUID = "15f39804-6df1-44fb-903c-f55d6c1cbca4";
MANUFACTURER = "DFSL(Dr.Frucht Systems ltd.)";
PRESENTATION_URL = "http://%%s/";
ICONS :
{
};
SERVICES :
{
};
};
BNO055 :
{
};
DBC :
{
DATABASE_HOST = "localhost";
DATABASE_NAME = "pathfinder";
DATABASE_USER = "dbroot";
DATABASE_PASSWORD = "NoGud4U";
};
GP_CAMERA :
{
MOUNT_POINT = "/srv/samba/data/camera";
UID = 65534;
GID = 65534;
};
LRFSCAN :
{
BOARD_SPEED = 8;
PROTOCOL :
{
};
};
OPTIC_FLOW :
{
};
UBLOX :
{
};
};

BIN
Projects/Pathfinder/Debug/pathfinder

Binary file not shown.

1
Projects/Pathfinder/Debug/server.pid

@ -0,0 +1 @@
6343

372
Projects/Pathfinder/Pathfinder.vpj

@ -0,0 +1,372 @@
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
<Project
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir="."
BuildSystem="automakefile"
BuildMakeFile="makefile">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdpathfinder"
CompilerConfigName="Latest Version"
Defines='"/DDEBUG" "/D__STDC_CONSTANT_MACROS"'>
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec
CmdLine='g++ -c %xup -x c++ %defd -O3 -g -ggdb %~other -o "%bd%n%oe" %i %f'
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -O3 -g -ggdb -o "%o" %objs'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" CFG=%b'/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine='vsdebugio -prog "%o"'/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='"%o"'/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="Executable"/>
</List>
<Includes>
</Includes>
<Libs PreObjects="0">
<Lib File="-lpthread"/>
<Lib File="-lmysqlclient"/>
<Lib File="-lssl"/>
<Lib File="-lcurl"/>
<Lib File="-lm"/>
<Lib File="-lcrypto"/>
<Lib File="-lconfig"/>
<Lib File="-lz"/>
<Lib File="-lv4l1"/>
<Lib File="-lv4l2"/>
<Lib File="-lhidapi-libusb"/>
<Lib File="`pkg-config"/>
<Lib File="libavcodec"/>
<Lib File="libavdevice"/>
<Lib File="libavfilter"/>
<Lib File="libavformat"/>
<Lib File="libavutil"/>
<Lib File="libpostproc"/>
<Lib File="libswresample"/>
<Lib File="libswscale"/>
<Lib File="--libs`"/>
<Lib File="-lssl"/>
<Lib File="-lwiringPi"/>
<Lib File="-lwiringPiDev"/>
<Lib File="-lgphoto2"/>
<Lib File="-lgphoto2_port"/>
</Libs>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdpathfinder"
CompilerConfigName="Latest Version"
Defines='"/D__STDC_CONSTANT_MACROS"'>
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec
CmdLine='g++ -c %xup -x c++ %defd -O3 %~other -o "%bd%n%oe" %i %f'
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec
CmdLine='g++ %xup -O3 %~other -o "%o" %objs'
OtherOptions="-s"/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" CFG=%b'/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine='vsdebugio -prog "%o"'/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='"%o"'/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="Executable"/>
</List>
<Includes>
</Includes>
<Libs PreObjects="0">
<Lib File="-lpthread"/>
<Lib File="-lmysqlclient"/>
<Lib File="-lssl"/>
<Lib File="-lcurl"/>
<Lib File="-lm"/>
<Lib File="-lcrypto"/>
<Lib File="-lconfig"/>
<Lib File="-lz"/>
<Lib File="-lv4l1"/>
<Lib File="-lv4l2"/>
<Lib File="-lhidapi-libusb"/>
<Lib File="`pkg-config"/>
<Lib File="libavcodec"/>
<Lib File="libavdevice"/>
<Lib File="libavfilter"/>
<Lib File="libavformat"/>
<Lib File="libavutil"/>
<Lib File="libpostproc"/>
<Lib File="libswresample"/>
<Lib File="libswscale"/>
<Lib File="--libs`"/>
<Lib File="-lssl"/>
<Lib File="-lwiringPi"/>
<Lib File="-lwiringPiDev"/>
<Lib File="-lgphoto2"/>
<Lib File="-lgphoto2_port"/>
</Libs>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="../../lib/alg/generic/base64.cpp"/>
<F N="../../lib/components/base/basicDualThread.cpp"/>
<F N="../../lib/components/base/basicEngine.cpp"/>
<F N="../../lib/components/base/basicEvent.cpp"/>
<F N="../../lib/components/base/basicEventHandler.cpp"/>
<F N="../../lib/components/base/basicEventHeap.cpp"/>
<F N="../../lib/components/base/basicFunctionality.cpp"/>
<F N="../../lib/components/base/basicLogCollection.cpp"/>
<F N="../../lib/components/base/basicLoggingService.cpp"/>
<F N="../../lib/components/base/basicMutex.cpp"/>
<F N="../../lib/components/base/basicObject.cpp"/>
<F N="../../lib/components/base/basicPosition.cpp"/>
<F N="../../lib/components/base/basicRing.cpp"/>
<F N="../../lib/components/base/basicSettings.cpp"/>
<F N="../../lib/components/base/basicSettingsProvider.cpp"/>
<F N="../../lib/components/base/basicThread.cpp"/>
<F N="../../lib/components/base/basicTimeStamp.cpp"/>
<F N="../../lib/components/base/basicTransport.cpp"/>
<F N="../../lib/components/base/basicTypes.cpp"/>
<F N="../../lib/hardware/sensors/9dof/BNO055.cpp"/>
<F N="../../lib/data/net/clientPort.cpp"/>
<F N="../../lib/data/curl/curlRequest.cpp"/>
<F N="../../lib/data/curl/curlRequestsManager.cpp"/>
<F N="../../lib/data/mysql/database_class.cpp"/>
<F N="../../lib/hardware/sensors/gphoto/gPhotoCamera.cpp"/>
<F N="../../lib/alg/generic/heapDebug.cpp"/>
<F N="../../lib/hardware/i2c/i2cPort.cpp"/>
<F N="../../lib/data/json/json_reader.cpp"/>
<F N="../../lib/data/json/json_value.cpp"/>
<F N="../../lib/data/json/json_writer.cpp"/>
<F N="../../lib/alg/generic/libzip.cpp"/>
<F N="../../lib/hardware/sensors/lrf/lrfScanner.cpp"/>
<F N="../../lib/alg/lgs/mask.cpp"/>
<F N="../../lib/alg/generic/md5.cpp"/>
<F N="../../lib/components/object/objectConsoleLoggingService.cpp"/>
<F N="../../lib/components/object/objectFileLoggingService.cpp"/>
<F N="../../lib/components/object/objectPathfinderBinaryLog.cpp"/>
<F N="../../lib/components/object/objectSystemAnchor.cpp"/>
<F N="../../lib/hardware/sensors/optic_flow/adns3080/opticFlowADNS.cpp"/>
<F N="../../lib/App/Pathfinder/Pathfinder_Kernel.cpp"/>
<F N="../../lib/App/Pathfinder/PathfinderBackend.cpp"/>
<F N="../../lib/pathfinder/pathfinderDBConnector.cpp"/>
<F N="../../lib/data/ponvif/ponvif.cpp"/>
<F N="../../lib/data/protocol/protocol.cpp"/>
<F N="../../lib/data/protocol/protocolHTTP.cpp"/>
<F N="../../lib/hardware/uart/serialPort.cpp"/>
<F N="../../lib/hardware/spi/spiPort.cpp"/>
<F N="../../lib/data/ssdp/ssdpAnnouncer.cpp"/>
<F N="../../lib/alg/generic/Transform.cpp"/>
<F N="../../lib/data/transport/transportBus.cpp"/>
<F N="../../lib/data/transport/transportSerial.cpp"/>
<F N="../../lib/data/net/transportSocket.cpp"/>
<F N="../../lib/hardware/sensors/gps/UBLOX_I2C.cpp"/>
<F N="../../lib/alg/generic/utm.cpp"/>
<F N="../../lib/hardware/sensors/gps/XA1110_I2C.cpp"/>
<F N="../../lib/data/protocol/xmlParser.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="../../lib/alg/generic/base64.h"/>
<F N="../../lib/components/base/basicEventHandler.h"/>
<F N="../../lib/components/base/basicFunctionality.h"/>
<F N="../../lib/components/base/basicObject.h"/>
<F N="../../lib/components/base/basicSettingsProvider.h"/>
<F N="../../lib/components/base/basicThread.h"/>
<F N="../../lib/components/base/basicTypes.h"/>
<F N="../../lib/hardware/sensors/9dof/BNO055.h"/>
<F N="../../lib/data/mysql/database_class.h"/>
<F N="../../lib/hardware/sensors/gphoto/gPhotoCamera.h"/>
<F N="../../lib/alg/generic/heapDebug.h"/>
<F N="../../lib/hardware/i2c/i2cPort.h"/>
<F N="../../lib/alg/generic/libzip.h"/>
<F N="../../lib/hardware/sensors/lrf/lrfScanner.h"/>
<F N="../../lib/components/object/objectPathfinderBinaryLog.h"/>
<F N="../../lib/hardware/sensors/optic_flow/adns3080/opticFlowADNS.h"/>
<F N="../../lib/App/Pathfinder/Pathfinder_Kernel.h"/>
<F N="../../lib/App/Pathfinder/PathfinderBackend.h"/>
<F N="../../lib/pathfinder/pathfinderDBConnector.h"/>
<F N="../../lib/data/ponvif/ponvif.h"/>
<F N="../../lib/data/protocol/protocolHTTP.h"/>
<F N="../../lib/hardware/uart/serialPort.h"/>
<F N="../../lib/hardware/spi/spiPort.h"/>
<F N="../../lib/data/stbi/stb_image.h"/>
<F N="../../lib/data/stbi/stb_image_write.h"/>
<F N="../../lib/data/transport/transportBus.h"/>
<F N="../../lib/data/transport/transportSerial.h"/>
<F N="../../lib/data/transport/transportSocket.h"/>
<F N="../../lib/hardware/sensors/gps/UBLOX_I2C.h"/>
<F N="../../lib/hardware/sensors/gps/XA1110_I2C.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="makefile"
Type="Makefile"/>
</Folder>
</Files>
</Project>

6
Projects/Pathfinder/Pathfinder.vpw

@ -0,0 +1,6 @@
<!DOCTYPE Workspace SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpw.dtd">
<Workspace Version="10.0" VendorName="SlickEdit">
<Projects>
<Project File="Pathfinder.vpj"/>
</Projects>
</Workspace>

BIN
Projects/Pathfinder/Release/pathfinder

Binary file not shown.

9
Projects/Pathfinder/build

@ -0,0 +1,9 @@
#! /bin/sh
#make clean -e "CFG=Debug"
#make -e "CFG=Debug"
make clean -e "CFG=Release"
make -j4 -e "CFG=Release"

339
Projects/Pathfinder/makefile

@ -0,0 +1,339 @@
# SlickEdit generated file. Do not edit this file except in designated areas.
# Make command to use for dependencies
MAKE=make
RM=rm
MKDIR=mkdir
# -----Begin user-editable area-----
# -----End user-editable area-----
# If no configuration is specified, "Debug" will be used
ifndef CFG
CFG=Debug
endif
#
# Configuration: Debug
#
ifeq "$(CFG)" "Debug"
OUTDIR=Debug
OUTFILE=$(OUTDIR)/pathfinder
CFG_INC=
CFG_LIB=-lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig \
-lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice \
libavfilter libavformat libavutil libpostproc libswresample \
libswscale --libs` -lssl -lwiringPi -lwiringPiDev -lgphoto2 \
-lgphoto2_port
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicDualThread.o \
$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \
$(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \
$(OUTDIR)/basicObject.o $(OUTDIR)/basicPosition.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/BNO055.o $(OUTDIR)/clientPort.o \
$(OUTDIR)/curlRequest.o $(OUTDIR)/curlRequestsManager.o \
$(OUTDIR)/database_class.o $(OUTDIR)/gPhotoCamera.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/i2cPort.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o \
$(OUTDIR)/lrfScanner.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectPathfinderBinaryLog.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/opticFlowADNS.o $(OUTDIR)/Pathfinder_Kernel.o \
$(OUTDIR)/PathfinderBackend.o $(OUTDIR)/pathfinderDBConnector.o \
$(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/serialPort.o $(OUTDIR)/spiPort.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/transportBus.o \
$(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \
$(OUTDIR)/UBLOX_I2C.o $(OUTDIR)/utm.o $(OUTDIR)/XA1110_I2C.o \
$(OUTDIR)/xmlParser.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicDualThread.o \
$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \
$(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \
$(OUTDIR)/basicObject.o $(OUTDIR)/basicPosition.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/BNO055.o $(OUTDIR)/clientPort.o \
$(OUTDIR)/curlRequest.o $(OUTDIR)/curlRequestsManager.o \
$(OUTDIR)/database_class.o $(OUTDIR)/gPhotoCamera.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/i2cPort.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o \
$(OUTDIR)/lrfScanner.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectPathfinderBinaryLog.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/opticFlowADNS.o $(OUTDIR)/Pathfinder_Kernel.o \
$(OUTDIR)/PathfinderBackend.o $(OUTDIR)/pathfinderDBConnector.o \
$(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/serialPort.o $(OUTDIR)/spiPort.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/transportBus.o \
$(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \
$(OUTDIR)/UBLOX_I2C.o $(OUTDIR)/utm.o $(OUTDIR)/XA1110_I2C.o \
$(OUTDIR)/xmlParser.o -lpthread -lmysqlclient -lssl -lcurl -lm \
-lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config \
libavcodec libavdevice libavfilter libavformat libavutil libpostproc \
libswresample libswscale --libs` -lssl -lwiringPi -lwiringPiDev \
-lgphoto2 -lgphoto2_port
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -O3 -g -ggdb -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -O3 -g -ggdb -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/hardware/sensors/gps/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/transport/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/optic_flow/adns3080/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/9dof/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/lgs/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/pathfinder/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/Pathfinder/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/i2c/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/spi/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/uart/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/gphoto/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/lrf/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/net/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
$(OUTFILE): $(OUTDIR) $(OBJ)
$(LINK)
$(OUTDIR):
$(MKDIR) -p "$(OUTDIR)"
# Rebuild this project
rebuild: cleanall all
# Clean this project
clean:
$(RM) -f $(OUTFILE)
$(RM) -f $(OBJ)
# Clean this project and all dependencies
cleanall: clean
endif
#
# Configuration: Release
#
ifeq "$(CFG)" "Release"
OUTDIR=Release
OUTFILE=$(OUTDIR)/pathfinder
CFG_INC=
CFG_LIB=-lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig \
-lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice \
libavfilter libavformat libavutil libpostproc libswresample \
libswscale --libs` -lssl -lwiringPi -lwiringPiDev -lgphoto2 \
-lgphoto2_port
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicDualThread.o \
$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \
$(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \
$(OUTDIR)/basicObject.o $(OUTDIR)/basicPosition.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/BNO055.o $(OUTDIR)/clientPort.o \
$(OUTDIR)/curlRequest.o $(OUTDIR)/curlRequestsManager.o \
$(OUTDIR)/database_class.o $(OUTDIR)/gPhotoCamera.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/i2cPort.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o \
$(OUTDIR)/lrfScanner.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectPathfinderBinaryLog.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/opticFlowADNS.o $(OUTDIR)/Pathfinder_Kernel.o \
$(OUTDIR)/PathfinderBackend.o $(OUTDIR)/pathfinderDBConnector.o \
$(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/serialPort.o $(OUTDIR)/spiPort.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/transportBus.o \
$(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \
$(OUTDIR)/UBLOX_I2C.o $(OUTDIR)/utm.o $(OUTDIR)/XA1110_I2C.o \
$(OUTDIR)/xmlParser.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicDualThread.o \
$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \
$(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \
$(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \
$(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \
$(OUTDIR)/basicObject.o $(OUTDIR)/basicPosition.o \
$(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \
$(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \
$(OUTDIR)/basicTimeStamp.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/BNO055.o $(OUTDIR)/clientPort.o \
$(OUTDIR)/curlRequest.o $(OUTDIR)/curlRequestsManager.o \
$(OUTDIR)/database_class.o $(OUTDIR)/gPhotoCamera.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/i2cPort.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o \
$(OUTDIR)/lrfScanner.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectPathfinderBinaryLog.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/opticFlowADNS.o $(OUTDIR)/Pathfinder_Kernel.o \
$(OUTDIR)/PathfinderBackend.o $(OUTDIR)/pathfinderDBConnector.o \
$(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/serialPort.o $(OUTDIR)/spiPort.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/transportBus.o \
$(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \
$(OUTDIR)/UBLOX_I2C.o $(OUTDIR)/utm.o $(OUTDIR)/XA1110_I2C.o \
$(OUTDIR)/xmlParser.o -lpthread -lmysqlclient -lssl -lcurl -lm \
-lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config \
libavcodec libavdevice libavfilter libavformat libavutil libpostproc \
libswresample libswscale --libs` -lssl -lwiringPi -lwiringPiDev \
-lgphoto2 -lgphoto2_port
COMPILE=g++ -c -x c++ "-D__STDC_CONSTANT_MACROS" -O3 -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -O3 -s -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/hardware/sensors/gps/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/transport/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/optic_flow/adns3080/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/9dof/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/lgs/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/pathfinder/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/Pathfinder/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/i2c/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/spi/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/uart/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/gphoto/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/hardware/sensors/lrf/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/net/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
$(OUTFILE): $(OUTDIR) $(OBJ)
$(LINK)
$(OUTDIR):
$(MKDIR) -p "$(OUTDIR)"
# Rebuild this project
rebuild: cleanall all
# Clean this project
clean:
$(RM) -f $(OUTFILE)
$(RM) -f $(OBJ)
# Clean this project and all dependencies
cleanall: clean
endif

BIN
Projects/Pathfinder/spi-test/spidev_test

Binary file not shown.

210
Projects/Pathfinder/spi-test/spidev_test.c

@ -0,0 +1,210 @@
/*
* SPI testing utility (using spidev driver)
*
* Copyright (c) 2007 MontaVista Software, Inc.
* Copyright (c) 2007 Anton Vorontsov <avorontsov@ru.mvista.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* Cross-compile with cross-gcc -I/path/to/cross-kernel/include
*/
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
static void pabort(const char *s)
{
perror(s);
abort();
}
static const char *device = "/dev/spidev1.1";
static uint8_t mode;
static uint8_t bits = 8;
static uint32_t speed = 500000;
static uint16_t delay;
static void transfer(int fd)
{
int ret;
uint8_t tx[] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x40, 0x00, 0x00, 0x00, 0x00, 0x95,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xDE, 0xAD, 0xBE, 0xEF, 0xBA, 0xAD,
0xF0, 0x0D,
};
uint8_t rx[ARRAY_SIZE(tx)] = {0, };
struct spi_ioc_transfer tr = {
.tx_buf = (unsigned long)tx,
.rx_buf = (unsigned long)rx,
.len = ARRAY_SIZE(tx),
.delay_usecs = delay,
.speed_hz = speed,
.bits_per_word = bits,
};
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
if (ret < 1)
pabort("can't send spi message");
for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {
if (!(ret % 6))
puts("");
printf("%.2X ", rx[ret]);
}
puts("");
}
static void print_usage(const char *prog)
{
printf("Usage: %s [-DsbdlHOLC3]\n", prog);
puts(" -D --device device to use (default /dev/spidev1.1)\n"
" -s --speed max speed (Hz)\n"
" -d --delay delay (usec)\n"
" -b --bpw bits per word \n"
" -l --loop loopback\n"
" -H --cpha clock phase\n"
" -O --cpol clock polarity\n"
" -L --lsb least significant bit first\n"
" -C --cs-high chip select active high\n"
" -3 --3wire SI/SO signals shared\n");
exit(1);
}
static void parse_opts(int argc, char *argv[])
{
while (1) {
static const struct option lopts[] = {
{ "device", 1, 0, 'D' },
{ "speed", 1, 0, 's' },
{ "delay", 1, 0, 'd' },
{ "bpw", 1, 0, 'b' },
{ "loop", 0, 0, 'l' },
{ "cpha", 0, 0, 'H' },
{ "cpol", 0, 0, 'O' },
{ "lsb", 0, 0, 'L' },
{ "cs-high", 0, 0, 'C' },
{ "3wire", 0, 0, '3' },
{ "no-cs", 0, 0, 'N' },
{ "ready", 0, 0, 'R' },
{ NULL, 0, 0, 0 },
};
int c;
c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR", lopts, NULL);
if (c == -1)
break;
switch (c) {
case 'D':
device = optarg;
break;
case 's':
speed = atoi(optarg);
break;
case 'd':
delay = atoi(optarg);
break;
case 'b':
bits = atoi(optarg);
break;
case 'l':
mode |= SPI_LOOP;
break;
case 'H':
mode |= SPI_CPHA;
break;
case 'O':
mode |= SPI_CPOL;
break;
case 'L':
mode |= SPI_LSB_FIRST;
break;
case 'C':
mode |= SPI_CS_HIGH;
break;
case '3':
mode |= SPI_3WIRE;
break;
case 'N':
mode |= SPI_NO_CS;
break;
case 'R':
mode |= SPI_READY;
break;
default:
print_usage(argv[0]);
break;
}
}
}
int main(int argc, char *argv[])
{
int ret = 0;
int fd;
parse_opts(argc, argv);
fd = open(device, O_RDWR);
if (fd < 0)
pabort("can't open device");
/*
* spi mode
*/
ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
if (ret == -1)
pabort("can't set spi mode");
ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
if (ret == -1)
pabort("can't get spi mode");
/*
* bits per word
*/
ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
if (ret == -1)
pabort("can't set bits per word");
ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
if (ret == -1)
pabort("can't get bits per word");
/*
* max speed hz
*/
ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
if (ret == -1)
pabort("can't set max speed hz");
ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed);
if (ret == -1)
pabort("can't get max speed hz");
printf("spi mode: %d\n", mode);
printf("bits per word: %d\n", bits);
printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000);
transfer(fd);
close(fd);
return ret;
}

22
Projects/Pathfinder/spi-test/test_me

@ -0,0 +1,22 @@
#!/bin/bash
gpio write 21 1
sleep 1
gpio read 21
gpio write 21 0
sleep 1
gpio read 21
echo "Reset issued"
gpio write 10 0
gpio write 10 1
gpio write 10 0
gpio write 10 1
gpio write 10 0
gpio write 10 1
gpio write 10 0
gpio write 10 1
gpio write 10 0
gpio write 10 1
gpio write 10 0
gpio write 10 1
echo "Blonk Done!"

BIN
Projects/Pathfinder/wiringpi-latest.deb

Binary file not shown.

24
Projects/argus/argus.vpj

@ -272,38 +272,49 @@
<F N="../../lib/components/base/basicSettingsProvider.cpp"/>
<F N="../../lib/components/base/basicThread.cpp"/>
<F N="../../lib/components/base/basicTimeStamp.cpp"/>
<F N="../../lib/components/base/basicTransport.cpp"/>
<F N="../../lib/components/base/basicTypes.cpp"/>
<F N="../../lib/data/net/clientPort.cpp"/>
<F N="../../lib/data/curl/curlRequest.cpp"/>
<F N="../../lib/data/curl/curlRequestsManager.cpp"/>
<F N="../../lib/data/mysql/database_class.cpp"/>
<F N="../../lib/alg/generic/heapDebug.cpp"/>
<F N="../../lib/data/json/json_reader.cpp"/>
<F N="../../lib/data/json/json_value.cpp"/>
<F N="../../lib/data/json/json_writer.cpp"/>
<F N="../../lib/alg/generic/libzip.cpp"/>
<F N="../../lib/alg/lgs/mask.cpp"/>
<F N="../../lib/alg/generic/md5.cpp"/>
<F N="../../lib/components/object/objectConsoleLoggingService.cpp"/>
<F N="../../lib/components/object/objectFileLoggingService.cpp"/>
<F N="../../lib/components/object/objectSystemAnchor.cpp"/>
<F N="../../lib/data/protocol/onvifMediaObserver.cpp"/>
<F N="../../lib/data/ponvif/ponvif.cpp"/>
<F N="../../lib/data/protocol/protocol.cpp"/>
<F N="../../lib/data/protocol/protocolDefender.cpp"/>
<F N="../../lib/data/protocol/protocolHTTP.cpp"/>
<F N="../../lib/data/protocol/protocolLGS.cpp"/>
<F N="../../lib/data/protocol/protocolSafeShore.cpp"/>
<F N="../../lib/data/protocol/protocolZLMEDIA.cpp"/>
<F N="../../lib/App/argus/RGoose_Kernel.cpp"/>
<F N="../../lib/rgoose/rgooseCamera.cpp"/>
<F N="../../lib/rgoose/rgooseDBConnector.cpp"/>
<F N="../../lib/rgoose/rgooseIPCamera.cpp"/>
<F N="../../lib/rgoose/rgooseModuleFactory.cpp"/>
<F N="../../lib/rgoose/rgooseNode.cpp"/>
<F N="../../lib/rgoose/rgooseNode3D.cpp"/>
<F N="../../lib/rgoose/rgooseNodeFactory.cpp"/>
<F N="../../lib/rgoose/rgooseServerModule.cpp"/>
<F N="../../lib/rgoose/rgooseUSBRelayModule.cpp"/>
<F N="../../lib/rgoose/rgooseZLMediaModule.cpp"/>
<F N="../../lib/data/servletWS/servletChannelWS.cpp"/>
<F N="../../lib/data/servletWS/servletClientHandlerWS.cpp"/>
<F N="../../lib/data/servletWS/servletWS.cpp"/>
<F N="../../lib/data/ssdp/ssdpAnnouncer.cpp"/>
<F N="../../lib/alg/generic/Transform.cpp"/>
<F N="../../lib/data/net/transportSocket.cpp"/>
<F N="../../lib/alg/generic/utm.cpp"/>
<F N="../../lib/data/protocol/xmlParser.cpp"/>
<F N="../../lib/data/zlMediaServer/zlMediaConnector.cpp"/>
</Folder>
<Folder
Name="Header Files"
@ -316,17 +327,26 @@
<F N="../../lib/components/base/basicSettingsProvider.h"/>
<F N="../../lib/components/base/basicThread.h"/>
<F N="../../lib/components/base/basicTypes.h"/>
<F N="../../lib/data/mysql/database_class.h"/>
<F N="../../lib/alg/generic/heapDebug.h"/>
<F N="../../lib/alg/generic/libzip.h"/>
<F N="../../lib/data/ponvif/ponvif.h"/>
<F N="../../lib/data/protocol/protocolHTTP.h"/>
<F N="../../lib/data/protocol/protocolLGS.h"/>
<F N="../../lib/data/protocol/protocolZLMEDIA.h"/>
<F N="../../lib/App/argus/RGoose_Kernel.h"/>
<F N="../../lib/rgoose/rgooseCamera.h"/>
<F N="../../lib/rgoose/rgooseDBConnector.h"/>
<F N="../../lib/rgoose/rgooseIPCamera.h"/>
<F N="../../lib/rgoose/rgooseModule.h"/>
<F N="../../lib/rgoose/rgooseModuleFactory.h"/>
<F N="../../lib/rgoose/rgooseNode.h"/>
<F N="../../lib/rgoose/rgooseNode3D.h"/>
<F N="../../lib/rgoose/rgooseNodeFactory.h"/>
<F N="../../lib/rgoose/rgooseServerModule.h"/>
<F N="../../lib/rgoose/rgooseUSBRelayModule.h"/>
<F N="../../lib/data/zlMediaServer/zlMediaConnector.h"/>
<F N="../../lib/rgoose/rgooseZLMediaModule.h"/>
<F N="../../lib/data/servletWS/servletClientHandlerWS.h"/>
</Folder>
<Folder
Name="Resource Files"

148
Projects/argus/makefile

@ -35,22 +35,26 @@ COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/basicTransport.o $(OUTDIR)/basicTypes.o \
$(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/mask.o \
$(OUTDIR)/md5.o $(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/protocol.o $(OUTDIR)/protocolDefender.o \
$(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolLGS.o \
$(OUTDIR)/protocolSafeShore.o $(OUTDIR)/protocolZLMEDIA.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseDBConnector.o \
$(OUTDIR)/rgooseIPCamera.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseCamera.o \
$(OUTDIR)/rgooseDBConnector.o $(OUTDIR)/rgooseIPCamera.o \
$(OUTDIR)/rgooseModuleFactory.o $(OUTDIR)/rgooseNode.o \
$(OUTDIR)/rgooseNode3D.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/rgooseServerModule.o $(OUTDIR)/rgooseUSBRelayModule.o \
$(OUTDIR)/servletChannelWS.o $(OUTDIR)/servletClientHandlerWS.o \
$(OUTDIR)/servletWS.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
$(OUTDIR)/zlMediaConnector.o
$(OUTDIR)/rgooseZLMediaModule.o $(OUTDIR)/servletChannelWS.o \
$(OUTDIR)/servletClientHandlerWS.o $(OUTDIR)/servletWS.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
@ -61,30 +65,38 @@ ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/basicTransport.o $(OUTDIR)/basicTypes.o \
$(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/mask.o \
$(OUTDIR)/md5.o $(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/protocol.o $(OUTDIR)/protocolDefender.o \
$(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolLGS.o \
$(OUTDIR)/protocolSafeShore.o $(OUTDIR)/protocolZLMEDIA.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseDBConnector.o \
$(OUTDIR)/rgooseIPCamera.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseCamera.o \
$(OUTDIR)/rgooseDBConnector.o $(OUTDIR)/rgooseIPCamera.o \
$(OUTDIR)/rgooseModuleFactory.o $(OUTDIR)/rgooseNode.o \
$(OUTDIR)/rgooseNode3D.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/rgooseServerModule.o $(OUTDIR)/rgooseUSBRelayModule.o \
$(OUTDIR)/servletChannelWS.o $(OUTDIR)/servletClientHandlerWS.o \
$(OUTDIR)/servletWS.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
$(OUTDIR)/zlMediaConnector.o -lpthread -lmysqlclient -lssl -lcurl \
-lm -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config \
libavcodec libavdevice libavfilter libavformat libavutil libpostproc \
libswresample libswscale --libs` -lssl
$(OUTDIR)/rgooseZLMediaModule.o $(OUTDIR)/servletChannelWS.o \
$(OUTDIR)/servletClientHandlerWS.o $(OUTDIR)/servletWS.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
-lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz \
-lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice \
libavfilter libavformat libavutil libpostproc libswresample \
libswscale --libs` -lssl
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -g -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -g -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/alg/lgs/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
@ -94,7 +106,7 @@ $(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(OUTDIR)/%.o : ../../lib/App/argus/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/zlMediaServer/%.cpp
$(OUTDIR)/%.o : ../../lib/rgoose/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
@ -106,10 +118,13 @@ $(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/rgoose/%.cpp
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(OUTDIR)/%.o : ../../lib/data/servletWS/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/net/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
@ -121,9 +136,6 @@ $(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/servletWS/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
@ -166,22 +178,26 @@ COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/basicTransport.o $(OUTDIR)/basicTypes.o \
$(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/mask.o \
$(OUTDIR)/md5.o $(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/protocol.o $(OUTDIR)/protocolDefender.o \
$(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolLGS.o \
$(OUTDIR)/protocolSafeShore.o $(OUTDIR)/protocolZLMEDIA.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseDBConnector.o \
$(OUTDIR)/rgooseIPCamera.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseCamera.o \
$(OUTDIR)/rgooseDBConnector.o $(OUTDIR)/rgooseIPCamera.o \
$(OUTDIR)/rgooseModuleFactory.o $(OUTDIR)/rgooseNode.o \
$(OUTDIR)/rgooseNode3D.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/rgooseServerModule.o $(OUTDIR)/rgooseUSBRelayModule.o \
$(OUTDIR)/servletChannelWS.o $(OUTDIR)/servletClientHandlerWS.o \
$(OUTDIR)/servletWS.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
$(OUTDIR)/zlMediaConnector.o
$(OUTDIR)/rgooseZLMediaModule.o $(OUTDIR)/servletChannelWS.o \
$(OUTDIR)/servletClientHandlerWS.o $(OUTDIR)/servletWS.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
@ -192,30 +208,38 @@ ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/basicTransport.o $(OUTDIR)/basicTypes.o \
$(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/heapDebug.o $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/mask.o \
$(OUTDIR)/md5.o $(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/protocol.o $(OUTDIR)/protocolDefender.o \
$(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolLGS.o \
$(OUTDIR)/protocolSafeShore.o $(OUTDIR)/protocolZLMEDIA.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseDBConnector.o \
$(OUTDIR)/rgooseIPCamera.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseCamera.o \
$(OUTDIR)/rgooseDBConnector.o $(OUTDIR)/rgooseIPCamera.o \
$(OUTDIR)/rgooseModuleFactory.o $(OUTDIR)/rgooseNode.o \
$(OUTDIR)/rgooseNode3D.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/rgooseServerModule.o $(OUTDIR)/rgooseUSBRelayModule.o \
$(OUTDIR)/servletChannelWS.o $(OUTDIR)/servletClientHandlerWS.o \
$(OUTDIR)/servletWS.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
$(OUTDIR)/zlMediaConnector.o -lpthread -lmysqlclient -lssl -lcurl \
-lm -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config \
libavcodec libavdevice libavfilter libavformat libavutil libpostproc \
libswresample libswscale --libs` -lssl
$(OUTDIR)/rgooseZLMediaModule.o $(OUTDIR)/servletChannelWS.o \
$(OUTDIR)/servletClientHandlerWS.o $(OUTDIR)/servletWS.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o \
$(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
-lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz \
-lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice \
libavfilter libavformat libavutil libpostproc libswresample \
libswscale --libs` -lssl
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/alg/lgs/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
@ -225,7 +249,7 @@ $(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(OUTDIR)/%.o : ../../lib/App/argus/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/zlMediaServer/%.cpp
$(OUTDIR)/%.o : ../../lib/rgoose/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
@ -237,10 +261,13 @@ $(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/rgoose/%.cpp
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(OUTDIR)/%.o : ../../lib/data/servletWS/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/net/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
@ -252,9 +279,6 @@ $(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/servletWS/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)

275
lib/App/Pathfinder/PathfinderBackend.cpp

@ -0,0 +1,275 @@
#include "PathfinderBackend.h"
// Global Variables
CSTR gsCFG_ADDRESS;
uint16_t guCFG_PORT = DEFAULT_SERVER_PORT;
CSTR gsCFG_LICENSE;
CSTR gsCFG_DB_SERVER;
CSTR gsCFG_DB_NAME;
CSTR gsCFG_DB_USER;
CSTR gsCFG_DB_PASSWORD;
CSTR gsCFG_PID_FILE = (CSTR) DEFAULT_SERVER_PID_FILE;
SOFTWARE_INFO gsSOFT_INFO;
bool gbCFG_MASTER_ROLE = true;
bool gModule_GeoFence_Enabled = true;
bool gModule_SMS_Enabled = false;
bool gModule_Email_Enabled = false;
bool gSignal_Handler_Enabled = true;
#define LOG( X ) m_pLog->Log( "main", 0, X )
#define LOG_ERROR( X ) m_pLog->Log( "main", 0, _LOG_ERROR, X )
PF_Kernel * Kernel = NULL;
//LRF_HardwareManager * HWManager = NULL;
basicLogCollection * m_pLog = NULL;
//networkServer * NetworkManager = NULL;
void (*old_update_handler_2)(int); //SIGINT
void (*old_kill_handler_3)(int); //SIGQUIT
void (*old_kill_handler_9)(int); //SIGKILL
void (*old_alarm_handler_14)(int); //SIGALRM
void (*old_kill_handler_15)(int); //SIGTERM
void signal_SIGKILL_handler( int SIG ){
if( Kernel!= NULL ){
if( gSignal_Handler_Enabled ){
m_pLog->Log("SIG", 0, _LOG_DEBUG, "Shutdown Service by Signal" );
Kernel->setStatus( TH_ENDED ); // Closing all Connections;
} else {
m_pLog->Log("SIG", 0, _LOG_DEBUG, "Shutdown Signal Handler Disabled" );
};
};
};
void myInterrupt4(void){
//LOG("HW_SIGNAL_PIO4");
Kernel->armStatusChanged();
};
int main (int argc, char *argv[]){
MySQL_Connector * DBC = NULL;
basicSettingsProvider * SETTINGS = NULL;
bool WBG; // Working Background
bool SSE; // Server Statistics Engine
bool NDC; // No Default Configuration
CSTR FLE_NAME;
CSTR DCF_NAME;
CSTR SSP_NAME;
objectFileLoggingService * FLE = NULL;
objectConsoleLoggingService * CLE = NULL;
// default init
WBG = true;
FLE_NAME = (CSTR) DEFAULT_SERVER_LOG_FILE;
SSE = true;
NDC = true;
DCF_NAME = (CSTR) DEFAULT_SERVER_CONFIG_PATH;
SSP_NAME = (CSTR) DEFAULT_SERVER_SOCKET_PATH;
gsSOFT_INFO.SW_BUILD_DATE = UNIX_TIMESTAMP;
gsSOFT_INFO.DATA_VALID = false;
m_pLog = basicLogCollection::getInstance();
gsSOFT_INFO.SW_MODE_FLAGS = 0
#ifdef SKIP_TARGET_LOG
| SW_INFO_NO_TARGET_LOG
#endif
#ifdef HIBERNATE_ENABLE
| SW_INFO_HIBERNATE_ENA
#endif
#ifdef TGD
| SW_INFO_TGD_MOTORS
#ifdef TGD_VERSION_2
| SW_INFO_TGD_VER_2
#endif
#endif
#ifdef ENCODER_8192
| SW_INFO_EU_PROJECT
#endif
#ifdef NO_BLACK_TARGETS
| SW_INFO_NO_BLACK_TARGETS
#endif
#ifndef NO_MOTORS
| SW_INFO_MOTOR_CTRL_ENA
#endif
#ifdef THREADED_FLIP
| SW_INFO_THREAD_FLIP
#endif
#ifndef PRU_SLAVE
| SW_INFO_FLAG_MASTER
#endif
#ifdef DEBUG
| SW_INFO_DEBUG_MODE
#endif
;
// Reading Config
if( argc > 1 ){
for( int i = 0; i < argc; i++ ){
switch( argv[i][0] ){
case '-':
case '\\':
case '/':{
switch( argv[i][1] ){
case 'h': case 'H': case 'v': case 'V': case '?':{
printf( "Dr Frucht Systems R-Goose Server\n");
printf( "Software version <%s>\n", VERSION_NUMBER );
printf( " -h -H This Message\n" );
printf( " -i -I Interactive Mode\n" );
return 0;
break;
};
case 'i': case 'I':{
WBG = false;
CLE = new objectConsoleLoggingService();
if( CLE != NULL ) {
m_pLog->addHandler( CLE );
};
break;
};
case 'c': case 'C':{
DCF_NAME = (CSTR) malloc( MAX_PATH_LEN );
if( DCF_NAME != NULL ) {
sprintf( DCF_NAME, "%s", argv[i+1] );
} else {
printf("ERROR!\n\n");
return -1;
};
break;
};
};
break;
};
};
};
};
FLE = new objectFileLoggingService( FLE_NAME );
if( FLE != NULL ) {
m_pLog->addHandler( FLE );
};
LOG("Starting Log Engne!");
if ( fileExist( DCF_NAME ) ){
SETTINGS = basicSettingsProvider::getInstance(DCF_NAME);
} else {
SETTINGS = basicSettingsProvider::getInstance();
};
// Demonizing or not
if( WBG ){
printf( "Dr Frucht Systems LRF Server ver. %s\n", VERSION_NUMBER );
printf( "Configuration Applied:\n");
printf( " Service Established %s at %d\n", gsCFG_ADDRESS, guCFG_PORT );
printf( " PID File: %s\n", gsCFG_PID_FILE );
printf( " Log File: %s\n", FLE_NAME );
printf( " License: %s\n", gsCFG_LICENSE );
printf( " Database Server: %s Database: %s\n", gsCFG_DB_SERVER, gsCFG_DB_NAME );
if( NDC ){
printf( " No configuration file (%s) supplied.\n", DCF_NAME);
} else {
printf( " Configuration read from: %s\n", DCF_NAME );
};
//Demonizing
pid_t pid, sid;
sync();
close( STDIN_FILENO );
close( STDOUT_FILENO );
close( STDERR_FILENO );
pid = fork();
if( pid < 0 ){
return pid;
};
if( pid > 0 ){
return 0;
};
//umask(0);
sid = setsid();
if (sid < 0) {
return sid;
};
pid = fork();
if( pid < 0 ){
return pid;
};
if( pid > 0 ){
FILE *pPIDF = fopen( gsCFG_PID_FILE, "w+" );
if( pPIDF ){
fprintf( pPIDF, "%d\n", pid );
fclose( pPIDF );
}
return 0;
};
};
if( wiringPiSetup() == -1 ){
LOG_ERROR("WiringPI Init failure!");
char tBuffer[256];
sprintf( tBuffer, "Error code: %d", errno );
LOG_ERROR( tBuffer );
return -1;
} else {
#ifdef DEBUG
LOG("WiringPI Init OK");
#endif
//wiringPiSetupGpio();
pinMode( 4, INPUT ); // ARM BTN
pinMode( 21, OUTPUT ); // Reset ADNS
//pinMode( 10, OUTPUT ); // NCS ADNS
//pinMode( 30, OUTPUT );
};
// Starting Services^
uint8_t m_bKernelExitCode = 0;
do{
Kernel = new PF_Kernel();
if( Kernel == NULL ) {
// Aborting Work
LOG_ERROR( "++++ Kernel failed to born ++++" );
unlink( gsCFG_PID_FILE );
LOG( "PID File Deleted" );
delete( m_pLog );
return -1;
};
//Loop till some Restart action
if( Kernel != NULL ){
LOG( "++++ Server Started ++++" );
if ( Kernel->create() == false ){
LOG_ERROR("Kernel create failure!");
} else {
//Instal HW ISR Listener
if( wiringPiISR( 4, INT_EDGE_RISING, &myInterrupt4 ) == -1 ){
LOG_ERROR("Can not setup ISR handler!");
char tBuffer[256];
sprintf( tBuffer, "Error code: %d", errno );
LOG_ERROR( tBuffer );
} else {
//Install Signal Listeners
old_kill_handler_15 = signal( 15, signal_SIGKILL_handler );
old_kill_handler_9 = signal( 9, signal_SIGKILL_handler );
// Waiting for Worker to Shut Down
Kernel->WaitFinish( false );
m_bKernelExitCode = Kernel->getExitCause();
signal( 9, old_kill_handler_9 );
signal( 15, old_kill_handler_15 );
};
};
delete( Kernel );
LOG( "++++ Server Ended ++++" );
};
} while( m_bKernelExitCode > 0 );
//delete( NetworkManager );
//LOG( "++++ CDC DEL ++++" );
unlink( gsCFG_PID_FILE );
LOG( "PID File Deleted" );
if( FLE!= NULL ) delete( FLE );
if( CLE!= NULL ) delete( CLE );
delete( m_pLog );
return(0);
}

46
lib/App/Pathfinder/PathfinderBackend.h

@ -0,0 +1,46 @@
/*******************************************************************
*
* DESCRIPTION: Argus project main header file
*
* AUTHOR: Gagua
*
* HISTORY:
*
* DATE:5/29/2019
*
*******************************************************************/
#ifndef __ARGUS_BACKEND_MAIN_HEADER__
#define __ARGUS_BACKEND_MAIN_HEADER__
/** include files **/
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include "../../components/base/basicSettings.h"
#include "../../components/base/basicLogCollection.h"
#include "../../components/base/basicMemoryOperation.h"
#include "../../components/object/objectFileLoggingService.h"
#include "../../components/object/objectConsoleLoggingService.h"
#include "Pathfinder_Kernel.h"
/** local definitions **/
//http://xmsecu.com:8080/ocx/NewActive.exe
/* default settings */
/** external functions **/
/** external data **/
/** internal functions **/
/** public data **/
/** private data **/
/** public functions **/
/** private functions **/
#endif

736
lib/App/Pathfinder/Pathfinder_Kernel.cpp

@ -0,0 +1,736 @@
/*******************************************************************
*
* DESCRIPTION: ARGUS Kernel source
*
* AUTHOR: gagua
*
* HISTORY:
*
* DATE:5/29/2019
*
*******************************************************************/
#include "Pathfinder_Kernel.h"
#include <sys/types.h>
#define LOG( X ) m_pLog->Log( "KRNL", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "KRNL", this, _LOG_ERROR, X )
PF_Kernel::PF_Kernel( config_setting_t *Settings ):basicThread(){
m_bExitCause = 0;
m_bCreatedDBC = false;
m_pDBC = NULL;
m_pBNO = NULL;
m_pGPS = NULL;
m_pCamera = NULL;
m_pScanner = NULL;
m_tTimeTSeconds = time( NULL );
m_bArmed = ( bool ) digitalRead ( 4 );
m_pLog = basicLogCollection::getInstance();
m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, "KERNEL" );
m_pServiceAnnouncer = new ssdpAnnouncer( m_pSettings );
m_pBLOG = objectPathfinderBinaryLog::getInstance();
m_bGPSis3D = false;
m_bStartMode = PF_START_ON_ALT;
m_bHWFlags = PF_HW_NONE;
};
PF_Kernel::~PF_Kernel(){
#ifdef DEBUG
LOG("Destructor");
#endif
WaitFinish(true);
#ifdef DEBUG
LOG("Deleting Components");
#endif
if( m_pGPS!= NULL ) delete( m_pGPS );
if( m_pBNO!= NULL ) delete( m_pBNO );
if( m_pCamera!= NULL ) delete( m_pCamera );
if( m_pScanner!= NULL ) delete( m_pScanner );
#ifdef DEBUG
LOG("Unregister Server DBC");
#endif
if( m_pDBC != NULL ) {
m_pDBC->unregisterServer();
if(m_bCreatedDBC) {
delete( m_pDBC );
};
};
#ifdef DEBUG
LOG("Destructor Finished");
#endif
};
#include <sys/types.h>
#include <ifaddrs.h>
bool PF_Kernel::create( void ){
char tBuffer[256];
if( m_pSettings != NULL ) {
config_setting_t * pSetting;
int tVal;
const char * tBuf;
//Connect( CSTR DBName, CSTR DBHost, CSTR DBUser, CSTR DBPassword, uint16_t Port = 3300 );
LOG("Getting Settings ...");
/*if( !config_setting_lookup_string( m_pSettings, ARGUS_KERNEL_TAG_SERVER_IDENTITY, &tBuf ) ){
char * tVar;
char * tTS;
tTS = getTStr(NULL);
tVar = MD5String(tTS);
free(tTS);
sprintf( m_sIdentity, tVar );
pSetting = config_setting_add( m_pSettings, ARGUS_KERNEL_TAG_SERVER_IDENTITY, CONFIG_TYPE_STRING );
config_setting_set_string( pSetting, tVar );
free( tVar );
basicSettingsProvider::getInstance()->compromise();
LOG("Server Identity not defined - generating new!");
} else {
sprintf( m_sIdentity, tBuf );
sprintf( tBuffer, "Server Identity Read From Settings: %s", tBuf );
LOG( tBuffer );
};
if( !config_setting_lookup_int( m_pSettings, ARGUS_KERNEL_TAG_SITE_ID, &tVal ) ){
tVal = m_nSiteID = 1;
pSetting = config_setting_add( m_pSettings, ARGUS_KERNEL_TAG_SITE_ID, CONFIG_TYPE_INT );
config_setting_set_int( pSetting, tVal );
basicSettingsProvider::getInstance()->compromise();
LOG("Site ID not defined - using [1] as number!");
} else {
m_nSiteID = tVal;
sprintf( tBuffer, "Site ID Read From Settings: %d", m_nSiteID );
LOG( tBuffer );
};
*/
/*
#ifdef __EU_PROJECT__
if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_SAFE_SHORE, &tVal ) ){
tVal = m_bSafeShoreSupport = true;
pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_SAFE_SHORE, CONFIG_TYPE_BOOL );
config_setting_set_bool( pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("Safe-Shore support not defined");
} else {
m_bSafeShoreSupport = (bool)tVal;
sprintf( tBuffer, "Safe-Shore support Read From Settings: %d", tVal );
LOG( tBuffer );
};
#endif
if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_DEFENDER, &tVal ) ){
tVal = m_bDefenderSupport = true;
pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_DEFENDER, CONFIG_TYPE_BOOL );
config_setting_set_bool( pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("Defender support not defined");
} else {
m_bDefenderSupport = (bool)tVal;
sprintf( tBuffer, "Defender support Read From Settings: %d", tVal );
LOG( tBuffer );
};
if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, &tVal )){
tVal = m_nWidth = 1000;
pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, CONFIG_TYPE_INT);
config_setting_set_int(pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("No Detector Width");
} else {
m_nWidth = tVal;
sprintf( tBuffer, "Detector Width Read From Settings: %d", tVal );
LOG( tBuffer );
};
if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_FILTER_KERNELS, &tVal )){
tVal = m_nKernelFilter = 0x000000ff;
pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_FILTER_KERNELS, CONFIG_TYPE_INT);
config_setting_set_int(pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("No Fltered Kernels Defined - All LRF Will Work");
} else {
m_nKernelFilter = tVal;
sprintf( tBuffer, "Filter Kernels Read From Settings: %d", tVal );
LOG( tBuffer );
};
if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_SST, &tVal )){
tVal = m_nSST = 0;
pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_SST, CONFIG_TYPE_INT);
config_setting_set_int(pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("No Detector SST");
} else {
m_nSST = tVal;
sprintf( tBuffer, "Detector SST Read From Settings: %d", tVal );
LOG( tBuffer );
};
if( m_pSettingsProvider->isCompromised() ) {
LOG("Save Settings");
m_pSettingsProvider->validate();
};
*/
} else {
LOG_ERROR("Failed Read Config Settings!");
return false;
};
m_bCreatedDBC = false;
if( m_pDBC == NULL ) {
LOG("Explicitly Create DBC Object");
m_bCreatedDBC = true;
m_pDBC = new PATHFINDER_DBC( m_pSettings );
if( m_pDBC == NULL ){
LOG_ERROR("DBC Object Creation Failure!");
return false;
};
if( !m_pDBC->connect() ){
LOG_ERROR("DBC Connection Failure!");
SLEEP(5000);
//ToDO: Set Restart Kernel!
return false;
};
};
//char tBuffer[CTEXT];
struct ifaddrs * ifaddr = NULL;
struct ifaddrs * ifa;
/* Add Network Interfaces */
if( -1 == getifaddrs(&ifaddr)) {
LOG_ERROR("Cannot get Net Integfaces!");
m_pDBC->registerServer( "--NA--" );
} else {
bool regs = false;
for( ifa = ifaddr; ifa; ifa = ifa->ifa_next ) {
if (ifa->ifa_addr->sa_family != AF_INET) continue;
char ip[16];
struct sockaddr_in *inn;
unsigned char A,B,C,D;
inn = (struct sockaddr_in *)ifa->ifa_addr;
D = ( inn->sin_addr.s_addr >> 24) & 0xFF;
C = ( inn->sin_addr.s_addr >> 16) & 0xFF;
B = ( inn->sin_addr.s_addr >> 8) & 0xFF;
A = ( inn->sin_addr.s_addr >> 0) & 0xFF;
sprintf( ip, "%d.%d.%d.%d", A, B, C, D );
sprintf( tBuffer, "Network Interface: %s [%s]", ifa->ifa_name, ip );
if( strncmp( ifa->ifa_name,"eth", 3) == 0 ) {
regs = true;
m_pDBC->registerServer( ip );
};
LOG(tBuffer);
//m_pDBC->addNodeSocket( m_nServerNodeID, ARGUS_NODE_SOCK_TYPE_NETWORK, ifa->ifa_name, ip );
};
if(!regs) {
LOG_ERROR("Ethernet IP address Not Defined!");
m_pDBC->registerServer( "--NA--" );
};
freeifaddrs( ifaddr );
};
#ifdef DEBUG
LOG( "Settings Read Done" );
#endif
m_pDBC->clenupCommandQueue();
m_pDBC->setArmMode( m_bArmed );
m_pBLOG->attachDBC( m_pDBC );
#ifdef DEBUG
LOG("Init Optic Flow");
#endif
m_pFlow = new opticFlow( m_pSettings, m_pDBC );
if( m_pFlow != NULL ) {
if( !m_pFlow->create() ){
LOG_ERROR("FLOW Creation failure!");
} else {
m_bHWFlags |= PF_HW_OPF;
};
} else {
LOG_ERROR("FLOW Construction failure!");
};
#ifdef DEBUG
LOG("Init IMU");
#endif
m_pBNO = new sensorBNO( m_pSettings, m_pDBC );
if( m_pBNO != NULL ) {
if( !m_pBNO->create() ){
LOG_ERROR("BNO Creation failure!");
} else {
m_bHWFlags |= PF_HW_BNO;
};
} else {
LOG_ERROR("BNO Construction failure!");
};
#ifdef DEBUG
LOG("Init GPS");
#endif
m_pGPS = new sensorXA1110( m_pSettings, m_pDBC );
if( m_pGPS != NULL ) {
if( !m_pGPS->create() ){
LOG_ERROR("GPS Creation failure!");
} else {
m_bHWFlags |= PF_HW_GPS;
};
};
#ifdef DEBUG
LOG( "Start SSDP Beacon" );
#endif
if( m_pServiceAnnouncer != NULL ) {
if( !m_pServiceAnnouncer->init() ){
delete(m_pServiceAnnouncer);
m_pServiceAnnouncer = NULL;
};
};
#ifdef DEBUG
LOG("Init Camera");
#endif
m_pCamera = new gPhotoCamera( m_pSettings, m_pDBC );
if( m_pCamera != NULL ) {
if( !m_pCamera->create() ){
LOG_ERROR("Photo Creation failure!");
} else {
m_bHWFlags |= PF_HW_PHO;
};
};
#ifdef DEBUG
LOG("Init LRF Scanner");
#endif
m_pScanner = new LRF_techScanner( m_pSettings, m_pDBC );
if( m_pScanner != NULL ) {
if( !m_pScanner->create() ){
LOG_ERROR( "Error Create LRF Scanner!" );
} else {
m_bHWFlags |= PF_HW_LRF;
};
};
m_pDBC->updateHW_STATUS( m_bHWFlags );
if( ( m_bHWFlags & PF_HW_LRF ) == PF_HW_LRF ) {
uint8_t tStartModeLRF;
if( m_pDBC->getStartModeLRF( &tStartModeLRF )) {
if ( tStartModeLRF == PF_START_ON_PWR ) {
m_pScanner->startScan();
};
if( tStartModeLRF == PF_START_ON_ARM ) {
if( m_bArmed ) m_pScanner->startScan();
};
};
};
#ifdef DEBUG
LOG( "Kernel Trhead is about to be Created" );
#endif
if( init() == false ){
LOG_ERROR("Error in starting Kernel Thread!");
return false;
};
#ifdef DEBUG
LOG( "Kernel Thread Created" );
#endif
#ifdef DEBUG
//sprintf( tBuffer, "Server is registered as id[%d]", m_nServerID );
//LOG( tBuffer );
#endif
return true;
};
void PF_Kernel::WaitFinish( bool Force ){
if( Force ){
#ifdef DEBUG
LOG( "Thread End Forced" );
#endif
} else {
// 3 seconds sleep to settle down processes
SLEEP(3000);
};
waitThreadEnd( Force );
#ifdef DEBUG
LOG( "Thread is Detached" );
#endif
};
/* Main Kernel Thread Procedure */
void PF_Kernel::m_fThreadProc( void ){
char Buffer[CTEXT];
time_t tTimeTSeconds;
int lastTSS = 0;
int lastTMS = 0;
DB_COMMAND * tCMD;
char pidBuf[16];
pid_t pid = gettid();
sprintf(pidBuf,"pid:%d", pid);
LOG(pidBuf);
m_bThreadStatus = TH_WORKING;
while( m_bThreadStatus < TH_ENDED ){
m_tTimeTSeconds = time( NULL );
// Command Processing Loop
tCMD = m_pDBC->fetchCommand();
if( tCMD != NULL ){
switch( tCMD->cmd ) {
case PF_CMD_START_SCANER:{
LOG("KK - Start Scanner");
if( m_pScanner!= NULL ) {
m_pScanner->startScan();
};
break;
};
case PF_CMD_RESET_SCANER:{
LOG("KK - Reset Scanner");
if( m_pScanner!= NULL ) {
m_pScanner->resetDevice();
};
break;
};
case PF_CMD_STOP_SCANER:{
LOG("KK - Stop Scanner");
if( m_pScanner!= NULL ) {
m_pScanner->stopScan();
};
break;
};
case PF_CMD_SHOT_CAMERA:{
LOG("KK - Shot");
if( m_pCamera!= NULL ) {
m_pCamera->makeShot();
};
break;
};
case PF_CMD_START_BURST_CAMERA:{
LOG("KK - Burst Start");
if( m_pCamera!= NULL ) {
m_pCamera->startBurst();
};
break;
};
case PF_CMD_STOP_BURST_CAMERA:{
LOG("KK - Burst Stop");
if( m_pCamera!= NULL ) {
m_pCamera->stopBurst();
};
break;
};
case PF_CMD_SWITCH_CAMERA:{
LOG("KK - Switch Camera");
if( m_pCamera!= NULL ) {
m_pCamera->switchToCamera();
};
break;
};
case PF_CMD_SWITCH_STORAGE:{
LOG("KK - Switch Storage");
if( m_pCamera!= NULL ) {
m_pCamera->switchToStorage();
};
break;
};
case PF_CMD_PREV_CAMERA:{
LOG("KK - Switch Preview");
if( m_pCamera!= NULL ) {
m_pCamera->startPreview();
};
break;
};
case PF_CMD_UPDATE_IMU:{
LOG("KK - Update IMU");
if( m_pBNO!= NULL ) {
if( !m_pBNO->updateSettings() ) LOG_ERROR("Failure IMU Settings Update");
};
break;
};
case PF_CMD_START_PROCESS:{
LOG("KK - Start Log");
startDataAsqusition();
break;
};
case PF_CMD_STOP_PROCESS:{
LOG("KK - Stop Log");
stopDataAsqusition();
break;
};
case PF_CMD_SET_CURRENT_ALT:{
if( m_pGPS ) {
m_fGSAlt = m_pGPS->getCurrentAlt();
if( m_pDBC != NULL ) {
m_pDBC->updateGS_ALT( m_fGSAlt );
};
};
break;
};
case PF_CMD_OFSENSOR_SET_CAM:{
LOG("KK - Set OF Cam");
if( m_pFlow ) {
m_pFlow->setMode( OF_WM_PICTURES );
};
break;
};
case PF_CMD_OFSENSOR_SET_OF:{
LOG("KK - Set OF OF");
if( m_pFlow ) {
m_pFlow->setMode( OF_WM_MOVEMENT );
};
break;
};
case PF_CMD_DELETE_CAM_PHOTOS:{
LOG("KK - Delete Photos");
if( m_pCamera ) {
m_pCamera->deleteAllPictures();
};
break;
};
};
m_pDBC->finishCommand( tCMD->id );
free( tCMD );
tCMD = NULL;
};
if( m_tTimeTSeconds != tTimeTSeconds ){ // Each Second Process
tTimeTSeconds = m_tTimeTSeconds;
if( m_bHWFlags != PF_HW_ALL ) {
if( ( m_bHWFlags & PF_HW_GPS ) != PF_HW_GPS ) {
if( m_pGPS ) {
delete( m_pGPS );
m_pGPS = NULL;
};
m_pGPS = new sensorXA1110( m_pSettings, m_pDBC );
if( m_pGPS != NULL ) {
if( !m_pGPS->create() ){
LOG_ERROR("GPS ReCreation failure!");
} else {
m_bHWFlags |= PF_HW_GPS;
m_pDBC->updateHW_STATUS( m_bHWFlags );
};
} else {
LOG_ERROR("GPS ReConstruction failure!");
};
};
if( ( m_bHWFlags & PF_HW_BNO ) != PF_HW_BNO ) {
if( m_pBNO ) {
delete( m_pBNO );
m_pBNO = NULL;
};
m_pBNO = new sensorBNO( m_pSettings, m_pDBC );
if( m_pBNO != NULL ) {
if( !m_pBNO->create() ){
LOG_ERROR("BNO ReCreation failure!");
} else {
m_bHWFlags |= PF_HW_BNO;
m_pDBC->updateHW_STATUS( m_bHWFlags );
};
} else {
LOG_ERROR("BNO ReConstruction failure!");
};
};
if( ( m_bHWFlags & PF_HW_OPF ) != PF_HW_OPF ) {
if( m_pFlow ) {
delete( m_pFlow );
m_pFlow = NULL;
};
m_pFlow = new opticFlow( m_pSettings, m_pDBC );
if( m_pFlow != NULL ) {
if( !m_pFlow->create() ){
LOG_ERROR("FLOW ReCreation failure!");
} else {
m_bHWFlags |= PF_HW_OPF;
m_pDBC->updateHW_STATUS( m_bHWFlags );
};
} else {
LOG_ERROR("FLOW ReConstruction failure!");
};
};
if( ( m_bHWFlags & PF_HW_LRF ) != PF_HW_LRF ) {
if( m_pScanner ) {
delete( m_pScanner );
m_pScanner = NULL;
};
m_pScanner = new LRF_techScanner( m_pSettings, m_pDBC );
if( m_pScanner != NULL ) {
if( !m_pScanner->create() ){
LOG_ERROR( "Error ReCreate LRF Scanner!" );
} else {
m_bHWFlags |= PF_HW_LRF;
m_pDBC->updateHW_STATUS( m_bHWFlags );
};
} else {
LOG_ERROR("LRF ReConstruction failure!");
};
};
} else {
if( m_pGPS->isDead() ) {
m_bHWFlags &= ~PF_HW_GPS;
delete( m_pGPS );
m_pGPS = NULL;
m_pDBC->updateHW_STATUS( m_bHWFlags );
};
if( m_pBNO->isDead() ) {
m_bHWFlags &= ~PF_HW_BNO;
delete( m_pBNO );
m_pBNO = NULL;
m_pDBC->updateHW_STATUS( m_bHWFlags );
};
if( m_pFlow->isDead() ) {
m_bHWFlags &= ~PF_HW_OPF;
delete( m_pFlow );
m_pFlow = NULL;
m_pDBC->updateHW_STATUS( m_bHWFlags );
};
if( m_pScanner->isDead() ) {
m_bHWFlags &= ~PF_HW_LRF;
delete( m_pScanner );
m_pScanner = NULL;
m_pDBC->updateHW_STATUS( m_bHWFlags );
};
};
if( !m_bGPSis3D ) {
if( m_pGPS != NULL ) {
if( m_pGPS->getCurrentFixType() == PF_GPS_FIX_3D ) {
m_bGPSis3D = true;
m_fGSAlt = m_pGPS->getCurrentAlt();
if( m_pDBC != NULL ) {
m_pDBC->updateGS_ALT( m_fGSAlt );
};
};
};
};
if( !m_bActive ) {
// Entering Active Mode
switch( m_bStartMode ){
case PF_START_ON_ALT:{
float tAlt;
if( !m_bArmed ) break;
if( !m_bGPSis3D ) break;
if( m_pBLOG == NULL ) break;
tAlt = m_pGPS->getCurrentAlt();
if( tAlt > m_fGSAlt ) {
// Start Scan
if( m_pFlow != NULL ) {
m_pFlow->setMode( OF_WM_MOVEMENT );
};
m_pBLOG->activate();
};
break;
};
case PF_START_ON_ARM:{
if( !m_bArmed ) break;
if( m_pBLOG == NULL ) break;
// Start Scan
if( m_pFlow != NULL ) {
m_pFlow->setMode( OF_WM_MOVEMENT );
};
m_pBLOG->activate();
break;
};
};
} else {
// Exit Active Mode
switch( m_bStartMode ){
case PF_START_ON_ALT:{
float tAlt;
if( !m_bArmed || !m_bGPSis3D ){
// Stop Scan
m_pBLOG->finish();
} else {
tAlt = m_pGPS->getCurrentAlt();
if( tAlt < ( m_fGSAlt / 2.f ) ) {
// Stop Scan
m_pBLOG->finish();
};
}
break;
};
case PF_START_ON_ARM:{
if( m_bArmed ) break;
// Stop Scan
m_pBLOG->finish();
break;
};
};
};
};
SLEEP( SLEEP_KERNEL_INTERVAL );
};
};
bool PF_Kernel::setStatus( int A ){
m_bThreadStatus = (thredStatus)A;
return true;
};
bool PF_Kernel::signalEvent( void ){
//if( m_pDBC->getLastEvents( m_vEvtRecords, 0,0 ) ){
//};
return true;
};
void PF_Kernel::armStatusChanged( void ){
int tPinVal = digitalRead ( 4 );
if( tPinVal == 1 && !m_bArmed ) {
LOG("!!!!!!!ARMED!!!!!!!");
m_bArmed = true;
} else {
if( tPinVal == 0 && m_bArmed ) {
LOG("!!!!!DISARMED!!!!!!");
m_bArmed = false;
};
};
if( m_pDBC == NULL ) return;
m_pDBC->setArmMode( m_bArmed );
if( ( m_bHWFlags & PF_HW_LRF ) == PF_HW_LRF ) {
uint8_t tStartModeLRF;
if( m_pDBC->getStartModeLRF( &tStartModeLRF )) {
if( tStartModeLRF == PF_START_ON_ARM ) {
if( m_bArmed ) {
m_pScanner->startScan();
} else {
m_pScanner->stopScan();
};
};
};
};
};
void PF_Kernel::startDataAsqusition( void ){
if( m_pDBC == NULL ) return;
if( m_pBLOG == NULL ) return;
if( m_pBLOG->activate() ) {
m_pDBC->setAsqusitionMode( 1 );
if( m_pCamera!= NULL ) {
m_pCamera->switchToCamera();
m_pCamera->startBurst();
};
if( m_pFlow!= NULL ) {
m_pFlow->setMode( OF_WM_MOVEMENT );
};
if( m_pScanner != NULL ) {
//m_pScanner->startScan();
};
};
};
void PF_Kernel::stopDataAsqusition( void ){
if( m_pDBC == NULL ) return;
if( m_pBLOG == NULL ) return;
if( m_pBLOG->finish() ) {
m_pCamera->stopBurst();
m_pDBC->setAsqusitionMode( 0 );
};
};
#undef LOG
#undef LOG_ERROR

155
lib/App/Pathfinder/Pathfinder_Kernel.h

@ -0,0 +1,155 @@
/*******************************************************************
*
* DESCRIPTION: Pathfinder Kernel Header File
*
* AUTHOR: gagua
*
* HISTORY:
*
* DATE:1/20/2020
*
*******************************************************************/
#ifndef __ARGUS_KERNEL_HEADER__
#define __ARGUS_KERNEL_HEADER__
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <getopt.h> /* getopt_long() */
#include <fcntl.h> /* low-level i/o */
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <linux/types.h>
struct serial_struct {
int type;
int line;
unsigned int port;
int irq;
int flags;
int xmit_fifo_size;
int custom_divisor;
int baud_base;
unsigned short close_delay;
char io_type;
char reserved_char[1];
int hub6;
unsigned short closing_wait; /* time to wait before closing */
unsigned short closing_wait2; /* no longer used... */
unsigned char * iomem_base;
unsigned short iomem_reg_shift;
unsigned int port_high;
unsigned long iomap_base; /* cookie passed into ioremap */
};
#include "../../alg/generic/md5.h"
#include "../../components/base/basicThread.h"
#include "../../components/base/basicEngine.h"
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/object/objectPathfinderBinaryLog.h"
#include "../../data/ponvif/ponvif.h"
#include "../../data/protocol/onvifMediaObserver.h"
#include "../../data/ssdp/ssdpAnnouncer.h"
#include "../../components/base/basicEventHeap.h"
#include "../../data/net/netServer.h"
#include "../../pathfinder/pathfinderDBConnector.h"
#include "../../hardware/sensors/9dof/BNO055.h"
#include "../../hardware/sensors/gps/XA1110_I2C.h"
#include "../../hardware/sensors/gphoto/gPhotoCamera.h"
#include "../../hardware/sensors/optic_flow/adns3080/opticFlowADNS.h"
#include "../../hardware/sensors/lrf/lrfScanner.h"
#include <wiringPi.h>
#define SLEEP_KERNEL_INTERVAL 10
#define ONVIF_DISCOVERY_INTERVAL 300 // 5 min
#define ONVIF_DISCOVERY_RESULT_TIME 5
typedef enum E_PF_COMMANDS{
PF_CMD_ARM_APPLICATION = 1,
PF_CMD_DISARM_APPLICATION = 2,
PF_CMD_OFSENSOR_SET_CAM = 3,
PF_CMD_OFSENSOR_SET_OF = 4,
PF_CMD_START_SCANER = 10,
PF_CMD_RESET_SCANER = 13,
PF_CMD_STOP_SCANER = 15,
PF_CMD_SHOT_CAMERA = 22,
PF_CMD_START_BURST_CAMERA = 23,
PF_CMD_STOP_BURST_CAMERA = 24,
PF_CMD_SWITCH_CAMERA = 25,
PF_CMD_SWITCH_STORAGE = 26,
PF_CMD_PREV_CAMERA = 27,
PF_CMD_UPDATE_IMU = 28,
PF_CMD_START_PROCESS = 29,
PF_CMD_STOP_PROCESS = 30,
PF_CMD_SET_CURRENT_ALT = 31,
PF_CMD_DELETE_CAM_PHOTOS = 32
} PF_COMMANDS;
#define PF_HW_NONE 0
#define PF_HW_GPS 1
#define PF_HW_BNO 2
#define PF_HW_OPF 4
#define PF_HW_LRF 8
#define PF_HW_PHO 16
#define PF_HW_ALL 31
class PF_Kernel: public basicThread {
private:
time_t m_tTimeTSeconds;
basicLogCollection * m_pLog;
config_setting_t * m_pSettings;
ssdpAnnouncer * m_pServiceAnnouncer;
uint8_t m_bExitCause;
bool m_bCreatedDBC;
uint8_t m_bStartMode;
uint8_t m_bHWFlags;
float m_fStartAlt;
float m_fGSAlt;
bool m_bGPSis3D;
bool m_bActive;
PATHFINDER_DBC * m_pDBC;
objectPathfinderBinaryLog * m_pBLOG;
/* Sensors and Devices */
sensorBNO * m_pBNO;
sensorXA1110 * m_pGPS;
LRF_techScanner * m_pScanner;
gPhotoCamera * m_pCamera;
opticFlow * m_pFlow;
/* Flags */
bool m_bArmed;
protected:
void m_fThreadProc( void );
void startDataAsqusition( void );
void stopDataAsqusition( void );
public:
// Constructor
explicit PF_Kernel( config_setting_t *Settings = NULL );
// Destructor
virtual ~PF_Kernel();
bool create( void );
bool signalEvent( void );
void WaitFinish( bool Force = false );
bool setStatus( int );
uint8_t getExitCause( void ){ return m_bExitCause;};
void armStatusChanged(void);
};
#endif

55
lib/App/argus/RGoose_Kernel.cpp

@ -31,6 +31,7 @@ ARGUS_Kernel::ARGUS_Kernel( config_setting_t *Settings ):basicThread(){
basicSettingsProvider::getInstance()->validate();
};
m_pNodeFactory = argusNodeFactory::getInstance();
m_pModuleFactory = argusModuleFactory::getInstance();
};
ARGUS_Kernel::~ARGUS_Kernel(){
@ -186,7 +187,9 @@ bool ARGUS_Kernel::create( void ){
m_pNodeFactory->setDBC( m_pDBC );
m_pNodeFactory->loadNodes( m_nSiteID );
//m_pDBC->getIPCamRecords( m_vCamRecords );
m_pModuleFactory->setDBC( m_pDBC ); //m_pDBC->getIPCamRecords( m_vCamRecords );
m_pModuleFactory->loadModules( m_nSiteID );
#ifdef DEBUG
LOG( "Start SSDP Beacon" );
@ -198,7 +201,7 @@ bool ARGUS_Kernel::create( void ){
m_pServiceAnnouncer = NULL;
};
};
/*
#ifdef DEBUG
LOG("Init IP Cameras");
#endif
@ -220,7 +223,9 @@ bool ARGUS_Kernel::create( void ){
};
};
};
};
};
*/
#ifdef DEBUG
LOG("Start OnVIF Discovery");
#endif
@ -239,6 +244,7 @@ bool ARGUS_Kernel::create( void ){
#ifdef DEBUG
LOG( "Kernel Thread Created" );
#endif
/*
m_pServletWS = new servletWS();
if( m_pServletWS != NULL ) {
LOG("ServletWS Created");
@ -251,6 +257,7 @@ bool ARGUS_Kernel::create( void ){
//};
};
};
*/
#ifdef DEBUG
sprintf( tBuffer, "Server is registered as id[%d]", m_nServerID );
LOG( tBuffer );
@ -472,6 +479,7 @@ void ARGUS_Kernel::m_fThreadProc( void ){
m_tTimeTSeconds = time( NULL );
// Network IP OnVif Discovery
//*
if( m_pOnvifMediaObserver!= NULL ){
if( !m_bDiscoveryStarted ) {
if((m_tTimeTSeconds%ONVIF_DISCOVERY_INTERVAL)==0){
@ -491,7 +499,8 @@ void ARGUS_Kernel::m_fThreadProc( void ){
};
};
};
//*/
//*
// Event Processing Loop
if( !m_pDBC->getLastEvents( m_vEvtRecords, lastTSS, lastTMS ) ){
// Error In DB Access
@ -503,10 +512,15 @@ void ARGUS_Kernel::m_fThreadProc( void ){
if( m_vEvtRecords.size() > 0 ){
validateEvents( lastTSS, lastTMS );
};
//*/
if( m_tTimeTSeconds != tTimeTSeconds ){ // Each Second Process
tTimeTSeconds = m_tTimeTSeconds;
if( m_pModuleFactory != NULL ) {
m_pModuleFactory->validate();
};
//if( m_pNodeFactory != NULL ) {
//m_pNodeFactory->validate();
//};
};
SLEEP( SLEEP_KERNEL_INTERVAL );
};
@ -574,14 +588,43 @@ void ARGUS_Kernel::validateEvents( int &lastTSS, int &lastTMS ){
bool ARGUS_Kernel::setStatus( int A ){
m_bThreadStatus = (thredStatus)A;
return true;
};
bool ARGUS_Kernel::signalEvent( void ){
if( m_pDBC->getLastEvents( m_vEvtRecords, 0,0 ) ){
};
return true;
};
int ARGUS_Kernel::getNetNodes( ARGUS_NODE_TYPE type, argusNetNode **&RA ){
RA = NULL;
int cnt = 0;
if( m_pNodeFactory != NULL ){
cnt = m_pNodeFactory->getNodeCount( type );
if( cnt ) {
RA = (argusNetNode **) calloc( cnt, sizeof( argusNetNode * ) );
m_pNodeFactory->fetchNodes(type, RA );
};
};
return cnt;
};
argusNetNode *ARGUS_Kernel::getNetNode( int id ){
return NULL;
};
int ARGUS_Kernel::getModules( ARGUS_MODULE_TYPE type, argusKernelModule **&RA ){
return 0;
};
argusKernelModule *ARGUS_Kernel::getModule( int id ){
return NULL;
};
#undef LOG
#undef LOG_ERROR

16
lib/App/argus/RGoose_Kernel.h

@ -55,7 +55,6 @@ struct serial_struct {
unsigned long iomap_base; /* cookie passed into ioremap */
};
#include "../../alg/generic/md5.h"
#include "../../components/base/basicThread.h"
#include "../../components/base/basicEngine.h"
@ -67,6 +66,7 @@ struct serial_struct {
#include "../../rgoose/rgooseDBConnector.h"
#include "../../rgoose/rgooseIPCamera.h"
#include "../../rgoose/rgooseNodeFactory.h"
#include "../../rgoose/rgooseModuleFactory.h"
#include "../../data/net/netServer.h"
#include "../../data/servletWS/servletWS.h"
@ -78,8 +78,11 @@ struct serial_struct {
#define ARGUS_KERNEL_TAG_SERVER_IDENTITY "IDENTITY"
#define ARGUS_NODE_SOCK_TYPE_SERIAL_PORT 1
#define ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER 2
#define ARGUS_NODE_SOCK_TYPE_NETWORK 3
#define ARGUS_NODE_SOCK_TYPE_NETWORK 2
#define ARGUS_NODE_SOCK_TYPE_DC 3
#define ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER 4
#define ARGUS_NODE_SOCK_TYPE_AUDIO_GRABBER 5
#define ARGUS_NODE_SOCK_TYPE_VIDEO_DIGITAL 6
class ARGUS_Kernel: public basicThread {
private:
@ -101,7 +104,8 @@ class ARGUS_Kernel: public basicThread {
vectorCamRecords m_vCamRecords;
vectorEventRecords m_vEvtRecords;
argusNodeFactory * m_pNodeFactory;
servletWS * m_pServletWS;
argusModuleFactory * m_pModuleFactory;
//servletWS * m_pServletWS;
int isCameraListed( CSTR uid );
void validateCameras( void );
void validateEvents( int &lastTSS, int &lastTMS );
@ -118,6 +122,10 @@ class ARGUS_Kernel: public basicThread {
void WaitFinish( bool Force = false );
bool setStatus( int );
uint8_t getExitCause( void ){ return m_bExitCause;};
int getNetNodes( ARGUS_NODE_TYPE type, argusNetNode **&RA );
argusNetNode * getNetNode( int id );
int getModules( ARGUS_MODULE_TYPE type, argusKernelModule **&RA );
argusKernelModule * getModule( int id );
};

95
lib/alg/generic/heapDebug.cpp

@ -0,0 +1,95 @@
#include "heapDebug.h"
#ifndef DEBUG
size_t getPeakRSS( ){ return 0; };
size_t getCurrentRSS( ){ return 0; };
#else
/**
* Returns the peak (maximum so far) resident set size (physical
* memory use) measured in bytes, or zero if the value cannot be
* determined on this OS.
*/
size_t getPeakRSS( )
{
#if defined(_WIN32)
/* Windows -------------------------------------------------- */
PROCESS_MEMORY_COUNTERS info;
GetProcessMemoryInfo( GetCurrentProcess( ), &info, sizeof(info) );
return (size_t)info.PeakWorkingSetSize;
#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
/* AIX and Solaris ------------------------------------------ */
struct psinfo psinfo;
int fd = -1;
if ( (fd = open( "/proc/self/psinfo", O_RDONLY )) == -1 )
return (size_t)0L; /* Can't open? */
if ( read( fd, &psinfo, sizeof(psinfo) ) != sizeof(psinfo) )
{
close( fd );
return (size_t)0L; /* Can't read? */
}
close( fd );
return (size_t)(psinfo.pr_rssize * 1024L);
#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
/* BSD, Linux, and OSX -------------------------------------- */
struct rusage rusage;
getrusage( RUSAGE_SELF, &rusage );
#if defined(__APPLE__) && defined(__MACH__)
return (size_t)rusage.ru_maxrss;
#else
return (size_t)(rusage.ru_maxrss * 1024L);
#endif
#else
/* Unknown OS ----------------------------------------------- */
return (size_t)0L; /* Unsupported. */
#endif
}
/**
* Returns the current resident set size (physical memory use) measured
* in bytes, or zero if the value cannot be determined on this OS.
*/
size_t getCurrentRSS( )
{
#if defined(_WIN32)
/* Windows -------------------------------------------------- */
PROCESS_MEMORY_COUNTERS info;
GetProcessMemoryInfo( GetCurrentProcess( ), &info, sizeof(info) );
return (size_t)info.WorkingSetSize;
#elif defined(__APPLE__) && defined(__MACH__)
/* OSX ------------------------------------------------------ */
struct mach_task_basic_info info;
mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
if ( task_info( mach_task_self( ), MACH_TASK_BASIC_INFO,
(task_info_t)&info, &infoCount ) != KERN_SUCCESS )
return (size_t)0L; /* Can't access? */
return (size_t)info.resident_size;
#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
/* Linux ---------------------------------------------------- */
long rss = 0L;
FILE* fp = NULL;
if ( (fp = fopen( "/proc/self/statm", "r" )) == NULL )
return (size_t)0L; /* Can't open? */
if ( fscanf( fp, "%*s%ld", &rss ) != 1 )
{
fclose( fp );
return (size_t)0L; /* Can't read? */
}
fclose( fp );
return (size_t)rss * (size_t)sysconf( _SC_PAGESIZE);
#else
/* AIX, BSD, Solaris, and Unknown OS ------------------------ */
return (size_t)0L; /* Unsupported. */
#endif
}
#endif // DEBUG

45
lib/alg/generic/heapDebug.h

@ -0,0 +1,45 @@
/*
* Author: David Robert Nadeau
* Site: http://NadeauSoftware.com/
* License: Creative Commons Attribution 3.0 Unported License
* http://creativecommons.org/licenses/by/3.0/deed.en_US
*/
#ifndef DEBUG
#include <cstddef>
size_t getPeakRSS( );
size_t getCurrentRSS( );
#else
#if defined(_WIN32)
#include <windows.h>
#include <psapi.h>
#elif defined( __linux__ )|| defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#include <sys/resource.h>
#if defined(__APPLE__) && defined(__MACH__)
#include <mach/mach.h>
#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
#include <fcntl.h>
#include <procfs.h>
#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
#include <stdio.h>
#include <cstddef>
#endif
#else
#error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS."
#endif
/**
* Returns the peak (maximum so far) resident set size (physical
* memory use) measured in bytes, or zero if the value cannot be
* determined on this OS.
*/
size_t getPeakRSS( );
/**
* Returns the current resident set size (physical memory use) measured
* in bytes, or zero if the value cannot be determined on this OS.
*/
size_t getCurrentRSS( );
#endif // DEBUG

1
lib/components/base/basicFunctionality.cpp

@ -191,6 +191,7 @@ CSTR getTStr( CSTR Fmt ){
};
#ifdef __linux__
long long getMilliseconds( void ){
long long tMilliseconds;
struct timeval tData;

53
lib/components/base/basicFunctionality.h

@ -24,16 +24,42 @@
#endif
bool fileExist( const char *strFilename );
CSTR trim( CSTR string );
uint8_t checksum8( uint8_t *Buffer, size_t BufferSize );
uint16_t checksum16( uint8_t *Buffer, size_t BufferSize );
uint8_t checksumLGS( uint8_t *Buffer, size_t BufferSize );
CArray *explode( char Delim, CSTR S_Str );
CSTR implode( CArray *Data, CSTR S_Str, U8 Start, U8 End );
CSTR getTStr( CSTR Fmt = NULL );
bool fileExist( const char *strFilename );
CSTR trim( CSTR string );
uint8_t checksum8( uint8_t *Buffer, size_t BufferSize );
uint16_t checksum16( uint8_t *Buffer, size_t BufferSize );
uint8_t checksumLGS( uint8_t *Buffer, size_t BufferSize );
CArray * explode( char Delim, CSTR S_Str );
CSTR implode( CArray *Data, CSTR S_Str, U8 Start, U8 End );
CSTR getTStr( CSTR Fmt = NULL );
#ifdef __linux__
inline PF_TIMESTAMP * getPFTS( PF_TIMESTAMP * ptr = NULL ){
struct timeval tData;
struct timezone tTZ;
if( ptr == NULL ) {
PF_TIMESTAMP *retVal;
retVal = (PF_TIMESTAMP *) malloc(sizeof(PF_TIMESTAMP));
if( retVal != NULL ) {
if( gettimeofday( &tData, &tTZ ) == -1 ){
free(retVal);
retVal = NULL;
} else {
retVal->seconds = tData.tv_sec;
retVal->milliseconds = ( tData.tv_usec / 1000 );
};
};
return retVal;
} else {
if( gettimeofday( &tData, &tTZ ) == -1 ){
ptr->seconds = 0;
ptr->milliseconds = 0;
} else {
ptr->seconds = tData.tv_sec;
ptr->milliseconds = ( tData.tv_usec / 1000 );
};
return ptr;
};
};
pid_t gettid( void );
#define SLEEP(X) usleep(X*1000)
long long getMilliseconds( void );
@ -57,15 +83,6 @@ int getIP4( if_info **arrParam, int max_ifs = 10 );
bool enumerateDevices(enumeratorInfo *mlist, REFGUID category);
#endif
typedef struct S_localIp4Info{
char address[16];
char netmask[16];
char broadcast[16];
char gateway[16];
}localIp4Info;
typedef vector<localIp4Info*> localIpAddresses;
localIpAddresses *getLocalIP();
#endif

4
lib/components/base/basicTimeStamp.cpp

@ -18,10 +18,10 @@ void basicTimeStamp::setLocal( time_t TS ){
};
time_t basicTimeStamp::getUTS( void ){
return 0;
};
time_t basicTimeStamp::getLocal( void ){
return 0;
};

155
lib/components/base/basicTypes.h

@ -352,6 +352,161 @@ template <typename T> struct basicRingElement{
basicRingElement<T> *next;
};
typedef struct S_BNO_DATA{
uint8_t temperature;
int16_t gravity_z;
int16_t gravity_y;
int16_t gravity_x;
int16_t lacc_z;
int16_t lacc_y;
int16_t lacc_x;
int16_t quaterion_z;
int16_t quaterion_y;
int16_t quaterion_x;
int16_t quaterion_w;
int16_t pitch;
int16_t roll;
int16_t yaw;
int16_t gyro_z;
int16_t gyro_y;
int16_t gyro_x;
int16_t mag_z;
int16_t mag_y;
int16_t mag_x;
int16_t acc_z;
int16_t acc_y;
int16_t acc_x;
} BNO_DATA;//45 bytes
#define PF_EVT_REC_GPS 1
#define PF_EVT_REC_PIC 2
#define PF_EVT_REC_OPF 3
#define PF_EVT_REC_BNO 4
#define PF_EVT_REC_LRF 5
#define PF_START_ON_PWR 0
#define PF_START_ON_ALT 1
#define PF_START_ON_ARM 2
#define PF_START_ON_MAN 3
typedef struct S_BNO_3D_VECTOR{
float x;
float y;
float z;
}BNO_3D_VECTOR;
typedef struct S_BNO_Quat{
float w;
float x;
float y;
float z;
} BNO_Quat;
typedef struct S_PF_TIMESTAMP{
uint32_t seconds;
uint16_t milliseconds;
} PF_TIMESTAMP;
typedef struct S_BNO_EVTREC{
uint32_t seconds;
uint16_t milliseconds;
uint8_t wm_mode;
BNO_3D_VECTOR acc;
BNO_3D_VECTOR mag;
BNO_3D_VECTOR gyr;
BNO_3D_VECTOR eul;
BNO_Quat quat;
BNO_3D_VECTOR mov;
BNO_3D_VECTOR grav;
}BNO_EVTREC;
typedef struct S_BNO_SETTINGS{
uint8_t wmode;
uint8_t map_x;
uint8_t map_y;
uint8_t map_z;
}BNO_SETTINGS;
typedef struct S_GPS_EVTREC{
uint32_t seconds;
uint16_t milliseconds;
uint8_t fix_type;
uint8_t fix_mode;
float lat;
float lon;
float msl_alt;
float mag_variation;
float og_speed;
float og_course;
float geo_separation;
}GPS_EVTREC;
typedef struct S_GPS_SAT_INFO{
uint8_t sat_id;
uint8_t const_id;
uint8_t elevation;
uint16_t azimuth;
uint8_t SNR;
}GPS_SAT_INFO;
typedef struct S_GPS_INFO{
}GPS_INFO;
typedef struct S_GPS_SETTINGS{
uint16_t bFix_Rate;
uint8_t bGLL_Rate;
uint8_t bRMC_Rate;
uint8_t bVTG_Rate;
uint8_t bGGA_Rate;
uint8_t bGSA_Rate;
uint8_t bGSV_Rate;
uint8_t bZDA_Rate;
uint8_t bDGPS_Mode;
bool bDEBUG_Mode;
}GPS_SETTINGS;
typedef struct S_OPF_MOTION{
uint8_t bFLAGS;
int8_t dX;
int8_t dY;
uint8_t bSurfaceQuality;
uint16_t nShutter;
uint8_t bMaxPixel;
}OPF_MOTION;
typedef struct S_OPF_EVTREC{
uint32_t seconds;
uint16_t milliseconds;
uint8_t bFLAGS;
int8_t dX;
int8_t dY;
uint8_t bSurfaceQuality;
uint16_t nShutter;
uint8_t bMaxPixel;
}OPF_EVTREC;
typedef struct S_LRF_EVTREC{
uint32_t begin_seconds;
uint16_t begin_milliseconds;
uint32_t end_seconds;
uint16_t end_milliseconds;
uint8_t sps;
uint16_t samples_count;
uint16_t * samples;
}LRF_EVTREC;
typedef struct S_localIp4Info{
char address[16];
char netmask[16];
char broadcast[16];
char gateway[16];
}localIp4Info;
typedef vector<localIp4Info*> localIpAddresses;
#ifdef __linux__
#define SLEEP(X) usleep(X*1000)
#else

9
lib/components/object/objectKernelResource.cpp

@ -0,0 +1,9 @@
#include "objectKernelResource.h"
static uint32_t g_nResourceId = 0;
objectKernelResource::objectKernelResource( RESOURCE_TYPE T ){
m_nResourceId = g_nResourceId++;
m_eType = T;
};

36
lib/components/object/objectKernelResource.h

@ -0,0 +1,36 @@
#ifndef __OBJECT_KERNEL_RESOURCE_HEADER__
#define __OBJECT_KERNEL_RESOURCE_HEADER__
#define RES_CAP_INPUT 0x0001
#define RES_CAP_OUTPUT 0x0002
#define RES_CAP_BLOCK 0x0004
#define RES_CAP_STREAM 0x0008
#define RES_CAP_LOCKING 0x0010
#define RES_CAP_SINGLE 0x0020
#define RES_CAP_ONE_SHOT_INIT 0x0040
typedef enum E_RESOURCE_TYPE {
ERT_NONE 0,
ERT_SERIAL_LINK 1,
ERT_SERIAL_BUS 2
ERT_BINARY_APPF 3,
ERT_SHARED_MEM 4,
ERT_DATABASE_LINK 5,
ERT_MULTIMEDIA_CTRL 6
} RESOURCE_TYPE;
class objectKernelResource{
private:
uint32_t m_nResourceId;
uint32_t m_nCapabilities;
RESOURCE_TYPE m_eType;
public:
explicit objectKernelResource( RESOURCE_TYPE T );
vortual ~objectKernelResource();
uint32_t getResourceCaps(void) const { return m_nCapabilities; };
RESOURCE_TYPE getResourceType(void) const { return m_eType; };
};
#endif

16
lib/components/object/objectKernelResourcesCage.cpp

@ -0,0 +1,16 @@
#include "objectKernelResourcesCage.h"
static objectKernelResourcesCage *objectKernelResourcesCage::_instance = NULL;
objectKernelResourcesCage *objectKernelResourcesCage::getInstance(){
if(_instance == NULL ){
_instance = new objectKernelResourcesCage();
};
return _instance;
};
objectKernelResourcesCage::objectKernelResourcesCage(){
};
objectKernelResourcesCage::~objectKernelResourcesCage(){
};

17
lib/components/object/objectKernelResourcesCage.h

@ -0,0 +1,17 @@
#ifndef __OBJECT_KERNEL_RESOUCES_CAGE_HEADER__
#define __OBJECT_KERNEL_RESOUCES_CAGE_HEADER__
#include "objectKernelResource.h"
class objectKernelResourcesCage{
public:
bool create( objectKernelResource * R );
objectKernelResourcesCage * getInstance();
private:
objectKernelResourcesCage();
virtual ~objectKernelResourcesCage();
static objectKernelResourcesCage * _instance;
};
#endif

130
lib/components/object/objectLGS.h

@ -23,7 +23,7 @@
#include <stdint.h>
#define LGS_TIMEOUT_COUNT 100
#define LGS_TIMEOUT_COUNT 100
#define LGS_MAX_IDLE_DELAY 40 // x10 msec
#define LGS_MIN_IDLE_DELAY 1 // x10 msec
@ -108,78 +108,78 @@ class objectLGS : public basicObject, basicDualThread, protocolLGS_CLIENT{
protected:
void m_fThreadAProc(void);
void m_fThreadBProc(void);
bool packetHandler(protocolPackage* Package);
bool packetHandler( protocolPackage* Package );
public:
//explicit objectLGS( PLGS_PARAMETERS Settings, basicTransport *Transport);
explicit objectLGS( config_setting_t *Settings = NULL, bool Master = true );
~objectLGS();
bool create( void );
bool startGetScanData( uint8_t kID = 0, uint32_t *th_zone = NULL );
bool startGetParameters( uint32_t timeout=0 );
bool startUploadMask(void);
bool startDeviceReset( bool FullReset = true );
bool startStopMotors( void );
bool startStartMotors( void );
bool startMasksStatus(bool Active);
uint8_t getCompelition(void);
SOFTWARE_INFO *getSoftwareInfo(void){
return &m_sDeviceSoftNFO;
};
E_LGS_CMD getCurrentCMD(void){
E_LGS_CMD tVal;
m_mStatusMutex.lock();
tVal = m_sDeviceStatus.CurrentOperation;
m_mStatusMutex.unlock();
return tVal;
};
E_LGS_STAGE getCurrentSTG(void){
E_LGS_STAGE tVal;
m_mStatusMutex.lock();
tVal = m_sDeviceStatus.Status;
m_mStatusMutex.unlock();
return tVal;
};
PLGS_PARAMETERS getSettings(void){ return m_pLGS_PARAMETERS; };
CSTR getHost( void ){ return m_pHost; };
int getPort( void ){ return m_nPort; };
bool getDeviceStatus(DEVICE_STATUS &STAT);
ShadowMask *getMask( void ){ return m_pShadow; };
bool setHost( CSTR Host );
bool setPort( int Port );
bool setSettings( PLGS_PARAMETERS Params );
bool isMaster( void ){
return m_bIsMaster;
};
bool areMasksLoadded(void){
if( !m_bMasksAreLoadded ) SLEEP(10);
return m_bMasksAreLoadded;
};
bool areMasksActive( void ){
if( m_bMasksAreLoadded ){
if( m_pShadow!= NULL ){
return m_pShadow->isActive();
~objectLGS();
bool create( void );
bool startGetScanData( uint8_t kID = 0, uint32_t *th_zone = NULL );
bool startGetParameters( uint32_t timeout=0 );
bool startUploadMask(void);
bool startDeviceReset( bool FullReset = true );
bool startStopMotors( void );
bool startStartMotors( void );
bool startMasksStatus(bool Active);
uint8_t getCompelition(void);
SOFTWARE_INFO * getSoftwareInfo(void){
return &m_sDeviceSoftNFO;
};
E_LGS_CMD getCurrentCMD(void){
E_LGS_CMD tVal;
m_mStatusMutex.lock();
tVal = m_sDeviceStatus.CurrentOperation;
m_mStatusMutex.unlock();
return tVal;
};
E_LGS_STAGE getCurrentSTG(void){
E_LGS_STAGE tVal;
m_mStatusMutex.lock();
tVal = m_sDeviceStatus.Status;
m_mStatusMutex.unlock();
return tVal;
};
PLGS_PARAMETERS getSettings(void){ return m_pLGS_PARAMETERS; };
CSTR getHost( void ){ return m_pHost; };
int getPort( void ){ return m_nPort; };
bool getDeviceStatus(DEVICE_STATUS &STAT);
ShadowMask * getMask( void ){ return m_pShadow; };
bool setHost( CSTR Host );
bool setPort( int Port );
bool setSettings( PLGS_PARAMETERS Params );
bool isMaster( void ){
return m_bIsMaster;
};
bool areMasksLoadded(void){
if( !m_bMasksAreLoadded ) SLEEP(10);
return m_bMasksAreLoadded;
};
bool areMasksActive( void ){
if( m_bMasksAreLoadded ){
if( m_pShadow!= NULL ){
return m_pShadow->isActive();
};
};
return false;
};
bool isConnected(void){
bool tVal;
m_mStatusMutex.lock();
tVal = (m_sDeviceStatus.Status > STG_DISCONNECTED);
m_mStatusMutex.unlock();
return tVal;
};
return false;
};
bool isConnected(void){
bool tVal;
m_mStatusMutex.lock();
tVal = (m_sDeviceStatus.Status > STG_DISCONNECTED);
m_mStatusMutex.unlock();
return tVal;
};
void attachRadarWidget( GLRadar *ptr ){ m_pRadarWidget = ptr;};
void attachMapWidget( RangeMapWidget *ptr ){ m_pMapWidget = ptr;};
basicPosition *getPosition(void){ return m_pPosition; };
void updateSettings(void);
void attachRadarWidget( GLRadar *ptr ){ m_pRadarWidget = ptr;};
void attachMapWidget( RangeMapWidget *ptr ){ m_pMapWidget = ptr;};
basicPosition * getPosition(void){ return m_pPosition; };
void updateSettings(void);
// New Order
thresholdNode *grabDataAccess( void );
void releaseDataAccess( void );
thresholdNode * grabDataAccess( void );
void releaseDataAccess( void );
bool lastTaskComplete( void );
void cleanLastTaskStatus( void );
bool lastTaskComplete( void );
void cleanLastTaskStatus( void );
};
typedef struct S_SENSOR_INFO{

250
lib/components/object/objectPathfinderBinaryLog.cpp

@ -0,0 +1,250 @@
#include "objectPathfinderBinaryLog.h"
#define LOG( X ) m_pLog->Log( "BILO", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "BILO", this, _LOG_ERROR, X )
#define PACKAGE_NAME "PATHFINDER_BIN_LOG"
objectPathfinderBinaryLog *objectPathfinderBinaryLog::_instance = NULL;
objectPathfinderBinaryLog *objectPathfinderBinaryLog::getInstance(){
if( _instance == NULL ){
_instance = new objectPathfinderBinaryLog();
};
return _instance;
};
objectPathfinderBinaryLog::objectPathfinderBinaryLog(){
m_pLog = basicLogCollection::getInstance();
m_pFID = NULL;
m_nDBID = 0;
m_pDBC = NULL;
m_bActive = false;
//uuidgen();
};
objectPathfinderBinaryLog::~objectPathfinderBinaryLog(){
finish();
};
void objectPathfinderBinaryLog::attachDBC( PATHFINDER_DBC *DBC ){
m_pDBC = DBC;
};
bool objectPathfinderBinaryLog::activate(){
if( m_bActive )
if( !finish() ) return false;
if( m_pDBC == NULL ) return false;
uuidgen();
char tBuff[256];
sprintf( tBuff, "data/%s.bin", m_sUUID );
m_pFID = fopen( tBuff, "wb+" );
if( m_pFID != NULL ) {
PF_TIMESTAMP ts;
getPFTS( &ts );
m_nDBID = m_pDBC->registerBinaryLog( ts.seconds, ts.milliseconds, m_sUUID );
if( m_nDBID ) {
m_bActive = true;
} else {
fclose( m_pFID );
unlink( tBuff );
};
};
return m_bActive;
};
bool objectPathfinderBinaryLog::finish(){
if( !m_bActive ) return true;
if( m_pFID == NULL ) return false;
m_bActive = false;
m_mProtector.lock();
fclose( m_pFID );
m_pFID = NULL;
m_mProtector.unlock();
if( m_pDBC != NULL ) {
PF_TIMESTAMP ts;
getPFTS( &ts );
m_pDBC->unregisterBinaryLog( m_nDBID, ts.seconds, ts.milliseconds );
};
m_nDBID = 0;
return true;
};
void objectPathfinderBinaryLog::registerGPS( GPS_EVTREC *ptr ){
if( !m_bActive ) return;
if( ptr == NULL ) return;
if( m_pFID == NULL ){
LOG_ERROR("Data File Not Opened!");
return;
};
uint16_t recSize;
uint8_t recType = PF_EVT_REC_GPS;
m_mProtector.lock();
recSize = sizeof(GPS_EVTREC);
fwrite( &recType, 1, 1, m_pFID );
fwrite( &recSize, 2, 1, m_pFID );
// -----------------------------------------------
fwrite( ptr, recSize, 1, m_pFID );
if( m_nDBID ) {
m_pDBC->updateBLOG_DATA( m_nDBID, recType, recSize + 3 );
};
m_mProtector.unlock();
};
void objectPathfinderBinaryLog::registerBNO( BNO_EVTREC *ptr ){
if( !m_bActive ) return;
if( ptr == NULL ) return;
if( m_pFID == NULL ){
LOG_ERROR("Data File Not Opened!");
return;
};
uint16_t recSize;
uint8_t recType = PF_EVT_REC_GPS;
m_mProtector.lock();
recSize = sizeof(BNO_EVTREC);
fwrite( &recType, 1, 1, m_pFID );
fwrite( &recSize, 2, 1, m_pFID );
// -----------------------------------------------
fwrite( ptr, recSize, 1, m_pFID );
if( m_nDBID ) {
m_pDBC->updateBLOG_DATA( m_nDBID, recType, recSize + 3 );
};
m_mProtector.unlock();
};
void objectPathfinderBinaryLog::registerOPF( OPF_EVTREC *ptr ){
if( !m_bActive ) return;
if( ptr == NULL ) return;
if( m_pFID == NULL ){
LOG_ERROR("Data File Not Opened!");
return;
};
uint16_t recSize;
uint8_t recType = PF_EVT_REC_OPF;
m_mProtector.lock();
recSize = sizeof(OPF_EVTREC);
fwrite( &recType, 1, 1, m_pFID );
fwrite( &recSize, 2, 1, m_pFID );
// -----------------------------------------------
fwrite( ptr, recSize, 1, m_pFID );
if( m_nDBID ) {
m_pDBC->updateBLOG_DATA( m_nDBID, recType, recSize + 3 );
};
m_mProtector.unlock();
};
void objectPathfinderBinaryLog::registerPIC( PF_TIMESTAMP *ts, CSTR name ){
if( !m_bActive ) return;
if( ts == NULL ) return;
if( name == NULL ) return;
if( m_pFID == NULL ){
LOG_ERROR("Data File Not Opened!");
return;
};
uint16_t recSize;
uint8_t recType = PF_EVT_REC_PIC;
m_mProtector.lock();
recSize = 7 + strlen(name);
fwrite( &recType, 1, 1, m_pFID );
fwrite( &recSize, 2, 1, m_pFID );
// -----------------------------------------------
fwrite( &ts->seconds, 4, 1, m_pFID );
fwrite( &ts->milliseconds, 2, 1, m_pFID );
fwrite( name, 1, recSize - 6, m_pFID );
if( m_nDBID ) {
m_pDBC->updateBLOG_DATA( m_nDBID, recType, recSize + 3 );
};
m_mProtector.unlock();
};
void objectPathfinderBinaryLog::registerLFS( LRF_EVTREC *ptr ){
if( !m_bActive ) return;
if( ptr == NULL ) return;
if( ptr->samples == NULL ) {
LOG_ERROR("EVT Data Corrupted!");
};
if( m_pFID == NULL ){
LOG_ERROR("Data File Not Opened!");
return;
};
uint16_t recSize;
uint8_t recType = PF_EVT_REC_LRF;
m_mProtector.lock();
recSize = 15 + ( ptr->samples_count << 1 );
fwrite( &recType, 1, 1, m_pFID );
fwrite( &recSize, 2, 1, m_pFID );
// -----------------------------------------------
fwrite( &ptr->begin_seconds, 4, 1, m_pFID );
fwrite( &ptr->begin_milliseconds, 2, 1, m_pFID );
fwrite( &ptr->end_seconds, 4, 1, m_pFID );
fwrite( &ptr->end_milliseconds, 2, 1, m_pFID );
fwrite( &ptr->sps, 1, 1, m_pFID );
fwrite( &ptr->samples_count, 2, 1, m_pFID );
fwrite( ptr->samples, 2, ptr->samples_count, m_pFID );
if( m_nDBID ) {
m_pDBC->updateBLOG_DATA( m_nDBID, recType, recSize + 3 );
};
m_mProtector.unlock();
};
void objectPathfinderBinaryLog::uuidgen(void){
FILE * fp;
char buf[CTEXT];
#ifdef DEBUG
char tBuf[CTEXT];
#endif
const char * file = _PATH_VARDB PACKAGE_NAME ".cache";
fp = fopen(file, "r");
if (!fp) {
fp = fopen(file, "w");
if (!fp){
sprintf( buf, "Cannot create UUID cache, %s: %s", file, strerror(errno));
LOG_ERROR( buf );
};
generate:
srand(time(NULL));
snprintf( buf, 42, "%8.8x-%4.4x-%4.4x-%4.4x-%6.6x%6.6x",
rand() & 0xFFFFFFFF,
rand() & 0xFFFF,
(rand() & 0x0FFF) | 0x4000, /* M 4 MSB version => version 4 */
(rand() & 0x1FFF) | 0x8000, /* N: 3 MSB variant => variant 1 */
rand() & 0xFFFFFF, rand() & 0xFFFFFF
);
if (fp) {
#ifdef DEBUG
sprintf( tBuf, "Creating new UUID cache file, %s", file);
LOG( tBuf );
#endif
fprintf(fp, "%s\n", buf);
fclose(fp);
};
} else {
#ifdef DEBUG
sprintf( tBuf, "Cache file [%s] is Ok", file);
LOG( tBuf );
#endif
if (!fgets(buf, sizeof(buf), fp)) {
fclose(fp);
goto generate;
}
buf[strlen(buf) - 1] = 0;
fclose(fp);
};
strcpy( m_sUUID, buf );
#ifdef DEBUG
sprintf( tBuf, "URN: %s", m_sUUID );
LOG( tBuf );
#endif
};
#undef LOG
#undef LOG_ERROR

57
lib/components/object/objectPathfinderBinaryLog.h

@ -0,0 +1,57 @@
#ifndef __PATHFINDER_BINARY_LOG_HEADER__
#define __PATHFINDER_BINARY_LOG_HEADER__
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <getopt.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <paths.h>
#include <poll.h>
#include <stdio.h>
#include <signal.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <sys/param.h> /* MIN() */
#include <sys/socket.h>
#include "../base/basicSettingsProvider.h"
#include "../base/basicFunctionality.h"
#include "../base/basicMutex.h"
#include "../../pathfinder/pathfinderDBConnector.h"
class objectPathfinderBinaryLog{
protected:
char m_sUUID[42];
PATHFINDER_DBC * m_pDBC;
public:
static objectPathfinderBinaryLog * getInstance();
void attachDBC( PATHFINDER_DBC *DBC );
bool activate();
bool finish();
void registerGPS( GPS_EVTREC *ptr );
void registerBNO( BNO_EVTREC *ptr );
void registerOPF( OPF_EVTREC *ptr );
void registerPIC( PF_TIMESTAMP *ts, CSTR name );
void registerLFS( LRF_EVTREC *ptr );
private:
basicLogCollection * m_pLog;
static objectPathfinderBinaryLog * _instance;
basicMutex m_mProtector;
objectPathfinderBinaryLog();
virtual ~objectPathfinderBinaryLog();
uint32_t m_nDBID;
bool m_bActive;
void uuidgen(void);
FILE * m_pFID;
};
#endif

3
lib/data/curl/curlRequest.h

@ -8,7 +8,8 @@
#include <curl/curl.h>
#include "../../components/base/basicLogCollection.h"
#define DEFAULT_CONTENT_TYPE ((CSTR)"application/xml")
#define DEFAULT_CONTENT_TYPE ((CSTR)"application/xml")
#define DEFAULT_CONTENT_TYPE_JSON ((CSTR)"application/json")
/*struct CURLMsg {
CURLMSG msg; // what this message means

16
lib/data/mysql/database_class.cpp

@ -69,6 +69,7 @@ MySQL_Connector::~MySQL_Connector(){
if( m_pDBUser != NULL ) delete( m_pDBUser );
if( m_pDBPassword != NULL ) delete( m_pDBPassword );
if ( m_pDBLink != NULL ) mysql_close( m_pDBLink );
mysql_library_end();
m_bIsConnected = false;
};
@ -160,9 +161,8 @@ bool MySQL_Connector::ReConnect( void ){
AAssoc *MySQL_Connector::Query( CSTR QS, bool useCache ){
AAssoc * RetVal = NULL;
Assoc * tElement;
unsigned int i;
unsigned int num_Fields;
MYSQL_RES * Result;
MYSQL_RES * Result = NULL;
m_mAccessMutex.lock();
#ifdef DEBUG_MYSQL_QUERIES
LOG( QS );
@ -304,6 +304,18 @@ void MySQL_Connector::SilentQuery( CSTR QS ){
m_mAccessMutex.unlock();
};
void deleteResult( AAssoc *R ){
if (R) {
//while( R->size() ){
// delete( (Assoc *) R->at(0) );
// R->erase( R->begin());
//};
R->clear();
delete( R );
R = NULL;
};
};
#undef LOG
#undef LOG_ERROR

1
lib/data/mysql/database_class.h

@ -39,6 +39,7 @@ class MySQL_Connector{
AAssoc * Query( CSTR QS, bool useCache = false );
};
void deleteResult( AAssoc * );
//extern MySQL_Connector DBC;
#endif

17
lib/data/protocol/protocol.cpp

@ -47,6 +47,7 @@ CONNECTION_STATUS protocolParser::getConnectionStatus( void ){
return m_eConnectionStatus;
};
bool protocolParser::parse( U8 *Buffer, size_t BufferSize ){
LOG("P");
if( m_pParserBuffer != NULL ) {
m_mBufferProtectorMutex.lock();
memcpy( m_pParserBuffer+m_nParserDataCount, Buffer, BufferSize );
@ -63,7 +64,7 @@ void protocolParser::m_fThreadProc(void){
while(m_bThreadStatus < TH_ENDED){
if( m_eConnectionStatus < CS_DISCONNECTED ){
if( ( m_bBufferAltered == false ) && ( m_bThreadStatus < TH_ENDED ) ) {
SLEEP(1);
SLEEP(3);
continue;
};
m_mBufferProtectorMutex.lock();
@ -77,8 +78,8 @@ void protocolParser::m_fThreadProc(void){
#endif
if( RetVal < 0 ){
// Note: RetVal is NEGATIVE!!??
//memcpy( m_pParserBuffer, m_pParserBuffer-RetVal, m_nParserDataCount+RetVal );
//m_nParserDataCount+=RetVal;
m_nParserDataCount+=RetVal;
memcpy( m_pParserBuffer, m_pParserBuffer-RetVal, m_nParserDataCount );
} else if ( RetVal == 0 ) {
protocolPackage* tVal = NULL;
tVal = packetExtractor(m_pParserBuffer, m_nParserDataCount);
@ -93,7 +94,7 @@ void protocolParser::m_fThreadProc(void){
m_nParserDataCount -= tVal->m_nSize;
memcpy(m_pParserBuffer, m_pParserBuffer + tVal->m_nSize, m_nParserDataCount);
// In Case implementation of packetHandler - handler must return !true!
if (!packetHandler(tVal)) {
if( !packetHandler(tVal) ){
m_vPackagePool.push_back( tVal );
if (m_vPackagePool.size() > PROTO_QUEUE_MAX_PACKAGES) {
// Delete oldest package in queue
@ -102,18 +103,20 @@ void protocolParser::m_fThreadProc(void){
free(tVal);
};
} else {
dataEraser(tVal->m_pData);
dataEraser(tVal->m_pData);
free(tVal);
};
} else {
// All data consumed in MAVLINK proto but not parsed into message
m_nParserDataCount = 0;
};
};
} else {
break;
};
};
m_bBufferAltered = false;
m_mBufferProtectorMutex.unlock();
}else{
} else {
// Handle Disconnect
m_bThreadStatus = TH_ENDED;
};

23
lib/data/protocol/protocolHTTP.cpp

@ -5,22 +5,27 @@
// Constructor
protocolHTTP::protocolHTTP(config_setting_t *Settings){
m_pSettings = Settings;
config_setting_t * pSetting;
m_pCurlPostType = (CSTR)malloc(128);
if( m_pCurlPostType == NULL ) return;
if (!config_setting_lookup_string(m_pSettings, HTTP_PROTOCOL_CONTENT_SETTINGS, (const char**)&m_pCurlPostType)){
sprintf( m_pCurlPostType, DEFAULT_CONTENT_TYPE );
pSetting = config_setting_add(m_pSettings, HTTP_PROTOCOL_CONTENT_SETTINGS, CONFIG_TYPE_STRING);
config_setting_set_string( pSetting, m_pCurlPostType );
basicSettingsProvider::getInstance()->compromise();
};
if( m_pSettings != NULL ) {
config_setting_t * pSetting;
if (!config_setting_lookup_string(m_pSettings, HTTP_PROTOCOL_CONTENT_SETTINGS, (const char**)&m_pCurlPostType)){
sprintf( m_pCurlPostType, DEFAULT_CONTENT_TYPE );
pSetting = config_setting_add(m_pSettings, HTTP_PROTOCOL_CONTENT_SETTINGS, CONFIG_TYPE_STRING);
config_setting_set_string( pSetting, m_pCurlPostType );
basicSettingsProvider::getInstance()->compromise();
};
basicSettingsProvider::getInstance()->validate();
} else {
sprintf( m_pCurlPostType, DEFAULT_CONTENT_TYPE_JSON );
};
LOG( m_pCurlPostType );
basicSettingsProvider::getInstance()->validate();
m_pHttpAccessManager = curlRequestsManager::getInstance();
};
protocolHTTP::~protocolHTTP(){
delete m_pHttpAccessManager;
// Its singletone!!
//delete m_pHttpAccessManager;
m_pHttpAccessManager = NULL;
};

131
lib/data/protocol/protocolZLMEDIA.cpp

@ -4,12 +4,12 @@
#include <json/writer.h>
#include <json/reader.h>
#define LOG( X ) basicLogCollection::getInstance()->Log( "ZLMEDIA", this, X )
#define LOG_ERROR( X ) basicLogCollection::getInstance()->Log( "ZLMEDIA", this, _LOG_ERROR, X )
#define LOG( X ) basicLogCollection::getInstance()->Log( "ZLMP", this, X )
#define LOG_ERROR( X ) basicLogCollection::getInstance()->Log( "ZLMP", this, _LOG_ERROR, X )
protocolZLMEDIA::protocolZLMEDIA( config_setting_t *Settings ): protocolHTTP( basicSettingsProvider::getInstance()->getSubNode(Settings, "ZLMEDIA_CONNECTION") ){
protocolZLMEDIA::protocolZLMEDIA( config_setting_t *Settings ): protocolHTTP( basicSettingsProvider::getInstance()->getSubNode(Settings, "ZLMEDIA_PROTOCOL") ){
m_pLog = basicLogCollection::getInstance();
m_pSettings = basicSettingsProvider::getInstance()->getSubNode(Settings, "ZLMEDIA_CONNECTION");
m_pSettings = basicSettingsProvider::getInstance()->getSubNode(Settings, "ZLMEDIA_PROTOCOL");
/*
if( m_pSettings != NULL ){
@ -47,19 +47,57 @@ protocolZLMEDIA::protocolZLMEDIA( config_setting_t *Settings ): protocolHTTP( ba
}; //*/
};
protocolZLMEDIA::protocolZLMEDIA( CSTR key, CSTR host, CSTR ip, uint32_t port ): protocolHTTP( NULL ){
m_pLog = basicLogCollection::getInstance();
m_pSettings = NULL;
LOG("Param1");
strncpy( m_pSecret, key, 255 );
LOG("Param2");
strncpy( m_pAccessPoint, key, 255 );
LOG("Param3");
strncpy( m_pIP, ip, 16 );
LOG("Done!");
m_bSessionOnGo = false;
m_bServerIsPresent = false;
m_nPort = port;
m_bUseSSL = ( m_nPort == 433 );
LOG("Check Online!");
isOnline();
LOG("Done!");
};
protocolZLMEDIA::~protocolZLMEDIA(){
};
bool protocolZLMEDIA::packetHandler( protocolPackage *Package ){
if( Package == NULL )return false;
if( Package->m_nSize == 0 ) return false;
if( Package->m_pData == NULL ) return false;
if( Package->m_nCode != 200 ) return false;
LOG("Pack Handler!!");
if( Package == NULL ){
m_bSessionOnGo = false;
return false;
};
LOG("Pack not NULL");
if( Package->m_nSize == 0 ) {
m_bSessionOnGo = false;
return false;
};
LOG("Size not NULL");
if( Package->m_pData == NULL ){
m_bSessionOnGo = false;
return false;
};
LOG("Data not NULL");
if( Package->m_nCode != 200 ){
m_bSessionOnGo = false;
return false;
};
LOG("Code is 200");
m_bServerIsPresent = true;
try{
Json::Value root;
Json::Reader reader;
if( !reader.parse( (char *)Package->m_pData, root ) ){
LOG_ERROR( "Error parsing the string" );
m_bSessionOnGo = false;
return false;
};
for( Json::Value::const_iterator outer = root.begin() ; outer != root.end() ; outer++ ){
@ -70,29 +108,80 @@ bool protocolZLMEDIA::packetHandler( protocolPackage *Package ){
};
};
} catch (exception e ){
LOG_ERROR("Exception!!");
m_bSessionOnGo = false;
return false;
};
m_bSessionOnGo = false;
return true;
};
// Issue New Online Check but return current value
bool protocolZLMEDIA::isOnline(){
if( !m_bSessionOnGo ) {
char URL[256];
uint8_t timeout = 100; // 1 sec.
m_bSessionOnGo = true;
if( m_bUseSSL ) {
sprintf(URL,"https://%s:%d/%s?secret=%s", m_pIP, m_nPort, m_pAccessPoint, m_pSecret );
if( !m_bServerIsPresent ) { // Just First Time to set initial flag
if( !m_bSessionOnGo ) {
char URL[256];
uint8_t timeout = 100; // 1 sec.
m_bSessionOnGo = true;
if( m_bUseSSL ) {
sprintf(URL,"https://%s:%d/%s?secret=%s", m_pIP, m_nPort, ZL_LIST_API, m_pSecret );
} else {
sprintf(URL,"http://%s:%d/%s?secret=%s", m_pIP, m_nPort, ZL_LIST_API, m_pSecret ); //m_pAccessPoint
};
LOG( URL );
//ToDo: Check if OK to send nothing for checking Onlines
//int len = 0;
//issuePost( URL, NULL, len );
issueGet( URL );
while( m_bSessionOnGo && timeout-- ) SLEEP(10);
};
#ifdef DEBUG
if(m_bServerIsPresent) {
LOG("Server is Online");
} else {
sprintf(URL,"http://%s:%d/%s?secret=%s", m_pIP, m_nPort, m_pAccessPoint, m_pSecret );
LOG("Server is Onffline");
};
//ToDo: Check if OK to send nothing for checking Onlines
int len = 0;
issuePost( URL, NULL, len );
while( m_bSessionOnGo && timeout-- ) SLEEP(10);
};
#endif
}
return m_bServerIsPresent;
};
bool protocolZLMEDIA::restartServer(){
return false;
};
bool protocolZLMEDIA::getConfig(){
return false;
};
CSTR protocolZLMEDIA::addStreamProxy(){
return NULL;
};
bool protocolZLMEDIA::delStreamProxy(CSTR key){
return false;
};
bool protocolZLMEDIA::listMedia(){
if( m_bServerIsPresent ) { // Just First Time to set initial flag
LOG("LIST MEDIA");
if( !m_bSessionOnGo ) {
char URL[256];
uint8_t timeout = 100; // 1 sec.
m_bSessionOnGo = true;
if( m_bUseSSL ) {
sprintf(URL,"https://%s:%d/%s?secret=%s", m_pIP, m_nPort, ZL_LIST_MEDIA, m_pSecret );
} else {
sprintf(URL,"http://%s:%d/%s?secret=%s", m_pIP, m_nPort, ZL_LIST_MEDIA, m_pSecret ); //m_pAccessPoint
};
LOG( URL );
//ToDo: Check if OK to send nothing for checking Onlines
//int len = 0;
//issuePost( URL, NULL, len );
issueGet( URL );
while( m_bSessionOnGo && timeout-- ) SLEEP(10);
return ( timeout > 0 );
} else LOG("LIST MEDIA - SESSION BUSY!");
};
return false;
};
bool protocolZLMEDIA::requestIsFinished(){
return (m_bSessionOnGo == false);
};
#undef LOG
#undef LOG_ERROR

22
lib/data/protocol/protocolZLMEDIA.h

@ -18,6 +18,21 @@
#include "../../components/base/basicLogCollection.h"
#include "../../components/base/basicSettingsProvider.h"
#define ZL_ADD_ENCODER_SOURCE ((CSTR) "index/api/addFFmpegSource" )
#define ZL_ADD_STREAM_PROXY ((CSTR) "index/api/addStreamProxy" )
#define ZL_CLOSE_STREAM ((CSTR) "index/api/close_stream" )
#define ZL_DEL_ENCODER_SOURCE ((CSTR) "index/api/delFFmepgSource" )
#define ZL_DEL_STREAM_PROXY ((CSTR) "index/api/delStreamProxy" )
#define ZL_LIST_SESSIONS ((CSTR) "index/api/getAllSession" )
#define ZL_LIST_API ((CSTR) "index/api/getApiList" )
#define ZL_LIST_MEDIA ((CSTR) "index/api/getMediaList" )
#define ZL_GET_SERVER_CONFIG ((CSTR) "index/api/getServerConfig" )
#define ZL_GET_LOAD_STATS ((CSTR) "index/api/getThreadsLoad" )
#define ZL_GET_WORK_LOAD_STATS ((CSTR) "index/api/getWorkThreadsLoad" )
#define ZL_KICK_SESSION ((CSTR) "index/api/kick_session" )
#define ZL_RESTART_SERVER ((CSTR) "index/api/restartServer" )
#define ZL_SET_SERVER_CONFIG ((CSTR) "index/api/setServerConfig" )
class protocolZLMEDIA : public protocolHTTP {
private:
basicLogCollection * m_pLog;
@ -33,8 +48,15 @@ class protocolZLMEDIA : public protocolHTTP {
virtual bool packetHandler( protocolPackage *Package );
public:
explicit protocolZLMEDIA( config_setting_t *Settings = NULL );
explicit protocolZLMEDIA( CSTR key, CSTR host, CSTR ip, uint32_t port );
~protocolZLMEDIA();
bool isOnline();
bool restartServer();
bool getConfig();
CSTR addStreamProxy();
bool delStreamProxy(CSTR key);
bool listMedia();
bool requestIsFinished();
};

2
lib/data/servletWS/servletClientHandlerWS.h

@ -74,7 +74,7 @@ class servletClientHandlerWS: public basicThread{
servletWS * m_pParent;
zipDataPackage * m_pDeflatener;
bool m_bDeflatePerMessage;
bool parseFrame(){};
bool parseFrame(){ return true; };
bool assembleFrame( bool FIN, bool RSV1, bool RSV2, bool RSV3, WS_OPCODE code, uint8_t *in_buffer, size_t in_size, uint8_t *&out_buffer, size_t &out_size, bool bmask=false, uint32_t mask=0xffff );
public:
explicit servletClientHandlerWS( servletWS *pPtr, int Socket );

2
lib/data/ssdp/ssdpAnnouncer.cpp

@ -318,7 +318,7 @@ void ssdpAnnouncer::compose_xml( CSTR peerIP ){
sprintf(cPtr," <UPC>%s</UPC>\r\n",m_sUniversalProductCode);
cPtr = m_pXMLTEMPLATE+strlen(m_pXMLTEMPLATE);
};
sprintf(tBuf,m_sDevicePresentationURL,peerIP);
sprintf(tBuf, m_sDevicePresentationURL, peerIP );
sprintf(cPtr," <presentationURL>%s</presentationURL>\r\n",tBuf);
cPtr = m_pXMLTEMPLATE+strlen(m_pXMLTEMPLATE);
if(m_sIcons.size) {

6437
lib/data/stbi/stb_image.h
File diff suppressed because it is too large
View File

730
lib/data/stbi/stb_image_write.h

@ -0,0 +1,730 @@
/* stb_image_write - v0.98 - public domain - http://nothings.org/stb/stb_image_write.h
writes out PNG/BMP/TGA images to C stdio - Sean Barrett 2010
no warranty implied; use at your own risk
Before #including,
#define STB_IMAGE_WRITE_IMPLEMENTATION
in the file that you want to have the implementation.
Will probably not work correctly with strict-aliasing optimizations.
ABOUT:
This header file is a library for writing images to C stdio. It could be
adapted to write to memory or a general streaming interface; let me know.
The PNG output is not optimal; it is 20-50% larger than the file
written by a decent optimizing implementation. This library is designed
for source code compactness and simplicitly, not optimal image file size
or run-time performance.
BUILDING:
You can #define STBIW_ASSERT(x) before the #include to avoid using assert.h.
You can #define STBIW_MALLOC(), STBIW_REALLOC(), and STBIW_FREE() to replace
malloc,realloc,free.
You can define STBIW_MEMMOVE() to replace memmove()
USAGE:
There are four functions, one for each image file format:
int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes);
int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data);
int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data);
int stbi_write_hdr(char const *filename, int w, int h, int comp, const void *data);
Each function returns 0 on failure and non-0 on success.
The functions create an image file defined by the parameters. The image
is a rectangle of pixels stored from left-to-right, top-to-bottom.
Each pixel contains 'comp' channels of data stored interleaved with 8-bits
per channel, in the following order: 1=Y, 2=YA, 3=RGB, 4=RGBA. (Y is
monochrome color.) The rectangle is 'w' pixels wide and 'h' pixels tall.
The *data pointer points to the first byte of the top-left-most pixel.
For PNG, "stride_in_bytes" is the distance in bytes from the first byte of
a row of pixels to the first byte of the next row of pixels.
PNG creates output files with the same number of components as the input.
The BMP format expands Y to RGB in the file format and does not
output alpha.
PNG supports writing rectangles of data even when the bytes storing rows of
data are not consecutive in memory (e.g. sub-rectangles of a larger image),
by supplying the stride between the beginning of adjacent rows. The other
formats do not. (Thus you cannot write a native-format BMP through the BMP
writer, both because it is in BGR order and because it may have padding
at the end of the line.)
HDR expects linear float data. Since the format is always 32-bit rgb(e)
data, alpha (if provided) is discarded, and for monochrome data it is
replicated across all three channels.
CREDITS:
PNG/BMP/TGA
Sean Barrett
HDR
Baldur Karlsson
TGA monochrome:
Jean-Sebastien Guay
misc enhancements:
Tim Kelsey
bugfixes:
github:Chribba
*/
#ifndef INCLUDE_STB_IMAGE_WRITE_H
#define INCLUDE_STB_IMAGE_WRITE_H
#ifdef __cplusplus
extern "C" {
#endif
extern int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes);
extern int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data);
extern int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data);
extern int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data);
#ifdef __cplusplus
}
#endif
#endif//INCLUDE_STB_IMAGE_WRITE_H
#ifdef STB_IMAGE_WRITE_IMPLEMENTATION
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#if defined(STBIW_MALLOC) && defined(STBIW_FREE) && defined(STBIW_REALLOC)
// ok
#elif !defined(STBIW_MALLOC) && !defined(STBIW_FREE) && !defined(STBIW_REALLOC)
// ok
#else
#error "Must define all or none of STBIW_MALLOC, STBIW_FREE, and STBIW_REALLOC."
#endif
#ifndef STBIW_MALLOC
#define STBIW_MALLOC(sz) malloc(sz)
#define STBIW_REALLOC(p,sz) realloc(p,sz)
#define STBIW_FREE(p) free(p)
#endif
#ifndef STBIW_MEMMOVE
#define STBIW_MEMMOVE(a,b,sz) memmove(a,b,sz)
#endif
#ifndef STBIW_ASSERT
#include <assert.h>
#define STBIW_ASSERT(x) assert(x)
#endif
typedef unsigned int stbiw_uint32;
typedef int stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1];
static void writefv(FILE *f, const char *fmt, va_list v)
{
while (*fmt) {
switch (*fmt++) {
case ' ': break;
case '1': { unsigned char x = (unsigned char) va_arg(v, int); fputc(x,f); break; }
case '2': { int x = va_arg(v,int); unsigned char b[2];
b[0] = (unsigned char) x; b[1] = (unsigned char) (x>>8);
fwrite(b,2,1,f); break; }
case '4': { stbiw_uint32 x = va_arg(v,int); unsigned char b[4];
b[0]=(unsigned char)x; b[1]=(unsigned char)(x>>8);
b[2]=(unsigned char)(x>>16); b[3]=(unsigned char)(x>>24);
fwrite(b,4,1,f); break; }
default:
STBIW_ASSERT(0);
return;
}
}
}
static void write3(FILE *f, unsigned char a, unsigned char b, unsigned char c)
{
unsigned char arr[3];
arr[0] = a, arr[1] = b, arr[2] = c;
fwrite(arr, 3, 1, f);
}
static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad, int expand_mono)
{
unsigned char bg[3] = { 255, 0, 255}, px[3];
stbiw_uint32 zero = 0;
int i,j,k, j_end;
if (y <= 0)
return;
if (vdir < 0)
j_end = -1, j = y-1;
else
j_end = y, j = 0;
for (; j != j_end; j += vdir) {
for (i=0; i < x; ++i) {
unsigned char *d = (unsigned char *) data + (j*x+i)*comp;
if (write_alpha < 0)
fwrite(&d[comp-1], 1, 1, f);
switch (comp) {
case 1: fwrite(d, 1, 1, f);
break;
case 2: if (expand_mono)
write3(f, d[0],d[0],d[0]); // monochrome bmp
else
fwrite(d, 1, 1, f); // monochrome TGA
break;
case 4:
if (!write_alpha) {
// composite against pink background
for (k=0; k < 3; ++k)
px[k] = bg[k] + ((d[k] - bg[k]) * d[3])/255;
write3(f, px[1-rgb_dir],px[1],px[1+rgb_dir]);
break;
}
/* FALLTHROUGH */
case 3:
write3(f, d[1-rgb_dir],d[1],d[1+rgb_dir]);
break;
}
if (write_alpha > 0)
fwrite(&d[comp-1], 1, 1, f);
}
fwrite(&zero,scanline_pad,1,f);
}
}
static int outfile(char const *filename, int rgb_dir, int vdir, int x, int y, int comp, int expand_mono, void *data, int alpha, int pad, const char *fmt, ...)
{
FILE *f;
if (y < 0 || x < 0) return 0;
f = fopen(filename, "wb");
if (f) {
va_list v;
va_start(v, fmt);
writefv(f, fmt, v);
va_end(v);
write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad,expand_mono);
fclose(f);
}
return f != NULL;
}
int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)
{
int pad = (-x*3) & 3;
return outfile(filename,-1,-1,x,y,comp,1,(void *) data,0,pad,
"11 4 22 4" "4 44 22 444444",
'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
}
int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
{
int has_alpha = (comp == 2 || comp == 4);
int colorbytes = has_alpha ? comp-1 : comp;
int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 2, 1 color channel (Y/YA) = 3
return outfile(filename, -1,-1, x, y, comp, 0, (void *) data, has_alpha, 0,
"111 221 2222 11", 0,0,format, 0,0,0, 0,0,x,y, (colorbytes+has_alpha)*8, has_alpha*8);
}
// *************************************************************************************************
// Radiance RGBE HDR writer
// by Baldur Karlsson
#define stbiw__max(a, b) ((a) > (b) ? (a) : (b))
void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear)
{
int exponent;
float maxcomp = stbiw__max(linear[0], stbiw__max(linear[1], linear[2]));
if (maxcomp < 1e-32) {
rgbe[0] = rgbe[1] = rgbe[2] = rgbe[3] = 0;
} else {
float normalize = (float) frexp(maxcomp, &exponent) * 256.0f/maxcomp;
rgbe[0] = (unsigned char)(linear[0] * normalize);
rgbe[1] = (unsigned char)(linear[1] * normalize);
rgbe[2] = (unsigned char)(linear[2] * normalize);
rgbe[3] = (unsigned char)(exponent + 128);
}
}
void stbiw__write_run_data(FILE *f, int length, unsigned char databyte)
{
unsigned char lengthbyte = (unsigned char) (length+128);
STBIW_ASSERT(length+128 <= 255);
fwrite(&lengthbyte, 1, 1, f);
fwrite(&databyte, 1, 1, f);
}
void stbiw__write_dump_data(FILE *f, int length, unsigned char *data)
{
unsigned char lengthbyte = (unsigned char )(length & 0xff);
STBIW_ASSERT(length <= 128); // inconsistent with spec but consistent with official code
fwrite(&lengthbyte, 1, 1, f);
fwrite(data, length, 1, f);
}
void stbiw__write_hdr_scanline(FILE *f, int width, int comp, unsigned char *scratch, const float *scanline)
{
unsigned char scanlineheader[4] = { 2, 2, 0, 0 };
unsigned char rgbe[4];
float linear[3] = {0};
int x;
scanlineheader[2] = (width&0xff00)>>8;
scanlineheader[3] = (width&0x00ff);
/* skip RLE for images too small or large */
if (width < 8 || width >= 32768) {
for (x=0; x < width; x++) {
switch (comp) {
case 4: /* fallthrough */
case 3: linear[2] = scanline[x*comp + 2];
linear[1] = scanline[x*comp + 1];
linear[0] = scanline[x*comp + 0];
break;
case 2: /* fallthrough */
case 1: linear[0] = linear[1] = linear[2] = scanline[x*comp + 0];
break;
}
stbiw__linear_to_rgbe(rgbe, linear);
fwrite(rgbe, 4, 1, f);
}
} else {
int c,r;
/* encode into scratch buffer */
for (x=0; x < width; x++) {
switch(comp) {
case 4: /* fallthrough */
case 3: linear[2] = scanline[x*comp + 2];
linear[1] = scanline[x*comp + 1];
linear[0] = scanline[x*comp + 0];
break;
case 2: /* fallthrough */
case 1: linear[0] = linear[1] = linear[2] = scanline[x*comp + 0];
break;
}
stbiw__linear_to_rgbe(rgbe, linear);
scratch[x + width*0] = rgbe[0];
scratch[x + width*1] = rgbe[1];
scratch[x + width*2] = rgbe[2];
scratch[x + width*3] = rgbe[3];
}
fwrite(scanlineheader, 4, 1, f);
/* RLE each component separately */
for (c=0; c < 4; c++) {
unsigned char *comp = &scratch[width*c];
x = 0;
while (x < width) {
// find first run
r = x;
while (r+2 < width) {
if (comp[r] == comp[r+1] && comp[r] == comp[r+2])
break;
++r;
}
if (r+2 >= width)
r = width;
// dump up to first run
while (x < r) {
int len = r-x;
if (len > 128) len = 128;
stbiw__write_dump_data(f, len, &comp[x]);
x += len;
}
// if there's a run, output it
if (r+2 < width) { // same test as what we break out of in search loop, so only true if we break'd
// find next byte after run
while (r < width && comp[r] == comp[x])
++r;
// output run up to r
while (x < r) {
int len = r-x;
if (len > 127) len = 127;
stbiw__write_run_data(f, len, comp[x]);
x += len;
}
}
}
}
}
}
int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data)
{
int i;
FILE *f;
if (y <= 0 || x <= 0 || data == NULL) return 0;
f = fopen(filename, "wb");
if (f) {
/* Each component is stored separately. Allocate scratch space for full output scanline. */
unsigned char *scratch = (unsigned char *) STBIW_MALLOC(x*4);
fprintf(f, "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n" );
fprintf(f, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n" , y, x);
for(i=0; i < y; i++)
stbiw__write_hdr_scanline(f, x, comp, scratch, data + comp*i*x);
STBIW_FREE(scratch);
fclose(f);
}
return f != NULL;
}
/////////////////////////////////////////////////////////
// PNG
// stretchy buffer; stbiw__sbpush() == vector<>::push_back() -- stbiw__sbcount() == vector<>::size()
#define stbiw__sbraw(a) ((int *) (a) - 2)
#define stbiw__sbm(a) stbiw__sbraw(a)[0]
#define stbiw__sbn(a) stbiw__sbraw(a)[1]
#define stbiw__sbneedgrow(a,n) ((a)==0 || stbiw__sbn(a)+n >= stbiw__sbm(a))
#define stbiw__sbmaybegrow(a,n) (stbiw__sbneedgrow(a,(n)) ? stbiw__sbgrow(a,n) : 0)
#define stbiw__sbgrow(a,n) stbiw__sbgrowf((void **) &(a), (n), sizeof(*(a)))
#define stbiw__sbpush(a, v) (stbiw__sbmaybegrow(a,1), (a)[stbiw__sbn(a)++] = (v))
#define stbiw__sbcount(a) ((a) ? stbiw__sbn(a) : 0)
#define stbiw__sbfree(a) ((a) ? STBIW_FREE(stbiw__sbraw(a)),0 : 0)
static void *stbiw__sbgrowf(void **arr, int increment, int itemsize)
{
int m = *arr ? 2*stbiw__sbm(*arr)+increment : increment+1;
void *p = STBIW_REALLOC(*arr ? stbiw__sbraw(*arr) : 0, itemsize * m + sizeof(int)*2);
STBIW_ASSERT(p);
if (p) {
if (!*arr) ((int *) p)[1] = 0;
*arr = (void *) ((int *) p + 2);
stbiw__sbm(*arr) = m;
}
return *arr;
}
static unsigned char *stbiw__zlib_flushf(unsigned char *data, unsigned int *bitbuffer, int *bitcount)
{
while (*bitcount >= 8) {
stbiw__sbpush(data, (unsigned char) *bitbuffer);
*bitbuffer >>= 8;
*bitcount -= 8;
}
return data;
}
static int stbiw__zlib_bitrev(int code, int codebits)
{
int res=0;
while (codebits--) {
res = (res << 1) | (code & 1);
code >>= 1;
}
return res;
}
static unsigned int stbiw__zlib_countm(unsigned char *a, unsigned char *b, int limit)
{
int i;
for (i=0; i < limit && i < 258; ++i)
if (a[i] != b[i]) break;
return i;
}
static unsigned int stbiw__zhash(unsigned char *data)
{
stbiw_uint32 hash = data[0] + (data[1] << 8) + (data[2] << 16);
hash ^= hash << 3;
hash += hash >> 5;
hash ^= hash << 4;
hash += hash >> 17;
hash ^= hash << 25;
hash += hash >> 6;
return hash;
}
#define stbiw__zlib_flush() (out = stbiw__zlib_flushf(out, &bitbuf, &bitcount))
#define stbiw__zlib_add(code,codebits) \
(bitbuf |= (code) << bitcount, bitcount += (codebits), stbiw__zlib_flush())
#define stbiw__zlib_huffa(b,c) stbiw__zlib_add(stbiw__zlib_bitrev(b,c),c)
// default huffman tables
#define stbiw__zlib_huff1(n) stbiw__zlib_huffa(0x30 + (n), 8)
#define stbiw__zlib_huff2(n) stbiw__zlib_huffa(0x190 + (n)-144, 9)
#define stbiw__zlib_huff3(n) stbiw__zlib_huffa(0 + (n)-256,7)
#define stbiw__zlib_huff4(n) stbiw__zlib_huffa(0xc0 + (n)-280,8)
#define stbiw__zlib_huff(n) ((n) <= 143 ? stbiw__zlib_huff1(n) : (n) <= 255 ? stbiw__zlib_huff2(n) : (n) <= 279 ? stbiw__zlib_huff3(n) : stbiw__zlib_huff4(n))
#define stbiw__zlib_huffb(n) ((n) <= 143 ? stbiw__zlib_huff1(n) : stbiw__zlib_huff2(n))
#define stbiw__ZHASH 16384
unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality)
{
static unsigned short lengthc[] = { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258, 259 };
static unsigned char lengtheb[]= { 0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 };
static unsigned short distc[] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 32768 };
static unsigned char disteb[] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13 };
unsigned int bitbuf=0;
int i,j, bitcount=0;
unsigned char *out = NULL;
unsigned char **hash_table[stbiw__ZHASH]; // 64KB on the stack!
if (quality < 5) quality = 5;
stbiw__sbpush(out, 0x78); // DEFLATE 32K window
stbiw__sbpush(out, 0x5e); // FLEVEL = 1
stbiw__zlib_add(1,1); // BFINAL = 1
stbiw__zlib_add(1,2); // BTYPE = 1 -- fixed huffman
for (i=0; i < stbiw__ZHASH; ++i)
hash_table[i] = NULL;
i=0;
while (i < data_len-3) {
// hash next 3 bytes of data to be compressed
int h = stbiw__zhash(data+i)&(stbiw__ZHASH-1), best=3;
unsigned char *bestloc = 0;
unsigned char **hlist = hash_table[h];
int n = stbiw__sbcount(hlist);
for (j=0; j < n; ++j) {
if (hlist[j]-data > i-32768) { // if entry lies within window
int d = stbiw__zlib_countm(hlist[j], data+i, data_len-i);
if (d >= best) best=d,bestloc=hlist[j];
}
}
// when hash table entry is too long, delete half the entries
if (hash_table[h] && stbiw__sbn(hash_table[h]) == 2*quality) {
STBIW_MEMMOVE(hash_table[h], hash_table[h]+quality, sizeof(hash_table[h][0])*quality);
stbiw__sbn(hash_table[h]) = quality;
}
stbiw__sbpush(hash_table[h],data+i);
if (bestloc) {
// "lazy matching" - check match at *next* byte, and if it's better, do cur byte as literal
h = stbiw__zhash(data+i+1)&(stbiw__ZHASH-1);
hlist = hash_table[h];
n = stbiw__sbcount(hlist);
for (j=0; j < n; ++j) {
if (hlist[j]-data > i-32767) {
int e = stbiw__zlib_countm(hlist[j], data+i+1, data_len-i-1);
if (e > best) { // if next match is better, bail on current match
bestloc = NULL;
break;
}
}
}
}
if (bestloc) {
int d = (int) (data+i - bestloc); // distance back
STBIW_ASSERT(d <= 32767 && best <= 258);
for (j=0; best > lengthc[j+1]-1; ++j);
stbiw__zlib_huff(j+257);
if (lengtheb[j]) stbiw__zlib_add(best - lengthc[j], lengtheb[j]);
for (j=0; d > distc[j+1]-1; ++j);
stbiw__zlib_add(stbiw__zlib_bitrev(j,5),5);
if (disteb[j]) stbiw__zlib_add(d - distc[j], disteb[j]);
i += best;
} else {
stbiw__zlib_huffb(data[i]);
++i;
}
}
// write out final bytes
for (;i < data_len; ++i)
stbiw__zlib_huffb(data[i]);
stbiw__zlib_huff(256); // end of block
// pad with 0 bits to byte boundary
while (bitcount)
stbiw__zlib_add(0,1);
for (i=0; i < stbiw__ZHASH; ++i)
(void) stbiw__sbfree(hash_table[i]);
{
// compute adler32 on input
unsigned int i=0, s1=1, s2=0, blocklen = data_len % 5552;
int j=0;
while (j < data_len) {
for (i=0; i < blocklen; ++i) s1 += data[j+i], s2 += s1;
s1 %= 65521, s2 %= 65521;
j += blocklen;
blocklen = 5552;
}
stbiw__sbpush(out, (unsigned char) (s2 >> 8));
stbiw__sbpush(out, (unsigned char) s2);
stbiw__sbpush(out, (unsigned char) (s1 >> 8));
stbiw__sbpush(out, (unsigned char) s1);
}
*out_len = stbiw__sbn(out);
// make returned pointer freeable
STBIW_MEMMOVE(stbiw__sbraw(out), out, *out_len);
return (unsigned char *) stbiw__sbraw(out);
}
unsigned int stbiw__crc32(unsigned char *buffer, int len)
{
static unsigned int crc_table[256];
unsigned int crc = ~0u;
int i,j;
if (crc_table[1] == 0)
for(i=0; i < 256; i++)
for (crc_table[i]=i, j=0; j < 8; ++j)
crc_table[i] = (crc_table[i] >> 1) ^ (crc_table[i] & 1 ? 0xedb88320 : 0);
for (i=0; i < len; ++i)
crc = (crc >> 8) ^ crc_table[buffer[i] ^ (crc & 0xff)];
return ~crc;
}
#define stbiw__wpng4(o,a,b,c,d) ((o)[0]=(unsigned char)(a),(o)[1]=(unsigned char)(b),(o)[2]=(unsigned char)(c),(o)[3]=(unsigned char)(d),(o)+=4)
#define stbiw__wp32(data,v) stbiw__wpng4(data, (v)>>24,(v)>>16,(v)>>8,(v));
#define stbiw__wptag(data,s) stbiw__wpng4(data, s[0],s[1],s[2],s[3])
static void stbiw__wpcrc(unsigned char **data, int len)
{
unsigned int crc = stbiw__crc32(*data - len - 4, len+4);
stbiw__wp32(*data, crc);
}
static unsigned char stbiw__paeth(int a, int b, int c)
{
int p = a + b - c, pa = abs(p-a), pb = abs(p-b), pc = abs(p-c);
if (pa <= pb && pa <= pc) return (unsigned char) a;
if (pb <= pc) return (unsigned char) b;
return (unsigned char) c;
}
unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len)
{
int ctype[5] = { -1, 0, 4, 2, 6 };
unsigned char sig[8] = { 137,80,78,71,13,10,26,10 };
unsigned char *out,*o, *filt, *zlib;
signed char *line_buffer;
int i,j,k,p,zlen;
if (stride_bytes == 0)
stride_bytes = x * n;
filt = (unsigned char *) STBIW_MALLOC((x*n+1) * y); if (!filt) return 0;
line_buffer = (signed char *) STBIW_MALLOC(x * n); if (!line_buffer) { STBIW_FREE(filt); return 0; }
for (j=0; j < y; ++j) {
static int mapping[] = { 0,1,2,3,4 };
static int firstmap[] = { 0,1,0,5,6 };
int *mymap = j ? mapping : firstmap;
int best = 0, bestval = 0x7fffffff;
for (p=0; p < 2; ++p) {
for (k= p?best:0; k < 5; ++k) {
int type = mymap[k],est=0;
unsigned char *z = pixels + stride_bytes*j;
for (i=0; i < n; ++i)
switch (type) {
case 0: line_buffer[i] = z[i]; break;
case 1: line_buffer[i] = z[i]; break;
case 2: line_buffer[i] = z[i] - z[i-stride_bytes]; break;
case 3: line_buffer[i] = z[i] - (z[i-stride_bytes]>>1); break;
case 4: line_buffer[i] = (signed char) (z[i] - stbiw__paeth(0,z[i-stride_bytes],0)); break;
case 5: line_buffer[i] = z[i]; break;
case 6: line_buffer[i] = z[i]; break;
}
for (i=n; i < x*n; ++i) {
switch (type) {
case 0: line_buffer[i] = z[i]; break;
case 1: line_buffer[i] = z[i] - z[i-n]; break;
case 2: line_buffer[i] = z[i] - z[i-stride_bytes]; break;
case 3: line_buffer[i] = z[i] - ((z[i-n] + z[i-stride_bytes])>>1); break;
case 4: line_buffer[i] = z[i] - stbiw__paeth(z[i-n], z[i-stride_bytes], z[i-stride_bytes-n]); break;
case 5: line_buffer[i] = z[i] - (z[i-n]>>1); break;
case 6: line_buffer[i] = z[i] - stbiw__paeth(z[i-n], 0,0); break;
}
}
if (p) break;
for (i=0; i < x*n; ++i)
est += abs((signed char) line_buffer[i]);
if (est < bestval) { bestval = est; best = k; }
}
}
// when we get here, best contains the filter type, and line_buffer contains the data
filt[j*(x*n+1)] = (unsigned char) best;
STBIW_MEMMOVE(filt+j*(x*n+1)+1, line_buffer, x*n);
}
STBIW_FREE(line_buffer);
zlib = stbi_zlib_compress(filt, y*( x*n+1), &zlen, 8); // increase 8 to get smaller but use more memory
STBIW_FREE(filt);
if (!zlib) return 0;
// each tag requires 12 bytes of overhead
out = (unsigned char *) STBIW_MALLOC(8 + 12+13 + 12+zlen + 12);
if (!out) return 0;
*out_len = 8 + 12+13 + 12+zlen + 12;
o=out;
STBIW_MEMMOVE(o,sig,8); o+= 8;
stbiw__wp32(o, 13); // header length
stbiw__wptag(o, "IHDR");
stbiw__wp32(o, x);
stbiw__wp32(o, y);
*o++ = 8;
*o++ = (unsigned char) ctype[n];
*o++ = 0;
*o++ = 0;
*o++ = 0;
stbiw__wpcrc(&o,13);
stbiw__wp32(o, zlen);
stbiw__wptag(o, "IDAT");
STBIW_MEMMOVE(o, zlib, zlen);
o += zlen;
STBIW_FREE(zlib);
stbiw__wpcrc(&o, zlen);
stbiw__wp32(o,0);
stbiw__wptag(o, "IEND");
stbiw__wpcrc(&o,0);
STBIW_ASSERT(o == out + *out_len);
return out;
}
int stbi_write_png(char const *filename, int x, int y, int comp, const void *data, int stride_bytes)
{
FILE *f;
int len;
unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len);
if (!png) return 0;
f = fopen(filename, "wb");
if (!f) { STBIW_FREE(png); return 0; }
fwrite(png, 1, len, f);
fclose(f);
STBIW_FREE(png);
return 1;
}
#endif // STB_IMAGE_WRITE_IMPLEMENTATION
/* Revision history
0.98 (2015-04-08)
added STBIW_MALLOC, STBIW_ASSERT etc
0.97 (2015-01-18)
fixed HDR asserts, rewrote HDR rle logic
0.96 (2015-01-17)
add HDR output
fix monochrome BMP
0.95 (2014-08-17)
add monochrome TGA output
0.94 (2014-05-31)
rename private functions to avoid conflicts with stb_image.h
0.93 (2014-05-27)
warning fixes
0.92 (2010-08-01)
casts to unsigned char to fix warnings
0.91 (2010-07-17)
first public release
0.90 first internal release
*/

6
lib/data/transport/transportBus.cpp

@ -7,10 +7,10 @@ transportBus::transportBus() :basicTransport(), basicDualThread(){
m_pLog = basicLogCollection::getInstance();
m_nInputBufferSize = -1;
m_nOutputBufferSize = -1;
m_pInputBuffer = ( U8 * ) malloc ( MAXIMAL_SERIAL_PACKET_LENGTH );
m_pInputBuffer = ( U8 * ) malloc ( MAXIMAL_BUS_PACKET_LENGTH );
if( m_pInputBuffer != NULL ) {
m_nInputBufferSize = 0;
m_pOutputBuffer = ( U8 * ) malloc ( MAXIMAL_SERIAL_PACKET_LENGTH );
m_pOutputBuffer = ( U8 * ) malloc ( MAXIMAL_BUS_PACKET_LENGTH );
if( m_pOutputBuffer != NULL ) {
m_nOutputBufferSize = 0;
//LOG("Starting");
@ -30,7 +30,7 @@ transportBus::~transportBus(){
bool transportBus::sendData( unsigned char *Data, int DataSize ){
m_mBufferProtectorMutex.lock();
if( m_nOutputBufferSize+DataSize > MAXIMAL_SERIAL_PACKET_LENGTH ) {
if( m_nOutputBufferSize+DataSize > MAXIMAL_BUS_PACKET_LENGTH ) {
m_mBufferProtectorMutex.unlock();
LOG("Data Too Long");
return false;

2
lib/data/transport/transportBus.h

@ -7,6 +7,8 @@
#define MAXIMAL_BUS_PACKET_LENGTH 2048
class transportBus: public basicTransport, public basicDualThread {
private:
basicLogCollection * m_pLog;
protected:
U8 *m_pInputBuffer;
int m_nInputBufferSize;

10
lib/data/transport/transportSerial.cpp

@ -58,7 +58,8 @@ void transportSerial::m_fThreadAProc( void ){
m_nOutputBufferSize = 0;
};
m_mBufferProtectorMutex.unlock();
SLEEP(10);
//SLEEP(10);
SLEEP(1);
};
};
@ -77,11 +78,14 @@ void transportSerial::m_fThreadBProc(void){
if (m_nInputBufferSize > 0 && m_bThreadBStatus == TH_WORKING) {
m_mQueueProtectorMutex.lock();
for (parseQueue::iterator index = m_vParsers.begin(); index != m_vParsers.end(); index++) {
if (m_bThreadBStatus == TH_WORKING) (*index)->parse(m_pInputBuffer, m_nInputBufferSize);
if (m_bThreadBStatus == TH_WORKING) {
(*index)->parse(m_pInputBuffer, m_nInputBufferSize);
}
};
m_mQueueProtectorMutex.unlock();
};
SLEEP(5);
//SLEEP(5);
SLEEP(1);
};
};
};

35
lib/data/zlMediaServer/zlMediaConnector.cpp

@ -0,0 +1,35 @@
#include "zlMediaConnector.h"
#define LOG( X ) m_pLog->Log( "ZLMEDIA_Ñ", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "ZLMEDIA_Ñ", this, _LOG_ERROR, X )
ZL_MEDIA_Connector::ZL_MEDIA_Connector( config_setting_t * Settings ){
//m_bIsConnected = false;
m_pLog = basicLogCollection::getInstance();
m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, "ZLMEDIA_SERVER" );
if( m_pSettings != NULL ) {
config_setting_t * tSetting = NULL;
tSetting = config_setting_get_member( m_pSettings, "SERVER_HOST" );
if( tSetting == NULL ){
tSetting = config_setting_add(m_pSettings, "SERVER_HOST", CONFIG_TYPE_STRING );
config_setting_set_string( tSetting, "localhost" );
basicSettingsProvider::getInstance()->compromise();
LOG("No MEDIA Host Setting! Using default!");
};
m_pProtocol = new protocolZLMEDIA( m_pSettings );
};
};
ZL_MEDIA_Connector::~ZL_MEDIA_Connector(){
if(m_pProtocol!=NULL) delete(m_pProtocol);
};
bool ZL_MEDIA_Connector::isConnected( void ){
if(m_pProtocol == NULL) return false;
return m_pProtocol->isOnline();
};
#undef LOG
#undef LOG_ERROR

24
lib/data/zlMediaServer/zlMediaConnector.h

@ -0,0 +1,24 @@
#ifndef __ZLMEDIA_SERVER_INTERFACE_HEADER__
#define __ZLMEDIA_SERVER_INTERFACE_HEADER__
#include "../../components/base/basicTypes.h"
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/base/basicLogCollection.h"
#include "../protocol/protocolZLMEDIA.h"
#include "../data/mysql/database_class.h"
class ZL_MEDIA_Connector{
private:
basicLogCollection * m_pLog;
config_setting_t * m_pSettings;
protocolZLMEDIA * m_pProtocol;
public:
explicit ZL_MEDIA_Connector( config_setting_t * Settings = NULL );
explicit ZL_MEDIA_Connector( int id, MySQL_Connector *DBC );
virtual ~ZL_MEDIA_Connector();
bool isConnected( void );
};
#endif

187
lib/hardware/i2c/i2cPort.cpp

@ -0,0 +1,187 @@
#include "i2cPort.h"
#define LOG( X ) m_pLog->Log( "I2CP", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "I2CP", this, _LOG_ERROR, X )
i2cPort::i2cPort( CSTR DevicePath, uint8_t DevBusAddr, int Speed, uint8_t RegAddrBytes ){
m_pLog = basicLogCollection::getInstance();
m_nFID = open( DevicePath, O_RDWR );
if( RegAddrBytes > 1 ) m_bRegAddrBytes = 2; else m_bRegAddrBytes = RegAddrBytes;
m_bAddress = DevBusAddr & 0x7F; // 7 bit bus address
if( m_nFID >= 0 ) {
ioctl( m_nFID, I2C_TIMEOUT, 3); // i2c timeout, 1 for 10ms ; if too small, i2c may lose response
ioctl( m_nFID, I2C_RETRIES, 3); // i2c retry limit
};
};
i2cPort::~i2cPort(){
if( m_nFID >= 0 ) {
close( m_nFID );
};
};
int i2cPort::_write( int fd, int device_addr, uint16_t offset, const char* data, int data_len ){
struct i2c_rdwr_ioctl_data at24c256; // structure pass to i2c driver
struct i2c_msg i2cmsg;
if( m_nFID < 0 ) return -1;
if( data_len > I2C_PAGE_BYTES ){
char tBuf[256];
sprintf( tBuf, "*** Warning: Page write mode should not exceed %d bytes, otherwise the current page will be rolled over!",I2C_PAGE_BYTES, data_len );
LOG( tBuf );
};
at24c256.nmsgs = 1; // message count in the structure
at24c256.msgs = &i2cmsg;
at24c256.msgs[0].len = m_bRegAddrBytes + data_len; // the offset address word is m_bRegAddrBytes bytes long, plus the buf_len
at24c256.msgs[0].addr = device_addr; // i2c slave device address
at24c256.msgs[0].flags = 0; // 0 for write; 1 for read
#ifdef _LINUX_I2C_DEV_H
at24c256.msgs[0].buf = (char *)malloc( at24c256.msgs[0].len );
#else
at24c256.msgs[0].buf = (uint8_t *)malloc( at24c256.msgs[0].len );
#endif
if(!at24c256.msgs[0].buf){
LOG("_write(): Failed to allocate memory for i2c message buffer!");
return -1;
}
#ifdef _LINUX_I2C_DEV_H
switch( m_bRegAddrBytes ) {
case 1:{
at24c256.msgs[0].buf[0] = (char)(offset & 0xFF);
break;
};
case 2:{
at24c256.msgs[0].buf[0] = (char)(offset >> 8); // MSB first
at24c256.msgs[0].buf[1] = (char)(offset); // LSB
};
};
#else
switch( m_bRegAddrBytes ) {
case 1:{
at24c256.msgs[0].buf[0] = (uint8_t)(offset & 0xFF);
break;
};
case 2:{
at24c256.msgs[0].buf[0] = (uint8_t)(offset >> 8); // MSB first
at24c256.msgs[0].buf[1] = (uint8_t)(offset); // LSB
};
};
#endif
memcpy( at24c256.msgs[0].buf + m_bRegAddrBytes, data, data_len ); // copy user's data to the structure buffer
if(ioctl(fd, I2C_RDWR, (unsigned long)&at24c256 ) < 0 ){ // write ioctl data to the i2c bus
LOG("_write(): Failed to write data to i2c device!");
free( at24c256.msgs[0].buf );
return -1;
};
free(at24c256.msgs[0].buf);
return 0;
};
int i2cPort::_read(int fd, int device_addr, uint16_t offset, char* data, int data_len){
struct i2c_rdwr_ioctl_data at24c256; // structure pass to i2c driver
struct i2c_msg i2cmsg[2]; // message count in the structure
#ifdef _LINUX_I2C_DEV_H
char dummy_write_buf[2];
#else
uint8_t dummy_write_buf[2];
#endif
if( m_nFID < 0 ) return -1;
if(data_len>I2C_PAGE_BYTES){
char tBuf[256];
sprintf( tBuf, "*** Warning: Sequential read should not exceed %d bytes, otherwise the read data will be rolled over! [%d]", I2C_PAGE_BYTES, data_len );
LOG(tBuf);
};
if( m_bRegAddrBytes > 0 ) {
// A dummy write operation should be done according to the AT24C256 i2c protocol
at24c256.nmsgs = 2; // message count in the structure
at24c256.msgs = i2cmsg;
at24c256.msgs[0].len = m_bRegAddrBytes; // the offset address word is m_bRegAddrBytes bytes long
at24c256.msgs[0].addr = device_addr;
at24c256.msgs[0].flags = 0; // 0 for write;
at24c256.msgs[0].buf = dummy_write_buf;
switch( m_bRegAddrBytes ){
case 1:{
at24c256.msgs[0].buf[0] = (offset) & 0xFF; // write address
break;
};
case 2:{
at24c256.msgs[0].buf[0] = (offset >> 8) & 0xFF; // write address MSB
at24c256.msgs[0].buf[1] = (offset) & 0xFF; // write address LSB
break;
};
};
// read operation
at24c256.msgs[1].len = data_len;
at24c256.msgs[1].addr = device_addr;
at24c256.msgs[1].flags = 1; // 1 for read; 0 for write
#ifdef _LINUX_I2C_DEV_H
at24c256.msgs[1].buf = data;
#else
at24c256.msgs[1].buf = (uint8_t *)data;
#endif
} else {
at24c256.nmsgs = 1; // message count in the structure
at24c256.msgs = i2cmsg;
at24c256.msgs[0].len = data_len;
at24c256.msgs[0].addr = device_addr;
at24c256.msgs[0].flags = 1; // 1 for read; 0 for write
#ifdef _LINUX_I2C_DEV_H
at24c256.msgs[0].buf = data;
#else
at24c256.msgs[0].buf = (uint8_t *)data;
#endif
};
if (ioctl(fd, I2C_RDWR, (unsigned long)&at24c256) < 0) {
LOG("_read(): Failed to read data from EEPROM via i2c!");
return -1;
};
return 0;
};
bool i2cPort::readMZ( uint16_t offset, uint8_t *buffer, int len ){
if( m_nFID >= 0 ) {
if( _read( m_nFID, m_bAddress, offset, (char*)buffer, len ) < 0 ) return false;
return true;
} else LOG_ERROR("Port is Closed!");
return false;
};
bool i2cPort::writeMZ( uint16_t offset, uint8_t *buffer, int len ){
if( m_nFID >= 0 ) {
if( _write( m_nFID, m_bAddress, offset, (char*)buffer, len ) < 0 ) return false;
return true;
} else LOG_ERROR("Port is Closed!");
return false;
};
uint8_t i2cPort::read8( uint16_t offset ){
uint8_t retVal;
if( m_nFID >= 0 ) {
if( _read( m_nFID, m_bAddress, offset, (char*)&retVal, 1 ) < 0 ) LOG_ERROR("Read8 Error!");
} else LOG_ERROR("Port is Closed!");
return retVal;
};
bool i2cPort::write8( uint16_t offset, uint8_t byte ){
if( m_nFID >= 0 ) {
if( _write( m_nFID, m_bAddress, offset, (char*)&byte, 1 ) < 0 ){
LOG_ERROR("Write8 Error!");
} else return true;
} else LOG_ERROR("Port is Closed!");
return false;
};
/*
int i2cPort::sendBlock(unsigned char *Data, int DataSize){
return 0;
};
int i2cPort::recptBlock(unsigned char *Buffer, int *BufferLength){
return 0;
};
*/
#undef LOG
#undef LOG_ERROR

39
lib/hardware/i2c/i2cPort.h

@ -0,0 +1,39 @@
#ifndef __I2C_PORT_HEADERS__
#define __I2C_PORT_HEADERS__
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#undef _LINUX_I2C_DEV_H
#include "../../data/transport/transportBus.h"
#define I2C_PAGE_BYTES 128 //64
class i2cPort {
private:
int m_nFID;
basicLogCollection * m_pLog;
uint8_t m_bAddress;
uint8_t m_bRegAddrBytes;
int _write( int fd, int device_addr, uint16_t offset, const char* data, int data_len );
int _read( int fd, int device_addr, uint16_t offset, char* data, int data_len );
public:
explicit i2cPort( CSTR DevicePath, uint8_t DevBusAddr, int Speed = 0, uint8_t RegAddrBytes = 1 );
virtual ~i2cPort();
bool readMZ( uint16_t offset, uint8_t *buffer, int len );
bool writeMZ( uint16_t offset, uint8_t *buffer, int len );
uint8_t read8( uint16_t offset );
bool write8( uint16_t offset, uint8_t byte );
};
#endif

957
lib/hardware/sensors/9dof/BNO055.cpp

@ -0,0 +1,957 @@
#include "BNO055.h"
#define LOG( X ) m_pLog->Log( "BNO055", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "BNO055", this, _LOG_ERROR, X )
const char * BNO_ERROR_MESSAGES[11] = {
"No error",
"Peripheral initialization error",
"System initialization error",
"Self test result failed",
"Register map value out of range",
"Register map address out of range",
"Register map write error",
"BNO low power mode not available for selected operation mode",
"Accelerometer power mode not available",
"Fusion algorithm configuration error",
"Sensor configuration error"
};
const char * BNO_STATUS_MESSAGES[7] = {
"System idle",
"System Error",
"Initializing peripherals",
"System Initialization",
"Executing selftest",
"Sensor fusion algorithm running",
"System running without fusion algorithm"
};
const uint32_t BNO_OUTPUT_DATA_DELAY[12] = {
1000,
10,
50,
10,
20,
100,
20,
10,
50,
20,
10,
10
};
sensorBNO::sensorBNO( config_setting_t *Settings, PATHFINDER_DBC *DBC ): basicThread(){
m_pLog = basicLogCollection::getInstance();
m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, "BNO055" );
m_pBLOG = objectPathfinderBinaryLog::getInstance();
m_pBus = NULL;
m_pDBC = DBC;
m_pDevicePath = "/dev/i2c-1";
m_bDeviceAddress = 0x29;
m_nSampleDelay = 100;
m_bTargetWM = BNO_WM_CONFIG;
m_bActualWM = 0;
memset( &m_sSettings, 0 , sizeof(BNO_SETTINGS) );
m_sSettings.wmode = BNO_WM_IMU;
m_sSettings.map_x = 1;
m_sSettings.map_y = 2;
m_sSettings.map_z = 3;
memset( &m_sID, 0, sizeof(BNO_ID_MAP) );
memset( &m_sDATA, 0, sizeof(BNO_DATA_MAP) );
memset( &m_sSTATUS, 0, sizeof(BNO_STATUS_MAP) );
memset( &m_sCONFIG0, 0, sizeof(BNO_CONFIG0_MAP) );
memset( &m_sCONFIG1, 0, sizeof(BNO_CONFIG1_MAP) );
};
sensorBNO::~sensorBNO(){
waitThreadEnd( true );
if(m_pBus != NULL ) delete( m_pBus );
};
void sensorBNO::logConfig(){
char tBuff[256];
sprintf( tBuff, "OPR_MODE: 0x%02X", m_sCONFIG0.OP_MODE );
LOG( tBuff );
switch( m_sCONFIG0.OP_MODE & BNO_WMODE_MASK ) {
case BNO_WM_CONFIG: LOG("CHIP WM is CONFIG"); break;
case BNO_WM_ACC_ONLY: LOG("CHIP WM is Acc Only"); break;
case BNO_WM_MAG_ONLY: LOG("CHIP WM is Magnetometer Only"); break;
case BNO_WM_GYR_ONLY: LOG("CHIP WM is Gyroscope Only"); break;
case BNO_WM_ACC_MAG: LOG("CHIP WM is Acc and Magnetometer"); break;
case BNO_WM_ACC_GYR: LOG("CHIP WM is Acc and Gyroscope"); break;
case BNO_WM_MAG_GYR: LOG("CHIP WM is Magnetometer and Gyroscope"); break;
case BNO_WM_AMG_NO_FUSION: LOG("CHIP WM is All sensors - No Fusion!"); break;
case BNO_WM_IMU: LOG("CHIP WM is Fusion IMU"); break;
case BNO_WM_COMPAS: LOG("CHIP WM is Fusion Compas"); break;
case BNO_WM_M4G: LOG("CHIP WM is Fusion Magnetometer and Gyroscope"); break;
case BNO_WM_NDOF_FMC_OFF: LOG("CHIP WM is Fusion NDOF no fast Mag calibartion"); break;
case BNO_WM_NDOF: LOG("CHIP WM is Fusion NDOF"); break;
default: LOG_ERROR("CHIP WM is Unknown!");
};
switch( m_eAccWorkMode ) {
case BNO_ACC_NORMAL: LOG("ACC WM is Normal"); break;
case BNO_ACC_SUSPEND: LOG("ACC WM is Suspended"); break;
case BNO_ACC_LP1: LOG("ACC WM is Low Power 1"); break;
case BNO_ACC_STANDBY: LOG("ACC WM is Standby"); break;
case BNO_ACC_LP2: LOG("ACC WM is Low Power 2"); break;
case BNO_ACC_DEEP_SUSPEND: LOG("ACC WM is Deep Suspend"); break;
};
switch( m_eAccRange ) {
case BNO_ACC_2G: LOG("ACC Range is 2G"); break;
case BNO_ACC_4G: LOG("ACC Range is 4G"); break;
case BNO_ACC_8G: LOG("ACC Range is 8G"); break;
case BNO_ACC_16G: LOG("ACC Range is 16G"); break;
};
switch( m_eAccBandwidth ) {
case BNO_ACC_7_81HZ: LOG("ACC Bandwidth is 7.81Hz"); break;
case BNO_ACC_15_36HZ: LOG("ACC Bandwidth is 15.36Hz"); break;
case BNO_ACC_31_25HZ: LOG("ACC Bandwidth is 31.25Hz"); break;
case BNO_ACC_62_50HZ: LOG("ACC Bandwidth is 62.5Hz"); break;
case BNO_ACC_125HZ: LOG("ACC Bandwidth is 125Hz"); break;
case BNO_ACC_250HZ: LOG("ACC Bandwidth is 250Hz"); break;
case BNO_ACC_500HZ: LOG("ACC Bandwidth is 500Hz"); break;
case BNO_ACC_1000HZ: LOG("ACC Bandwidth is 1KHz"); break;
};
};
bool sensorBNO::updateSettings(){
if( m_pDevicePath == NULL ) return false;
if( m_pBus == NULL ) return false;
if( m_pDBC!= NULL ) {
if( !m_pDBC->getSettingsIMU( &m_sSettings ) ) return false;
};
m_bTargetWM = BNO_WM_CONFIG;
setMode( BNO_WM_CONFIG );
LOG("Mode Set to Config");
/* Reset */
LOG("Trigger Reset");
m_pBus->write8( BNO055_SYS_TRIGGER_ADDR, 0x20 );
/* Delay incrased to 30ms due to power issues https://tinyurl.com/y375z699 */
SLEEP(1000);
LOG("Read Chip ID");
while( m_pBus->read8( BNO055_CHIP_ID_ADDR) != BNO055_ID ){
SLEEP(10);
};
LOG("Done!" );
SLEEP(50);
LOG("Set PowerMode");
/* Set to normal power mode */
m_pBus->write8( BNO055_PWR_MODE_ADDR, BNO_PM_NORMAL );
SLEEP(10);
LOG("Set Page 0");
m_pBus->write8( BNO055_PAGE_ID_ADDR, 0 );
/* Set the output units */
uint8_t unitsel = (0 << 7) | // Orientation = Android
(0 << 4) | // Temperature = Celsius
(0 << 2) | // Euler = Degrees
(1 << 1) | // Gyro = Rads
(0 << 0); // Accelerometer = m/s^2
m_pBus->write8(BNO055_UNIT_SEL_ADDR, unitsel);
/* Configure axis mapping (see section 3.4) */
uint8_t axis_map_cfg = 0;
axis_map_cfg = ((m_sSettings.map_z & 3) << 4) | ((m_sSettings.map_y & 3) << 2) | (m_sSettings.map_x & 3);
m_pBus->write8(BNO055_AXIS_MAP_CONFIG_ADDR, axis_map_cfg );//REMAP_CONFIG_P2); // P0-P7, Default is P1
SLEEP(10);
uint8_t axis_sign_cfg = 0;
axis_sign_cfg = (m_sSettings.map_x & 4) | ((m_sSettings.map_y & 4) >> 1) || ((m_sSettings.map_x & 4) >> 2);
m_pBus->write8(BNO055_AXIS_MAP_SIGN_ADDR, axis_sign_cfg );//REMAP_SIGN_P2); // P0-P7, Default is P1
SLEEP(10);
LOG("Clear Triggers");
m_pBus->write8( BNO055_SYS_TRIGGER_ADDR, 0x0 );
SLEEP( 10 );
LOG("Start WM");
setMode( m_sSettings.wmode );
SLEEP(20);
m_bTargetWM = m_sSettings.wmode;
return true;
};
bool sensorBNO::create(){
if( m_pDevicePath == NULL ) return false;
if( m_pBus != NULL ) delete( m_pBus );
m_pBus = new i2cPort( m_pDevicePath, m_bDeviceAddress );
if( m_pBus != NULL ) {
if( m_pDBC!= NULL ) {
if( m_pDBC->getSettingsIMU( &m_sSettings ) ){
m_bTargetWM = m_sSettings.wmode;
};
};
LOG("Read Chip ID");
uint8_t id = m_pBus->read8( BNO055_CHIP_ID_ADDR );
if( id != BNO055_ID ){
SLEEP( 1000 ); // hold on for boot
id = m_pBus->read8( BNO055_CHIP_ID_ADDR );
if( id != BNO055_ID ){
return false; // still not? ok -> fail
};
};
LOG("Chip ID - OK");
//setExtCrystalUse( true );
//SLEEP(1000);
LOG("Mode Seting");
/* Switch to config mode (just in case since this is the default) */
setMode( BNO_WM_CONFIG );
LOG("Mode Set to Config");
/* Reset */
LOG("Trigger Reset");
m_pBus->write8( BNO055_SYS_TRIGGER_ADDR, 0x20 );
/* Delay incrased to 30ms due to power issues https://tinyurl.com/y375z699 */
SLEEP(1000);
LOG("Read Chip ID");
while( m_pBus->read8( BNO055_CHIP_ID_ADDR) != BNO055_ID ){
SLEEP(10);
};
LOG("Done!" );
SLEEP(50);
LOG("Set PowerMode");
/* Set to normal power mode */
m_pBus->write8( BNO055_PWR_MODE_ADDR, BNO_PM_NORMAL );
SLEEP(10);
LOG("Set Page 0");
m_pBus->write8( BNO055_PAGE_ID_ADDR, 0 );
/* Set the output units */
uint8_t unitsel = (0 << 7) | // Orientation = Android
(0 << 4) | // Temperature = Celsius
(0 << 2) | // Euler = Degrees
(1 << 1) | // Gyro = Rads
(0 << 0); // Accelerometer = m/s^2
m_pBus->write8(BNO055_UNIT_SEL_ADDR, unitsel);
/* Configure axis mapping (see section 3.4) */
uint8_t axis_map_cfg = 0;
axis_map_cfg = ((m_sSettings.map_z & 3) << 4) | ((m_sSettings.map_y & 3) << 2) | (m_sSettings.map_x & 3);
m_pBus->write8(BNO055_AXIS_MAP_CONFIG_ADDR, axis_map_cfg );//REMAP_CONFIG_P2); // P0-P7, Default is P1
SLEEP(10);
uint8_t axis_sign_cfg = 0;
axis_sign_cfg = (m_sSettings.map_x & 4) | ((m_sSettings.map_y & 4) >> 1) || ((m_sSettings.map_x & 4) >> 2);
m_pBus->write8(BNO055_AXIS_MAP_SIGN_ADDR, axis_sign_cfg );//REMAP_SIGN_P2); // P0-P7, Default is P1
SLEEP(10);
LOG("Clear Triggers");
m_pBus->write8( BNO055_SYS_TRIGGER_ADDR, 0x0 );
SLEEP( 10 );
/*
LOG("Trigger Self Test");
m_pBus->write8( BNO055_SYS_TRIGGER_ADDR, 0x01 );
SLEEP( 5000 );
LOG("Read Test Results");
uint8_t tr = m_pBus->read8( BNO055_SELFTEST_RESULT_ADDR );
if( ( tr & 0x0F ) == 0x0F ) {
LOG("Self Test Passed");
char tBuff[64];
sprintf( tBuff, "Code: 0x%02X", tr );
LOG( tBuff );
} else {
LOG_ERROR("Self Test Failure!");
char tBuff[64];
sprintf( tBuff, "Code: 0x%02X", tr );
LOG( tBuff );
return false;
};
LOG("Clear Triggers");
m_pBus->write8( BNO055_SYS_TRIGGER_ADDR, 0x0 );
SLEEP(10);
*/
/* Set the requested operating mode (see section 3.3) */
LOG("Start WM");
if( setMode( m_bTargetWM ) ) {
SLEEP(20);
return init();
};
} else LOG_ERROR("No I2C Bus Created!");
return false;
};
bool sensorBNO::validate(){
if( getStatus( &m_sSTATUS ) ){
#ifdef DEBUG
char tBuff[256];
sprintf( tBuff, "Temperature: %02X", m_sSTATUS.temper );
LOG( tBuff );
sprintf( tBuff, "Calibration: %02X", m_sSTATUS.cal_status );
LOG( tBuff );
sprintf( tBuff, "ST Result: %02X", m_sSTATUS.st_result );
LOG( tBuff );
sprintf( tBuff, "INT Status: %02X", m_sSTATUS.int_status );
LOG( tBuff );
sprintf( tBuff, "CLC Status: %02X", m_sSTATUS.sys_clc_status );
LOG( tBuff );
sprintf( tBuff, "SYS Status: %02X", m_sSTATUS.system_status );
LOG( tBuff );
sprintf( tBuff, "SYS Error: %02X [%s]", m_sSTATUS.system_error, BNO_ERROR_MESSAGES[m_sSTATUS.system_error] );
LOG( tBuff );
#endif
return true;
};
return false;
};
void sensorBNO::m_fThreadProc( void ){
m_bThreadStatus = TH_WORKING;
while( m_bThreadStatus < TH_ENDED ){
if( m_bTargetWM != 0 ){
uint8_t S_S, STS, S_E;
if( m_bActualWM == 0 ) {
m_bActualWM = getMode();
if( m_bActualWM != 0 ) continue;
// Config Procedures
} else {
BNO_EVTREC * tDATA;
tDATA = getEVT_REC();
if( tDATA != NULL ) {
if(m_pBLOG != NULL ) {
m_pBLOG->registerBNO( tDATA );
};
if( m_pDBC != NULL ) {
m_pDBC->updateBNO_DATA( tDATA );
};
free( tDATA );
};
};
/*
if( getSystemStatus( &S_S, &STS, &S_E ) ){
switch( S_S ) {
case 0: {
char tBuffer[64];
uint8_t tMode =
sprintf( tBuffer, "Idle Mode %d:%d", tMode, m_eWorkMode );
LOG(tBuffer);
sprintf( tBuffer, "Temperature: %d", getTemp() );
LOG(tBuffer);
if( isFullyCalibrated() ) {
LOG("Fully Calibrated!");
} else {
LOG("Not Calibrated!");
};
if( tMode != m_eWorkMode ) {
if( setMode( m_eWorkMode ) ){
LOG("Mode Changed");
SLEEP( 200 );
} else {
LOG("Mode Changed Failure");
};
};
break;
};
case 1: LOG("System Error"); break;
case 2: LOG("Initializing Peripherals"); break;
case 3: LOG("System Iniitalization"); break;
case 4: LOG("Executing Self-Test"); break;
case 5: LOG("Sensor fusion algorithm running"); break;
case 6: LOG("System running without fusion algorithms"); break;
};
}; */
SLEEP( BNO_OUTPUT_DATA_DELAY[ m_bActualWM ] );
} else SLEEP( 1000 );
};
};
/*!
* @brief Puts the chip in the specified operating mode
* @param mode
* mode values
* [OPERATION_MODE_CONFIG,
* OPERATION_MODE_ACCONLY,
* OPERATION_MODE_MAGONLY,
* OPERATION_MODE_GYRONLY,
* OPERATION_MODE_ACCMAG,
* OPERATION_MODE_ACCGYRO,
* OPERATION_MODE_MAGGYRO,
* OPERATION_MODE_AMG,
* OPERATION_MODE_IMUPLUS,
* OPERATION_MODE_COMPASS,
* OPERATION_MODE_M4G,
* OPERATION_MODE_NDOF_FMC_OFF,
* OPERATION_MODE_NDOF]
*/
bool sensorBNO::setMode( uint8_t mode ){
if( m_pBus != NULL ){
if( m_pBus->write8( BNO055_OPR_MODE_ADDR, mode ) ) {
SLEEP( 30 );
return true;
};
};
return false;
};
uint8_t sensorBNO::getMode(){
uint8_t retVal = 255;
if( m_pBus != NULL ){
retVal = m_pBus->read8( BNO055_OPR_MODE_ADDR ) & BNO_WMODE_MASK;
};
return retVal;
};
/*!
* @brief Use the external 32.768KHz crystal
* @param usextal
* use external crystal boolean
*/
bool sensorBNO::setExtCrystalUse( bool usextal) {
if( m_pBus != NULL ){
uint8_t tMode = m_bActualWM;
/* Switch to config mode (just in case since this is the default) */
setMode( BNO_WM_CONFIG );
SLEEP( 25 );
m_pBus->write8( BNO055_PAGE_ID_ADDR, 0 );
if( usextal ){
m_pBus->write8( BNO055_SYS_TRIGGER_ADDR, 0x80 );
} else {
m_pBus->write8( BNO055_SYS_TRIGGER_ADDR, 0x00 );
};
SLEEP( 10 );
/* Set the requested operating mode (see section 3.3) */
setMode( tMode );
SLEEP( 20 );
};
return false;
};
/*!
* @brief Gets the latest system status info
* @param system_status
* system status info
* @param self_test_result
* self test result
* @param system_error
* system error info
*/
bool sensorBNO::getSystemStatus( uint8_t *system_status, uint8_t *self_test_result, uint8_t *system_error ){
if( m_pBus != NULL ){
m_pBus->write8( BNO055_PAGE_ID_ADDR, 0 );
/* System Status (see section 4.3.58)
0 = Idle
1 = System Error
2 = Initializing Peripherals
3 = System Iniitalization
4 = Executing Self-Test
5 = Sensor fusion algorithm running
6 = System running without fusion algorithms
*/
if( system_status != NULL ) *system_status = m_pBus->read8(BNO055_SYS_STAT_ADDR);
/* Self Test Results
1 = test passed, 0 = test failed
Bit 0 = Accelerometer self test
Bit 1 = Magnetometer self test
Bit 2 = Gyroscope self test
Bit 3 = MCU self test
0x0F = all good!
*/
if( self_test_result != NULL ) *self_test_result = m_pBus->read8(BNO055_SELFTEST_RESULT_ADDR);
/* System Error (see section 4.3.59)
0 = No error
1 = Peripheral initialization error
2 = System initialization error
3 = Self test result failed
4 = Register map value out of range
5 = Register map address out of range
6 = Register map write error
7 = BNO low power mode not available for selected operat ion mode
8 = Accelerometer power mode not available
9 = Fusion algorithm configuration error
A = Sensor configuration error
*/
if( system_error != NULL ) *system_error = m_pBus->read8(BNO055_SYS_ERR_ADDR);
SLEEP( 200 );
return true;
};
return false;
};
/*!
* @brief Gets the chip revision numbers
* @param info
* revision info
*/
bool sensorBNO::getRevInfo( bno055_rev_info_t *info ){
if( m_pBus != NULL ){
uint8_t a, b;
memset( info, 0, sizeof( bno055_rev_info_t ) );
/* Check the accelerometer revision */
info->accel_rev = m_pBus->read8(BNO055_ACCEL_REV_ID_ADDR);
/* Check the magnetometer revision */
info->mag_rev = m_pBus->read8(BNO055_MAG_REV_ID_ADDR);
/* Check the gyroscope revision */
info->gyro_rev = m_pBus->read8(BNO055_GYRO_REV_ID_ADDR);
/* Check the SW revision */
info->bl_rev = m_pBus->read8(BNO055_BL_REV_ID_ADDR);
a = m_pBus->read8( BNO055_SW_REV_ID_LSB_ADDR );
b = m_pBus->read8( BNO055_SW_REV_ID_MSB_ADDR );
info->sw_rev = (((uint16_t)b) << 8) | ((uint16_t)a);
return true;
};
return false;
};
/*!
* @brief Gets current calibration state. Each value should be a uint8_t
* pointer and it will be set to 0 if not calibrated and 3 if
* fully calibrated.
* See section 34.3.54
* @param sys
* Current system calibration status, depends on status of all sensors,
* read-only
* @param gyro
* Current calibration status of Gyroscope, read-only
* @param accel
* Current calibration status of Accelerometer, read-only
* @param mag
* Current calibration status of Magnetometer, read-only
*/
bool sensorBNO::getCalibration( uint8_t *sys, uint8_t *gyro, uint8_t *accel, uint8_t *mag ){
if( m_pBus != NULL ){
uint8_t calData = m_pBus->read8( BNO055_CALIB_STAT_ADDR );
if( sys != NULL ) *sys = (calData >> 6) & 0x03;
if( gyro != NULL ) *gyro = (calData >> 4) & 0x03;
if( accel != NULL ) *accel = (calData >> 2) & 0x03;
if( mag != NULL ) *mag = calData & 0x03;
return true;
};
return false;
};
/*!
* @brief Gets the temperature in degrees celsius
* @return temperature in degrees celsius
*/
int8_t sensorBNO::getTemp(){
if( m_pBus != NULL ){
int8_t temp = (int8_t)(m_pBus->read8(BNO055_TEMP_ADDR));
return temp;
};
return -128;
};
/*!
* @brief Checks of all cal status values are set to 3 (fully calibrated)
* @return status of calibration
*/
bool sensorBNO::isFullyCalibrated(){
uint8_t system, gyro, accel, mag;
if( getCalibration( &system, &gyro, &accel, &mag ) ){
char tBuff[128];
sprintf( tBuff, "Calibration Sys: %d Gyr: %d Acc: %d Mag: %d", system, gyro, accel, mag );
LOG( tBuff );
switch( m_bActualWM ){
case BNO_WM_ACC_ONLY: return (accel == 3);
case BNO_WM_MAG_ONLY: return (mag == 3);
case BNO_WM_GYR_ONLY:
case BNO_WM_M4G: /* No magnetometer calibration required. */
return (gyro == 3);
case BNO_WM_ACC_MAG:
case BNO_WM_COMPAS:
return (accel == 3 && mag == 3);
case BNO_WM_ACC_GYR:
case BNO_WM_IMU:
return (accel == 3 && gyro == 3);
case BNO_WM_MAG_GYR:
return (mag == 3 && gyro == 3);
default:
return (system == 3 && gyro == 3 && accel == 3 && mag == 3);
};
};
return false;
};
/*!
* @brief Enter Suspend mode (i.e., sleep)
*/
bool sensorBNO::enterSuspendMode(){
if( m_pBus != NULL ){
uint8_t tMode = m_bActualWM;
/* Switch to config mode (just in case since this is the default) */
setMode( BNO_WM_CONFIG );
SLEEP( 25 );
m_pBus->write8( BNO055_PWR_MODE_ADDR, 0x02 );
/* Set the requested operating mode (see section 3.3) */
setMode( tMode );
SLEEP( 20 );
return true;
};
return false;
};
/*!
* @brief Enter Normal mode (i.e., wake)
*/
bool sensorBNO::enterNormalMode(){
if( m_pBus != NULL ){
uint8_t tMode = m_bActualWM;
/* Switch to config mode (just in case since this is the default) */
setMode( BNO_WM_CONFIG );
SLEEP( 25 );
m_pBus->write8( BNO055_PWR_MODE_ADDR, 0x00 );
/* Set the requested operating mode (see section 3.3) */
setMode( tMode );
SLEEP( 20 );
return true;
};
return false;
};
/*!
* @brief Gets a vector reading from the specified source
* @param vector_type
* possible vector type values
* [VECTOR_ACCELEROMETER
* VECTOR_MAGNETOMETER
* VECTOR_GYROSCOPE
* VECTOR_EULER
* VECTOR_LINEARACCEL
* VECTOR_GRAVITY]
* @return vector from specified source
*/
bool sensorBNO::getVector( uint16_t vector_type, BNO_3D_VECTOR *xyz ){
if( xyz != NULL ) {
if( m_pBus != NULL ){
uint8_t buffer[6];
memset(buffer, 0, 6);
int16_t x, y, z;
x = y = z = 0;
/* Read vector data (6 bytes) */
if( m_pBus->readMZ( vector_type, buffer, 6 ) ){
x = ((int16_t)buffer[0]) | (((int16_t)buffer[1]) << 8);
y = ((int16_t)buffer[2]) | (((int16_t)buffer[3]) << 8);
z = ((int16_t)buffer[4]) | (((int16_t)buffer[5]) << 8);
/*!
* Convert the value to an appropriate range (section 3.6.4)
* and assign the value to the Vector type
*/
switch( vector_type ){
case VECTOR_MAGNETOMETER:
/* 1uT = 16 LSB */
xyz->x = ((double)x) / 16.0;
xyz->y = ((double)y) / 16.0;
xyz->z = ((double)z) / 16.0;
break;
case VECTOR_GYROSCOPE:
/* 1dps = 16 LSB */
xyz->x = ((double)x) / 16.0;
xyz->y = ((double)y) / 16.0;
xyz->z = ((double)z) / 16.0;
break;
case VECTOR_EULER:
/* 1 degree = 16 LSB */
xyz->x = ((double)x) / 16.0;
xyz->y = ((double)y) / 16.0;
xyz->z = ((double)z) / 16.0;
break;
case VECTOR_ACCELEROMETER:
/* 1m/s^2 = 100 LSB */
xyz->x = ((double)x) / 100.0;
xyz->y = ((double)y) / 100.0;
xyz->z = ((double)z) / 100.0;
break;
case VECTOR_LINEARACCEL:
/* 1m/s^2 = 100 LSB */
xyz->x = ((double)x) / 100.0;
xyz->y = ((double)y) / 100.0;
xyz->z = ((double)z) / 100.0;
break;
case VECTOR_GRAVITY:
/* 1m/s^2 = 100 LSB */
xyz->x = ((double)x) / 100.0;
xyz->y = ((double)y) / 100.0;
xyz->z = ((double)z) / 100.0;
break;
};
return true;
};
};
};
return false;
};
/*!
* @brief Gets a quaternion reading from the specified source
* @return quaternion reading
*/
bool sensorBNO::getQuat( BNO_Quat *quat ){
if( quat != NULL ){
if( m_pBus != NULL ){
uint8_t buffer[8];
memset(buffer, 0, 8);
int16_t x, y, z, w;
x = y = z = w = 0;
/* Read quat data (8 bytes) */
if( m_pBus->readMZ( BNO055_QUATERNION_DATA_W_LSB_ADDR, buffer, 8 ) ){
w = (((uint16_t)buffer[1]) << 8) | ((uint16_t)buffer[0]);
x = (((uint16_t)buffer[3]) << 8) | ((uint16_t)buffer[2]);
y = (((uint16_t)buffer[5]) << 8) | ((uint16_t)buffer[4]);
z = (((uint16_t)buffer[7]) << 8) | ((uint16_t)buffer[6]);
/*!
* Assign to Quaternion
* See
* http://ae-bst.resource.bosch.com/media/products/dokumente/bno055/BST_BNO055_DS000_12~1.pdf
* 3.6.5.5 Orientation (Quaternion)
*/
const double scale = ( 1.0 / (1 << 14) );
quat->w = scale * w;
quat->x = scale * x;
quat->y = scale * y;
quat->z = scale * z;
return true;
};
};
};
return false;
};
BNO_EVTREC *sensorBNO::getEVT_REC(){
const double scale = ( 1.0 / (1 << 14) );
BNO_EVTREC * retVal = NULL;
PF_TIMESTAMP * tTS1 = NULL;
PF_TIMESTAMP * tTS2 = NULL;
tTS1 = getPFTS();
if( tTS1 != NULL ) {
BNO_DATA_MAP * tDATA;
tDATA = getData();
if( tDATA != NULL ) {
tTS2 = getPFTS();
if( tTS2 != NULL ) {
retVal = (BNO_EVTREC *) malloc(sizeof(BNO_EVTREC));
if( retVal != NULL ) {
uint32_t tVal;
memset(retVal, 0 , sizeof(BNO_EVTREC));
retVal->wm_mode = m_bTargetWM;//m_bActualWM;
if( tTS2->seconds > tTS1->seconds ) {
tVal = ( tTS1->milliseconds + 1000 + tTS2->milliseconds ) >> 1;
} else {
tVal = ( tTS1->milliseconds + tTS2->milliseconds ) >> 1;
};
if( tVal > 999 ) {
retVal->milliseconds = tVal - 1000;
retVal->seconds = tTS1->seconds + 1;
} else {
retVal->milliseconds = tVal;
retVal->seconds = tTS1->seconds;
};
switch( m_bActualWM ) {
case BNO_WM_ACC_ONLY:
/* 1m/s^2 = 100 LSB */
retVal->acc.x = ((double)tDATA->ACC_DATA_X) / 100.0;
retVal->acc.y = ((double)tDATA->ACC_DATA_Y) / 100.0;
retVal->acc.z = ((double)tDATA->ACC_DATA_Z) / 100.0;
case BNO_WM_MAG_ONLY:
/* 1uT = 16 LSB */
retVal->mag.x = ((double)tDATA->MAG_DATA_X) / 16.0;
retVal->mag.y = ((double)tDATA->MAG_DATA_Y) / 16.0;
retVal->mag.z = ((double)tDATA->MAG_DATA_Z) / 16.0;
case BNO_WM_GYR_ONLY:
/* 1uT = 16 LSB */
retVal->gyr.x = ((double)tDATA->GYR_DATA_X) / 16.0;
retVal->gyr.y = ((double)tDATA->GYR_DATA_Y) / 16.0;
retVal->gyr.z = ((double)tDATA->GYR_DATA_Z) / 16.0;
case BNO_WM_ACC_MAG:
/* 1m/s^2 = 100 LSB */
retVal->acc.x = ((double)tDATA->ACC_DATA_X) / 100.0;
retVal->acc.y = ((double)tDATA->ACC_DATA_Y) / 100.0;
retVal->acc.z = ((double)tDATA->ACC_DATA_Z) / 100.0;
/* 1uT = 16 LSB */
retVal->mag.x = ((double)tDATA->MAG_DATA_X) / 16.0;
retVal->mag.y = ((double)tDATA->MAG_DATA_Y) / 16.0;
retVal->mag.z = ((double)tDATA->MAG_DATA_Z) / 16.0;
case BNO_WM_ACC_GYR:
/* 1m/s^2 = 100 LSB */
retVal->acc.x = ((double)tDATA->ACC_DATA_X) / 100.0;
retVal->acc.y = ((double)tDATA->ACC_DATA_Y) / 100.0;
retVal->acc.z = ((double)tDATA->ACC_DATA_Z) / 100.0;
/* 1uT = 16 LSB */
retVal->gyr.x = ((double)tDATA->GYR_DATA_X) / 16.0;
retVal->gyr.y = ((double)tDATA->GYR_DATA_Y) / 16.0;
retVal->gyr.z = ((double)tDATA->GYR_DATA_Z) / 16.0;
case BNO_WM_MAG_GYR:
/* 1uT = 16 LSB */
retVal->mag.x = ((double)tDATA->MAG_DATA_X) / 16.0;
retVal->mag.y = ((double)tDATA->MAG_DATA_Y) / 16.0;
retVal->mag.z = ((double)tDATA->MAG_DATA_Z) / 16.0;
/* 1uT = 16 LSB */
retVal->gyr.x = ((double)tDATA->GYR_DATA_X) / 16.0;
retVal->gyr.y = ((double)tDATA->GYR_DATA_Y) / 16.0;
retVal->gyr.z = ((double)tDATA->GYR_DATA_Z) / 16.0;
case BNO_WM_AMG_NO_FUSION:
/* 1m/s^2 = 100 LSB */
retVal->acc.x = ((double)tDATA->ACC_DATA_X) / 100.0;
retVal->acc.y = ((double)tDATA->ACC_DATA_Y) / 100.0;
retVal->acc.z = ((double)tDATA->ACC_DATA_Z) / 100.0;
/* 1uT = 16 LSB */
retVal->mag.x = ((double)tDATA->MAG_DATA_X) / 16.0;
retVal->mag.y = ((double)tDATA->MAG_DATA_Y) / 16.0;
retVal->mag.z = ((double)tDATA->MAG_DATA_Z) / 16.0;
/* 1uT = 16 LSB */
retVal->gyr.x = ((double)tDATA->GYR_DATA_X) / 16.0;
retVal->gyr.y = ((double)tDATA->GYR_DATA_Y) / 16.0;
retVal->gyr.z = ((double)tDATA->GYR_DATA_Z) / 16.0;
case BNO_WM_IMU: // Fusion Modes -> All datas Update!
case BNO_WM_COMPAS:
case BNO_WM_M4G:
case BNO_WM_NDOF_FMC_OFF:
case BNO_WM_NDOF:
/* 1m/s^2 = 100 LSB */
retVal->acc.x = ((double)tDATA->ACC_DATA_X) / 100.0;
retVal->acc.y = ((double)tDATA->ACC_DATA_Y) / 100.0;
retVal->acc.z = ((double)tDATA->ACC_DATA_Z) / 100.0;
/* 1uT = 16 LSB */
retVal->mag.x = ((double)tDATA->MAG_DATA_X) / 16.0;
retVal->mag.y = ((double)tDATA->MAG_DATA_Y) / 16.0;
retVal->mag.z = ((double)tDATA->MAG_DATA_Z) / 16.0;
/* 1uT = 16 LSB */
retVal->gyr.x = ((double)tDATA->GYR_DATA_X) / 16.0;
retVal->gyr.y = ((double)tDATA->GYR_DATA_Y) / 16.0;
retVal->gyr.z = ((double)tDATA->GYR_DATA_Z) / 16.0;
/* 1 degree = 16 LSB */
retVal->eul.x = ((double)tDATA->EUL_PITCH) / 16.0;
retVal->eul.y = ((double)tDATA->EUL_ROLL) / 16.0;
retVal->eul.z = ((double)tDATA->EUL_YAW) / 16.0;
/* 1m/s^2 = 100 LSB */
retVal->mov.x = ((double)tDATA->LIA_X) / 100.0;
retVal->mov.y = ((double)tDATA->LIA_Y) / 100.0;
retVal->mov.z = ((double)tDATA->LIA_Z) / 100.0;
/* 1m/s^2 = 100 LSB */
retVal->grav.x = ((double)tDATA->GRV_X ) / 100.0;
retVal->grav.y = ((double)tDATA->GRV_Y ) / 100.0;
retVal->grav.z = ((double)tDATA->GRV_Z ) / 100.0;
/* Quat */
retVal->quat.w = scale * tDATA->QUA_W;//(((uint16_t)buffer[1]) << 8) | ((uint16_t)buffer[0]);
retVal->quat.x = scale * tDATA->QUA_X;//(((uint16_t)buffer[3]) << 8) | ((uint16_t)buffer[2]);
retVal->quat.y = scale * tDATA->QUA_Y;//(((uint16_t)buffer[5]) << 8) | ((uint16_t)buffer[4]);
retVal->quat.z = scale * tDATA->QUA_Z;//(((uint16_t)buffer[7]) << 8) | ((uint16_t)buffer[6]);
};
};
free( tTS2 );
};
//free( tDATA );
// No free - getdata uses Class mem
};
free( tTS1 );
};
return retVal;
};
BNO_DATA_MAP *sensorBNO::getData(){
if( switchPage(0) ) {
m_pBus->readMZ( BNO_DATA_OFFSET, (uint8_t *)&m_sDATA, sizeof(BNO_DATA_MAP));
};
return &m_sDATA;
};
bool sensorBNO::getStatus( BNO_STATUS_MAP *tPtr ){
if( switchPage(0) ) {
if( m_pBus->readMZ( BNO_STATUS_OFFSET, (uint8_t *)tPtr, sizeof(BNO_STATUS_MAP))) {
return true;
};
};
return false;
};
bool sensorBNO::resetInterupts(){
if( m_pBus != NULL ) {
uint8_t tVal;
tVal = 0x40;
if( m_pBus->writeMZ( BNO_SYS_TRIG_OFFSET, (uint8_t *)&tVal, 1 ) ){
SLEEP( 30 );
return true;
};
};
return false;
};
bool sensorBNO::resetSystem(){
if( m_pBus != NULL ) {
uint8_t tVal;
tVal = 0x20;
if( m_pBus->writeMZ( BNO_SYS_TRIG_OFFSET, (uint8_t *)&tVal, 1 ) ){
SLEEP( 30 );
return true;
};
};
return false;
};
bool sensorBNO::startBIST(){
if( m_pBus != NULL ) {
uint8_t tVal;
tVal = 0x01;
if( m_pBus->writeMZ( BNO_SYS_TRIG_OFFSET, (uint8_t *)&tVal, 1 ) ){
SLEEP( 30 );
return true;
};
};
return false;
};
bool sensorBNO::setConfigPage0( BNO_CONFIG0_MAP *tPtr ){
if( switchPage(0) ) {
if( m_pBus->writeMZ( BNO_CONFIG0_OFFSET, (uint8_t *)tPtr, sizeof(BNO_CONFIG0_MAP))) {
return true;
};
};
return false;
};
bool sensorBNO::getConfigPage0( BNO_CONFIG0_MAP *tPtr ){
if( switchPage(0) ) {
if( m_pBus->readMZ( BNO_CONFIG0_OFFSET, (uint8_t *)tPtr, sizeof(BNO_CONFIG0_MAP))) {
return true;
};
};
return false;
};
bool sensorBNO::getConfigPage1( BNO_CONFIG1_MAP *tPtr ){
if( switchPage(1) ) {
if( m_pBus->readMZ( BNO_CONFIG1_OFFSET, (uint8_t *)tPtr, sizeof(BNO_CONFIG1_MAP))) {
return true;
};
};
return false;
};
bool sensorBNO::switchPage( uint8_t PageID ){
if( m_pBus!= NULL ){
if( m_sID.PAGE_ID != PageID ) {
if( m_pBus->readMZ( BNO_ID_OFFSET, (uint8_t *)&m_sID, sizeof(BNO_ID_MAP))) {
if( m_sID.PAGE_ID == PageID ) return true;
m_sID.PAGE_ID = PageID;
if( m_pBus->writeMZ( BNO_ID_OFFSET, (uint8_t *)&m_sID, sizeof(BNO_ID_MAP)) ) {
return true;
};
};
} else return true;
};
return false;
};
bool sensorBNO::isDead(){
if( m_pBus!= NULL ){
uint8_t id;
id = m_pBus->read8( BNO055_CHIP_ID_ADDR );
if( id == BNO055_ID ){
return false;
};
};
return true;
};
#undef LOG
#undef LOG_ERROR

494
lib/hardware/sensors/9dof/BNO055.h

@ -0,0 +1,494 @@
#ifndef __BNO_9DOF_SENSOR_HEADER__
#define __BNO_9DOF_SENSOR_HEADER__
#include "../../../components/base/basicSettingsProvider.h"
#include "../../../components/base/basicLogCollection.h"
#include "../../../components/object/objectPathfinderBinaryLog.h"
#include "../../../hardware/i2c/i2cPort.h"
#include "../../../pathfinder/pathfinderDBConnector.h"
typedef struct S_BNO_ID_MAP{
uint8_t CHIP_ID;
uint8_t ACC_ID;
uint8_t MAG_ID;
uint8_t GYR_ID;
uint16_t SW_REV_ID;
uint8_t BL_REV_ID;
uint8_t PAGE_ID;
}BNO_ID_MAP;
typedef struct S_bno055_rev_info_t {
uint8_t accel_rev; /**< acceleration rev */
uint8_t mag_rev; /**< magnetometer rev */
uint8_t gyro_rev; /**< gyroscrope rev */
uint16_t sw_rev; /**< SW rev */
uint8_t bl_rev; /**< bootloader rev */
} bno055_rev_info_t;
typedef struct S_BNO_CONFIG0_MAP{
uint8_t UNIT_SELECT;
uint8_t RSRVD_0;
uint8_t OP_MODE;
uint8_t PWR_MODE;
uint8_t SYS_TRIGG;
uint8_t TEMP_SRC;
uint8_t AXIS_MAP_CONF;
uint8_t AXIS_MAP_SIGN;
uint8_t RSRVD_1[12];
int16_t ACC_OFFSET_X;
int16_t ACC_OFFSET_Y;
int16_t ACC_OFFSET_Z;
int16_t MAG_OFFSET_X;
int16_t MAG_OFFSET_Y;
int16_t MAG_OFFSET_Z;
int16_t GYR_OFFSET_X;
int16_t GYR_OFFSET_Y;
int16_t GYR_OFFSET_Z;
uint16_t ACC_RADIUS;
uint16_t MAG_RADIUS;
}BNO_CONFIG0_MAP;
typedef struct S_BNO_CONFIG1_MAP{
uint8_t ACC_CONFIG;
uint8_t MAG_CONFIG;
uint8_t GYR_CONFIG_0;
uint8_t GYR_CONFIG_1;
uint8_t ACC_SLEEP_CFG;
uint8_t GYR_SLEEP_CFG;
uint8_t RSRVD_0;
uint8_t INT_MSK;
uint8_t INT_ENA;
uint8_t ACC_EM_THRESHOLD;
uint8_t ACC_INT_SETTINGS;
uint8_t ACC_HG_DURATION;
uint8_t ACC_HG_THRESHOLD;
uint8_t ACC_NM_THRESHOLD;
uint8_t ACC_NM_SETTINGS;
uint8_t GYR_INT_SETTINGS;
uint8_t GYR_HR_X_SETTINGS;
uint8_t GYR_DUR_X;
uint8_t GYR_HR_Y_SETTINGS;
uint8_t GYR_DUR_Y;
uint8_t GYR_HR_Z_SETTINGS;
uint8_t GYR_DUR_Z;
uint8_t GYR_AM_THRESHOLD;
uint8_t GYR_AM_SETTINGS;
uint8_t RSRVD_1[47];
uint8_t UNIQUE_ID[15];
}BNO_CONFIG1_MAP;
typedef struct S_BNO_DATA_MAP{
int16_t ACC_DATA_X;
int16_t ACC_DATA_Y;
int16_t ACC_DATA_Z;
int16_t MAG_DATA_X;
int16_t MAG_DATA_Y;
int16_t MAG_DATA_Z;
int16_t GYR_DATA_X;
int16_t GYR_DATA_Y;
int16_t GYR_DATA_Z;
int16_t EUL_YAW;
int16_t EUL_ROLL;
int16_t EUL_PITCH;
int16_t QUA_W;
int16_t QUA_X;
int16_t QUA_Y;
int16_t QUA_Z;
int16_t LIA_X;
int16_t LIA_Y;
int16_t LIA_Z;
int16_t GRV_X;
int16_t GRV_Y;
int16_t GRV_Z;
}BNO_DATA_MAP;
typedef struct S_BNO_STATUS_MAP{
uint8_t temper;
uint8_t cal_status;
uint8_t st_result;
uint8_t int_status;
uint8_t sys_clc_status;
uint8_t system_status;
uint8_t system_error;
}BNO_STATUS_MAP;
#define BNO_ID_OFFSET 0x0000
#define BNO_DATA_OFFSET 0x0008
#define BNO_STATUS_OFFSET 0x0034
#define BNO_SYS_TRIG_OFFSET 0x003F
#define BNO_CONFIG0_OFFSET 0x003B
#define BNO_CONFIG1_OFFSET 0x0008
/** BNO055 Address A **/
#define BNO055_ADDRESS_A (0x28)
/** BNO055 Address B **/
#define BNO055_ADDRESS_B (0x29)
/** BNO055 ID **/
#define BNO055_ID (0xA0)
/** Offsets registers **/
#define NUM_BNO055_OFFSET_REGISTERS (22)
/* Page id register definition */
#define BNO055_PAGE_ID_ADDR 0X07
/* PAGE0 REGISTER DEFINITION START*/
#define BNO055_CHIP_ID_ADDR 0x00
#define BNO055_ACCEL_REV_ID_ADDR 0x01
#define BNO055_MAG_REV_ID_ADDR 0x02
#define BNO055_GYRO_REV_ID_ADDR 0x03
#define BNO055_SW_REV_ID_LSB_ADDR 0x04
#define BNO055_SW_REV_ID_MSB_ADDR 0x05
#define BNO055_BL_REV_ID_ADDR 0X06
/* Accel data register */
#define BNO055_ACCEL_DATA_X_LSB_ADDR 0X08
#define BNO055_ACCEL_DATA_X_MSB_ADDR 0X09
#define BNO055_ACCEL_DATA_Y_LSB_ADDR 0X0A
#define BNO055_ACCEL_DATA_Y_MSB_ADDR 0X0B
#define BNO055_ACCEL_DATA_Z_LSB_ADDR 0X0C
#define BNO055_ACCEL_DATA_Z_MSB_ADDR 0X0D
/* Mag data register */
#define BNO055_MAG_DATA_X_LSB_ADDR 0X0E
#define BNO055_MAG_DATA_X_MSB_ADDR 0X0F
#define BNO055_MAG_DATA_Y_LSB_ADDR 0X10
#define BNO055_MAG_DATA_Y_MSB_ADDR 0X11
#define BNO055_MAG_DATA_Z_LSB_ADDR 0X12
#define BNO055_MAG_DATA_Z_MSB_ADDR 0X13
/* Gyro data registers */
#define BNO055_GYRO_DATA_X_LSB_ADDR 0X14
#define BNO055_GYRO_DATA_X_MSB_ADDR 0X15
#define BNO055_GYRO_DATA_Y_LSB_ADDR 0X16
#define BNO055_GYRO_DATA_Y_MSB_ADDR 0X17
#define BNO055_GYRO_DATA_Z_LSB_ADDR 0X18
#define BNO055_GYRO_DATA_Z_MSB_ADDR 0X19
/* Euler data registers */
#define BNO055_EULER_H_LSB_ADDR 0X1A
#define BNO055_EULER_H_MSB_ADDR 0X1B
#define BNO055_EULER_R_LSB_ADDR 0X1C
#define BNO055_EULER_R_MSB_ADDR 0X1D
#define BNO055_EULER_P_LSB_ADDR 0X1E
#define BNO055_EULER_P_MSB_ADDR 0X1F
/* Quaternion data registers */
#define BNO055_QUATERNION_DATA_W_LSB_ADDR 0X20
#define BNO055_QUATERNION_DATA_W_MSB_ADDR 0X21
#define BNO055_QUATERNION_DATA_X_LSB_ADDR 0X22
#define BNO055_QUATERNION_DATA_X_MSB_ADDR 0X23
#define BNO055_QUATERNION_DATA_Y_LSB_ADDR 0X24
#define BNO055_QUATERNION_DATA_Y_MSB_ADDR 0X25
#define BNO055_QUATERNION_DATA_Z_LSB_ADDR 0X26
#define BNO055_QUATERNION_DATA_Z_MSB_ADDR 0X27
/* Linear acceleration data registers */
#define BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR 0X28
#define BNO055_LINEAR_ACCEL_DATA_X_MSB_ADDR 0X29
#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_ADDR 0X2A
#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_ADDR 0X2B
#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_ADDR 0X2C
#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_ADDR 0X2D
/* Gravity data registers */
#define BNO055_GRAVITY_DATA_X_LSB_ADDR 0X2E
#define BNO055_GRAVITY_DATA_X_MSB_ADDR 0X2F
#define BNO055_GRAVITY_DATA_Y_LSB_ADDR 0X30
#define BNO055_GRAVITY_DATA_Y_MSB_ADDR 0X31
#define BNO055_GRAVITY_DATA_Z_LSB_ADDR 0X32
#define BNO055_GRAVITY_DATA_Z_MSB_ADDR 0X33
/* Temperature data register */
#define BNO055_TEMP_ADDR 0X34
/* Status registers */
#define BNO055_CALIB_STAT_ADDR 0X35
#define BNO055_SELFTEST_RESULT_ADDR 0X36
#define BNO055_INTR_STAT_ADDR 0X37
#define BNO055_SYS_CLK_STAT_ADDR 0X38
#define BNO055_SYS_STAT_ADDR 0X39
#define BNO055_SYS_ERR_ADDR 0X3A
/* Unit selection register */
#define BNO055_UNIT_SEL_ADDR 0X3B
#define BNO055_DATA_SELECT_ADDR 0X3C
/* Mode registers */
#define BNO055_OPR_MODE_ADDR 0X3D
#define BNO055_PWR_MODE_ADDR 0X3E
#define BNO055_SYS_TRIGGER_ADDR 0X3F
#define BNO055_TEMP_SOURCE_ADDR 0X40
/* Axis remap registers */
#define BNO055_AXIS_MAP_CONFIG_ADDR 0X41
#define BNO055_AXIS_MAP_SIGN_ADDR 0X42
/* SIC registers */
#define BNO055_SIC_MATRIX_0_LSB_ADDR 0X43
#define BNO055_SIC_MATRIX_0_MSB_ADDR 0X44
#define BNO055_SIC_MATRIX_1_LSB_ADDR 0X45
#define BNO055_SIC_MATRIX_1_MSB_ADDR 0X46
#define BNO055_SIC_MATRIX_2_LSB_ADDR 0X47
#define BNO055_SIC_MATRIX_2_MSB_ADDR 0X48
#define BNO055_SIC_MATRIX_3_LSB_ADDR 0X49
#define BNO055_SIC_MATRIX_3_MSB_ADDR 0X4A
#define BNO055_SIC_MATRIX_4_LSB_ADDR 0X4B
#define BNO055_SIC_MATRIX_4_MSB_ADDR 0X4C
#define BNO055_SIC_MATRIX_5_LSB_ADDR 0X4D
#define BNO055_SIC_MATRIX_5_MSB_ADDR 0X4E
#define BNO055_SIC_MATRIX_6_LSB_ADDR 0X4F
#define BNO055_SIC_MATRIX_6_MSB_ADDR 0X50
#define BNO055_SIC_MATRIX_7_LSB_ADDR 0X51
#define BNO055_SIC_MATRIX_7_MSB_ADDR 0X52
#define BNO055_SIC_MATRIX_8_LSB_ADDR 0X53
#define BNO055_SIC_MATRIX_8_MSB_ADDR 0X54
/* Accelerometer Offset registers */
#define ACCEL_OFFSET_X_LSB_ADDR 0X55
#define ACCEL_OFFSET_X_MSB_ADDR 0X56
#define ACCEL_OFFSET_Y_LSB_ADDR 0X57
#define ACCEL_OFFSET_Y_MSB_ADDR 0X58
#define ACCEL_OFFSET_Z_LSB_ADDR 0X59
#define ACCEL_OFFSET_Z_MSB_ADDR 0X5A
/* Magnetometer Offset registers */
#define MAG_OFFSET_X_LSB_ADDR 0X5B
#define MAG_OFFSET_X_MSB_ADDR 0X5C
#define MAG_OFFSET_Y_LSB_ADDR 0X5D
#define MAG_OFFSET_Y_MSB_ADDR 0X5E
#define MAG_OFFSET_Z_LSB_ADDR 0X5F
#define MAG_OFFSET_Z_MSB_ADDR 0X60
/* Gyroscope Offset register s*/
#define GYRO_OFFSET_X_LSB_ADDR 0X61
#define GYRO_OFFSET_X_MSB_ADDR 0X62
#define GYRO_OFFSET_Y_LSB_ADDR 0X63
#define GYRO_OFFSET_Y_MSB_ADDR 0X64
#define GYRO_OFFSET_Z_LSB_ADDR 0X65
#define GYRO_OFFSET_Z_MSB_ADDR 0X66
/* Radius registers */
#define ACCEL_RADIUS_LSB_ADDR 0X67
#define ACCEL_RADIUS_MSB_ADDR 0X68
#define MAG_RADIUS_LSB_ADDR 0X69
#define MAG_RADIUS_MSB_ADDR 0X6A
#define VECTOR_ACCELEROMETER BNO055_ACCEL_DATA_X_LSB_ADDR
#define VECTOR_MAGNETOMETER BNO055_MAG_DATA_X_LSB_ADDR
#define VECTOR_GYROSCOPE BNO055_GYRO_DATA_X_LSB_ADDR
#define VECTOR_EULER BNO055_EULER_H_LSB_ADDR
#define VECTOR_LINEARACCEL BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR
#define VECTOR_GRAVITY BNO055_GRAVITY_DATA_X_LSB_ADDR
typedef enum E_BNO_WMODE : uint8_t{
BNO_WM_CONFIG = 0,
BNO_WM_ACC_ONLY = 1,
BNO_WM_MAG_ONLY = 2,
BNO_WM_GYR_ONLY = 3,
BNO_WM_ACC_MAG = 4,
BNO_WM_ACC_GYR = 5,
BNO_WM_MAG_GYR = 6,
BNO_WM_AMG_NO_FUSION = 7,
/* Fusion Modes */
BNO_WM_IMU = 8,
BNO_WM_COMPAS = 9,
BNO_WM_M4G = 10,
BNO_WM_NDOF_FMC_OFF = 11,
BNO_WM_NDOF = 12
} BNO_WMODE;
#define BNO_WMODE_MASK 0x0F
typedef enum E_BNO_PMODE : uint8_t{
BNO_PM_NORMAL = 0,
BNO_PM_LOW_POWER = 1,
BNO_PN_SUSPEND = 2
} BNO_PMODE;
#define BNO_PMODE_MASK 0x03
typedef enum E_BNO_AXIS_MAP : uint8_t{
BNO_AXIS_X = 0,
BNO_AXIS_Y = 1,
BNO_AXIS_Z = 2,
BNO_AXIS_INVALID = 3
} BNO_AXIS_MAP;
typedef enum E_BNO_ACC_RANGE : uint8_t{
BNO_ACC_2G = 0,
BNO_ACC_4G = 1,
BNO_ACC_8G = 2,
BNO_ACC_16G = 3
} BNO_ACC_RANGE;
#define BNO_ACC_RANGE_MASK 0x03
typedef enum E_BNO_ACC_BANDWIDTH : uint8_t{
BNO_ACC_7_81HZ = 0,
BNO_ACC_15_36HZ = 4,
BNO_ACC_31_25HZ = 8,
BNO_ACC_62_50HZ = 12,
BNO_ACC_125HZ = 16,
BNO_ACC_250HZ = 20,
BNO_ACC_500HZ = 24,
BNO_ACC_1000HZ = 28
} BNO_ACC_BANDWIDTH;
#define BNO_ACC_BANDWIDTH_MASK 0x1C
typedef enum E_BNO_ACC_WMODE : uint8_t{
BNO_ACC_NORMAL = 0,
BNO_ACC_SUSPEND = 32,
BNO_ACC_LP1 = 64,
BNO_ACC_STANDBY = 96,
BNO_ACC_LP2 = 128,
BNO_ACC_DEEP_SUSPEND = 160
} BNO_ACC_WMODE;
#define BNO_ACC_WMODE_MASK 0xE0
typedef enum E_BNO_GYR_RANGE : uint8_t{
BNO_GYR_2000_DPS = 0,
BNO_GYR_1000_DPS = 1,
BNO_GYR_500_DPS = 2,
BNO_GYR_250_DPS = 3,
BNO_GYR_125_DPS = 4
}BNO_GYR_RANGE;
#define BNO_GYR_RANGE_MASK 0x07
typedef enum E_BNO_GYR_BANDWIDTH : uint8_t{
BNO_GYR_523HZ = 0,
BNO_GYR_230HZ = 8,
BNO_GYR_116HZ = 16,
BNO_GYR_47HZ = 24,
BNO_GYR_23HZ = 32,
BNO_GYR_12HZ = 40,
BNO_GYR_64HZ = 48,
BNO_GYR_32HZ = 56
}BNO_GYR_BANDWIDTH;
#define BNO_GYR_BANDWIDTH_MASK 0x38
typedef enum E_BNO_GYR_WMODE : uint8_t{
BNO_GYR_NORMAL = 0,
BNO_GYR_FAST_POWER_UP = 1,
BNO_GYR_DEEP_SUSPEND = 2,
BNO_GYR_SUSPEND = 3,
BNO_GYR_ADVANCED_PS = 4
}BNO_GYR_WMODE;
#define BNO_GYR_WMODE_MASK 0x07
typedef enum E_BNO_MAG_RATE : uint8_t{
BNO_MAG_2HZ = 0,
BNO_MAG_6HZ = 1,
BNO_MAG_8HZ = 2,
BNO_MAG_10HZ = 3,
BNO_MAG_15HZ = 4,
BNO_MAG_20HZ = 5,
BNO_MAG_25HZ = 6,
BNO_MAG_30HZ = 7
}BNO_MAG_RATE;
#define BNO_MAG_RATE_MASK 0x07
typedef enum E_BNO_MAG_WMODE : uint8_t{
BNO_MAG_LOW_POWER = 0,
BNO_MAG_REGULAR = 8,
BNO_MAG_E_REGULAR = 16,
BNO_MAG_HIGH_ACURACY = 24
}BNO_MAG_WMODE;
#define BNO_MAG_WMODE_MASK 0x18
typedef enum E_BNO_MAG_PMODE : uint8_t{
BNO_MAG_NORMAL = 0,
BNO_MAG_SLEEP = 32,
BNO_MAG_SUSPEND = 64,
BNO_MAG_FORCE_MODE = 96
}BNO_MAG_PMODE;
#define BNO_MAG_PMODE_MASK 0x60
typedef enum E_BNO_FUSION_DATA_OUTPUT_FORMAT : uint8_t{
BNO_FUSION_DO_WINDOWS = 0,
BNO_FUSION_DO_ANDROID = 128
}BNO_FUSION_DATA_OUTPUT_FORMAT;
#define BNO_AXIS_POSITIVE 0
#define BNO_AXIS_NEGATIVE 1
#define BNO_TAG_WORK_MODE "WORK_MODE"
#define BNO_TAG_POWER_MODE "POWER_MODE"
#define BNO_TAG_AXIS_MAP_X "MAP_TO_X"
#define BNO_TAG_AXIS_MAP_Y "MAP_TO_Y"
#define BNO_TAG_AXIS_MAP_Z "MAP_TO_Z"
class sensorBNO: public basicThread {
private:
basicLogCollection * m_pLog;
config_setting_t * m_pSettings;
i2cPort * m_pBus;
PATHFINDER_DBC * m_pDBC;
BNO_SETTINGS m_sSettings;
objectPathfinderBinaryLog * m_pBLOG;
CSTR m_pDevicePath;
uint8_t m_bDeviceAddress;
uint32_t m_nSampleDelay;
// internal config vars
uint8_t m_ePowerMode;
uint8_t m_bTargetWM;
uint8_t m_bActualWM;
uint8_t m_eAccRange;
uint8_t m_eAccBandwidth;
uint8_t m_eAccWorkMode;
uint8_t m_eGyrRange;
uint8_t m_eGyrBandwidth;
uint8_t m_eGyrWorkMode;
uint8_t m_eMagRate;
uint8_t m_eMagWorkMode;
uint8_t m_eMagPowerMode;
BNO_CONFIG0_MAP m_sCONFIG0;
BNO_CONFIG1_MAP m_sCONFIG1;
BNO_STATUS_MAP m_sSTATUS;
BNO_ID_MAP m_sID;
BNO_DATA_MAP m_sDATA;
bool getConfigPage0( BNO_CONFIG0_MAP *tPtr );
bool getConfigPage1( BNO_CONFIG1_MAP *tPtr );
bool getStatus( BNO_STATUS_MAP *tPtr );
void logConfig();
bool resetInterupts();
bool resetSystem();
bool startBIST();
bool setConfigPage0( BNO_CONFIG0_MAP *tPtr );
uint8_t getMode();
bool switchPage( uint8_t PageID );
bool setExtCrystalUse(bool);
bool getSystemStatus(uint8_t*, uint8_t*, uint8_t*);
bool getRevInfo(bno055_rev_info_t*);
bool getCalibration(uint8_t*, uint8_t*, uint8_t*, uint8_t*);
int8_t getTemp();
bool isFullyCalibrated();
/* Power managments functions */
bool enterSuspendMode();
bool enterNormalMode();
bool getVector( uint16_t vector_type, BNO_3D_VECTOR *xyz );
bool getQuat( BNO_Quat *quat );
BNO_EVTREC * getEVT_REC();
bool setMode( uint8_t mode );
private:
void m_fThreadProc( void );
public:
explicit sensorBNO( config_setting_t *Settings = NULL, PATHFINDER_DBC *DBC = NULL );
~sensorBNO();
bool create();
bool validate();
bool isDead();
BNO_DATA_MAP * getData();
bool updateSettings();
//void setWM( BNO_WMODE Mode );
};
#endif

19255
lib/hardware/sensors/9dof/bno055.c
File diff suppressed because it is too large
View File

8138
lib/hardware/sensors/9dof/bno055_.h
File diff suppressed because it is too large
View File

643
lib/hardware/sensors/9dof/bno055_support.c

@ -0,0 +1,643 @@
/**
* Copyright (c) 2020 Bosch Sensortec GmbH. All rights reserved.
*
* BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @file bno055_support.c
* @date 10/01/2020
* @version 2.0.6
*
*/
/*---------------------------------------------------------------------------*
* Includes
*---------------------------------------------------------------------------*/
#include "bno055.h"
/*----------------------------------------------------------------------------*
* The following APIs are used for reading and writing of
* sensor data using I2C communication
*----------------------------------------------------------------------------*/
#ifdef BNO055_API
#define BNO055_I2C_BUS_WRITE_ARRAY_INDEX ((u8)1)
/* \Brief: The API is used as I2C bus read
* \Return : Status of the I2C read
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be read
* \param reg_data : This data read from the sensor,
* which is hold in an array
* \param cnt : The no of byte of data to be read
*/
s8 BNO055_I2C_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt);
/* \Brief: The API is used as SPI bus write
* \Return : Status of the SPI write
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be written
* \param reg_data : It is a value hold in the array,
* will be used for write the value into the register
* \param cnt : The no of byte of data to be write
*/
s8 BNO055_I2C_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt);
/*
* \Brief: I2C init routine
*/
s8 I2C_routine(void);
/* Brief : The delay routine
* \param : delay in ms
*/
void BNO055_delay_msek(u32 msek);
#endif
/********************End of I2C APIs declarations***********************/
/* This API is an example for reading sensor data
* \param: None
* \return: communication result
*/
s32 bno055_data_readout_template(void);
/*----------------------------------------------------------------------------*
* struct bno055_t parameters can be accessed by using BNO055
* BNO055_t having the following parameters
* Bus write function pointer: BNO055_WR_FUNC_PTR
* Bus read function pointer: BNO055_RD_FUNC_PTR
* Burst read function pointer: BNO055_BRD_FUNC_PTR
* Delay function pointer: delay_msec
* I2C address: dev_addr
* Chip id of the sensor: chip_id
*---------------------------------------------------------------------------*/
struct bno055_t bno055;
/* This API is an example for reading sensor data
* \param: None
* \return: communication result
*/
s32 bno055_data_readout_template(void)
{
/* Variable used to return value of
* communication routine*/
s32 comres = BNO055_ERROR;
/* variable used to set the power mode of the sensor*/
u8 power_mode = BNO055_INIT_VALUE;
/*********read raw accel data***********/
/* variable used to read the accel x data */
s16 accel_datax = BNO055_INIT_VALUE;
/* variable used to read the accel y data */
s16 accel_datay = BNO055_INIT_VALUE;
/* variable used to read the accel z data */
s16 accel_dataz = BNO055_INIT_VALUE;
/* variable used to read the accel xyz data */
struct bno055_accel_t accel_xyz;
/*********read raw mag data***********/
/* variable used to read the mag x data */
s16 mag_datax = BNO055_INIT_VALUE;
/* variable used to read the mag y data */
s16 mag_datay = BNO055_INIT_VALUE;
/* variable used to read the mag z data */
s16 mag_dataz = BNO055_INIT_VALUE;
/* structure used to read the mag xyz data */
struct bno055_mag_t mag_xyz;
/***********read raw gyro data***********/
/* variable used to read the gyro x data */
s16 gyro_datax = BNO055_INIT_VALUE;
/* variable used to read the gyro y data */
s16 gyro_datay = BNO055_INIT_VALUE;
/* variable used to read the gyro z data */
s16 gyro_dataz = BNO055_INIT_VALUE;
/* structure used to read the gyro xyz data */
struct bno055_gyro_t gyro_xyz;
/*************read raw Euler data************/
/* variable used to read the euler h data */
s16 euler_data_h = BNO055_INIT_VALUE;
/* variable used to read the euler r data */
s16 euler_data_r = BNO055_INIT_VALUE;
/* variable used to read the euler p data */
s16 euler_data_p = BNO055_INIT_VALUE;
/* structure used to read the euler hrp data */
struct bno055_euler_t euler_hrp;
/************read raw quaternion data**************/
/* variable used to read the quaternion w data */
s16 quaternion_data_w = BNO055_INIT_VALUE;
/* variable used to read the quaternion x data */
s16 quaternion_data_x = BNO055_INIT_VALUE;
/* variable used to read the quaternion y data */
s16 quaternion_data_y = BNO055_INIT_VALUE;
/* variable used to read the quaternion z data */
s16 quaternion_data_z = BNO055_INIT_VALUE;
/* structure used to read the quaternion wxyz data */
struct bno055_quaternion_t quaternion_wxyz;
/************read raw linear acceleration data***********/
/* variable used to read the linear accel x data */
s16 linear_accel_data_x = BNO055_INIT_VALUE;
/* variable used to read the linear accel y data */
s16 linear_accel_data_y = BNO055_INIT_VALUE;
/* variable used to read the linear accel z data */
s16 linear_accel_data_z = BNO055_INIT_VALUE;
/* structure used to read the linear accel xyz data */
struct bno055_linear_accel_t linear_acce_xyz;
/*****************read raw gravity sensor data****************/
/* variable used to read the gravity x data */
s16 gravity_data_x = BNO055_INIT_VALUE;
/* variable used to read the gravity y data */
s16 gravity_data_y = BNO055_INIT_VALUE;
/* variable used to read the gravity z data */
s16 gravity_data_z = BNO055_INIT_VALUE;
/* structure used to read the gravity xyz data */
struct bno055_gravity_t gravity_xyz;
/*************read accel converted data***************/
/* variable used to read the accel x data output as m/s2 or mg */
double d_accel_datax = BNO055_INIT_VALUE;
/* variable used to read the accel y data output as m/s2 or mg */
double d_accel_datay = BNO055_INIT_VALUE;
/* variable used to read the accel z data output as m/s2 or mg */
double d_accel_dataz = BNO055_INIT_VALUE;
/* structure used to read the accel xyz data output as m/s2 or mg */
struct bno055_accel_double_t d_accel_xyz;
/******************read mag converted data********************/
/* variable used to read the mag x data output as uT*/
double d_mag_datax = BNO055_INIT_VALUE;
/* variable used to read the mag y data output as uT*/
double d_mag_datay = BNO055_INIT_VALUE;
/* variable used to read the mag z data output as uT*/
double d_mag_dataz = BNO055_INIT_VALUE;
/* structure used to read the mag xyz data output as uT*/
struct bno055_mag_double_t d_mag_xyz;
/*****************read gyro converted data************************/
/* variable used to read the gyro x data output as dps or rps */
double d_gyro_datax = BNO055_INIT_VALUE;
/* variable used to read the gyro y data output as dps or rps */
double d_gyro_datay = BNO055_INIT_VALUE;
/* variable used to read the gyro z data output as dps or rps */
double d_gyro_dataz = BNO055_INIT_VALUE;
/* structure used to read the gyro xyz data output as dps or rps */
struct bno055_gyro_double_t d_gyro_xyz;
/*******************read euler converted data*******************/
/* variable used to read the euler h data output
* as degree or radians*/
double d_euler_data_h = BNO055_INIT_VALUE;
/* variable used to read the euler r data output
* as degree or radians*/
double d_euler_data_r = BNO055_INIT_VALUE;
/* variable used to read the euler p data output
* as degree or radians*/
double d_euler_data_p = BNO055_INIT_VALUE;
/* structure used to read the euler hrp data output
* as as degree or radians */
struct bno055_euler_double_t d_euler_hpr;
/*********read linear acceleration converted data**********/
/* variable used to read the linear accel x data output as m/s2*/
double d_linear_accel_datax = BNO055_INIT_VALUE;
/* variable used to read the linear accel y data output as m/s2*/
double d_linear_accel_datay = BNO055_INIT_VALUE;
/* variable used to read the linear accel z data output as m/s2*/
double d_linear_accel_dataz = BNO055_INIT_VALUE;
/* structure used to read the linear accel xyz data output as m/s2*/
struct bno055_linear_accel_double_t d_linear_accel_xyz;
/********************Gravity converted data**********************/
/* variable used to read the gravity sensor x data output as m/s2*/
double d_gravity_data_x = BNO055_INIT_VALUE;
/* variable used to read the gravity sensor y data output as m/s2*/
double d_gravity_data_y = BNO055_INIT_VALUE;
/* variable used to read the gravity sensor z data output as m/s2*/
double d_gravity_data_z = BNO055_INIT_VALUE;
/* structure used to read the gravity xyz data output as m/s2*/
struct bno055_gravity_double_t d_gravity_xyz;
/*---------------------------------------------------------------------------*
*********************** START INITIALIZATION ************************
*--------------------------------------------------------------------------*/
#ifdef BNO055_API
/* Based on the user need configure I2C interface.
* It is example code to explain how to use the bno055 API*/
I2C_routine();
#endif
/*--------------------------------------------------------------------------*
* This API used to assign the value/reference of
* the following parameters
* I2C address
* Bus Write
* Bus read
* Chip id
* Page id
* Accel revision id
* Mag revision id
* Gyro revision id
* Boot loader revision id
* Software revision id
*-------------------------------------------------------------------------*/
comres = bno055_init(&bno055);
/* For initializing the BNO sensor it is required to the operation mode
* of the sensor as NORMAL
* Normal mode can set from the register
* Page - page0
* register - 0x3E
* bit positions - 0 and 1*/
power_mode = BNO055_POWER_MODE_NORMAL;
/* set the power mode as NORMAL*/
comres += bno055_set_power_mode(power_mode);
/*----------------------------------------------------------------*
************************* END INITIALIZATION *************************
*-----------------------------------------------------------------*/
/************************* START READ RAW SENSOR DATA****************/
/* Using BNO055 sensor we can read the following sensor data and
* virtual sensor data
* Sensor data:
* Accel
* Mag
* Gyro
* Virtual sensor data
* Euler
* Quaternion
* Linear acceleration
* Gravity sensor */
/* For reading sensor raw data it is required to set the
* operation modes of the sensor
* operation mode can set from the register
* page - page0
* register - 0x3D
* bit - 0 to 3
* for sensor data read following operation mode have to set
* SENSOR MODE
* 0x01 - BNO055_OPERATION_MODE_ACCONLY
* 0x02 - BNO055_OPERATION_MODE_MAGONLY
* 0x03 - BNO055_OPERATION_MODE_GYRONLY
* 0x04 - BNO055_OPERATION_MODE_ACCMAG
* 0x05 - BNO055_OPERATION_MODE_ACCGYRO
* 0x06 - BNO055_OPERATION_MODE_MAGGYRO
* 0x07 - BNO055_OPERATION_MODE_AMG
* based on the user need configure the operation mode*/
comres += bno055_set_operation_mode(BNO055_OPERATION_MODE_AMG);
/* Raw accel X, Y and Z data can read from the register
* page - page 0
* register - 0x08 to 0x0D*/
comres += bno055_read_accel_x(&accel_datax);
comres += bno055_read_accel_y(&accel_datay);
comres += bno055_read_accel_z(&accel_dataz);
comres += bno055_read_accel_xyz(&accel_xyz);
/* Raw mag X, Y and Z data can read from the register
* page - page 0
* register - 0x0E to 0x13*/
comres += bno055_read_mag_x(&mag_datax);
comres += bno055_read_mag_y(&mag_datay);
comres += bno055_read_mag_z(&mag_dataz);
comres += bno055_read_mag_xyz(&mag_xyz);
/* Raw gyro X, Y and Z data can read from the register
* page - page 0
* register - 0x14 to 0x19*/
comres += bno055_read_gyro_x(&gyro_datax);
comres += bno055_read_gyro_y(&gyro_datay);
comres += bno055_read_gyro_z(&gyro_dataz);
comres += bno055_read_gyro_xyz(&gyro_xyz);
/************************* END READ RAW SENSOR DATA****************/
/************************* START READ RAW FUSION DATA ********
* For reading fusion data it is required to set the
* operation modes of the sensor
* operation mode can set from the register
* page - page0
* register - 0x3D
* bit - 0 to 3
* for sensor data read following operation mode have to set
* FUSION MODE
* 0x08 - BNO055_OPERATION_MODE_IMUPLUS
* 0x09 - BNO055_OPERATION_MODE_COMPASS
* 0x0A - BNO055_OPERATION_MODE_M4G
* 0x0B - BNO055_OPERATION_MODE_NDOF_FMC_OFF
* 0x0C - BNO055_OPERATION_MODE_NDOF
* based on the user need configure the operation mode*/
comres += bno055_set_operation_mode(BNO055_OPERATION_MODE_NDOF);
/* Raw Euler H, R and P data can read from the register
* page - page 0
* register - 0x1A to 0x1E */
comres += bno055_read_euler_h(&euler_data_h);
comres += bno055_read_euler_r(&euler_data_r);
comres += bno055_read_euler_p(&euler_data_p);
comres += bno055_read_euler_hrp(&euler_hrp);
/* Raw Quaternion W, X, Y and Z data can read from the register
* page - page 0
* register - 0x20 to 0x27 */
comres += bno055_read_quaternion_w(&quaternion_data_w);
comres += bno055_read_quaternion_x(&quaternion_data_x);
comres += bno055_read_quaternion_y(&quaternion_data_y);
comres += bno055_read_quaternion_z(&quaternion_data_z);
comres += bno055_read_quaternion_wxyz(&quaternion_wxyz);
/* Raw Linear accel X, Y and Z data can read from the register
* page - page 0
* register - 0x28 to 0x2D */
comres += bno055_read_linear_accel_x(&linear_accel_data_x);
comres += bno055_read_linear_accel_y(&linear_accel_data_y);
comres += bno055_read_linear_accel_z(&linear_accel_data_z);
comres += bno055_read_linear_accel_xyz(&linear_acce_xyz);
/* Raw Gravity sensor X, Y and Z data can read from the register
* page - page 0
* register - 0x2E to 0x33 */
comres += bno055_read_gravity_x(&gravity_data_x);
comres += bno055_read_gravity_y(&gravity_data_y);
comres += bno055_read_gravity_z(&gravity_data_z);
comres += bno055_read_gravity_xyz(&gravity_xyz);
/************************* END READ RAW FUSION DATA ************/
/******************START READ CONVERTED SENSOR DATA****************/
/* API used to read accel data output as double - m/s2 and mg
* float functions also available in the BNO055 API */
comres += bno055_convert_double_accel_x_msq(&d_accel_datax);
comres += bno055_convert_double_accel_x_mg(&d_accel_datax);
comres += bno055_convert_double_accel_y_msq(&d_accel_datay);
comres += bno055_convert_double_accel_y_mg(&d_accel_datay);
comres += bno055_convert_double_accel_z_msq(&d_accel_dataz);
comres += bno055_convert_double_accel_z_mg(&d_accel_dataz);
comres += bno055_convert_double_accel_xyz_msq(&d_accel_xyz);
comres += bno055_convert_double_accel_xyz_mg(&d_accel_xyz);
/* API used to read mag data output as double - uT(micro Tesla)
* float functions also available in the BNO055 API */
comres += bno055_convert_double_mag_x_uT(&d_mag_datax);
comres += bno055_convert_double_mag_y_uT(&d_mag_datay);
comres += bno055_convert_double_mag_z_uT(&d_mag_dataz);
comres += bno055_convert_double_mag_xyz_uT(&d_mag_xyz);
/* API used to read gyro data output as double - dps and rps
* float functions also available in the BNO055 API */
comres += bno055_convert_double_gyro_x_dps(&d_gyro_datax);
comres += bno055_convert_double_gyro_y_dps(&d_gyro_datay);
comres += bno055_convert_double_gyro_z_dps(&d_gyro_dataz);
comres += bno055_convert_double_gyro_x_rps(&d_gyro_datax);
comres += bno055_convert_double_gyro_y_rps(&d_gyro_datay);
comres += bno055_convert_double_gyro_z_rps(&d_gyro_dataz);
comres += bno055_convert_double_gyro_xyz_dps(&d_gyro_xyz);
comres += bno055_convert_double_gyro_xyz_rps(&d_gyro_xyz);
/* API used to read Euler data output as double - degree and radians
* float functions also available in the BNO055 API */
comres += bno055_convert_double_euler_h_deg(&d_euler_data_h);
comres += bno055_convert_double_euler_r_deg(&d_euler_data_r);
comres += bno055_convert_double_euler_p_deg(&d_euler_data_p);
comres += bno055_convert_double_euler_h_rad(&d_euler_data_h);
comres += bno055_convert_double_euler_r_rad(&d_euler_data_r);
comres += bno055_convert_double_euler_p_rad(&d_euler_data_p);
comres += bno055_convert_double_euler_hpr_deg(&d_euler_hpr);
comres += bno055_convert_double_euler_hpr_rad(&d_euler_hpr);
/* API used to read Linear acceleration data output as m/s2
* float functions also available in the BNO055 API */
comres += bno055_convert_double_linear_accel_x_msq(&d_linear_accel_datax);
comres += bno055_convert_double_linear_accel_y_msq(&d_linear_accel_datay);
comres += bno055_convert_double_linear_accel_z_msq(&d_linear_accel_dataz);
comres += bno055_convert_double_linear_accel_xyz_msq(&d_linear_accel_xyz);
/* API used to read Gravity sensor data output as m/s2
* float functions also available in the BNO055 API */
comres += bno055_convert_gravity_double_x_msq(&d_gravity_data_x);
comres += bno055_convert_gravity_double_y_msq(&d_gravity_data_y);
comres += bno055_convert_gravity_double_z_msq(&d_gravity_data_z);
comres += bno055_convert_double_gravity_xyz_msq(&d_gravity_xyz);
/*-----------------------------------------------------------------------*
************************* START DE-INITIALIZATION ***********************
*-------------------------------------------------------------------------*/
/* For de - initializing the BNO sensor it is required
* to the operation mode of the sensor as SUSPEND
* Suspend mode can set from the register
* Page - page0
* register - 0x3E
* bit positions - 0 and 1*/
power_mode = BNO055_POWER_MODE_SUSPEND;
/* set the power mode as SUSPEND*/
comres += bno055_set_power_mode(power_mode);
/*---------------------------------------------------------------------*
************************* END DE-INITIALIZATION **********************
*---------------------------------------------------------------------*/
return comres;
}
#ifdef BNO055_API
/*--------------------------------------------------------------------------*
* The following API is used to map the I2C bus read, write, delay and
* device address with global structure bno055_t
*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*
* By using bno055 the following structure parameter can be accessed
* Bus write function pointer: BNO055_WR_FUNC_PTR
* Bus read function pointer: BNO055_RD_FUNC_PTR
* Delay function pointer: delay_msec
* I2C address: dev_addr
*--------------------------------------------------------------------------*/
s8 I2C_routine(void)
{
bno055.bus_write = BNO055_I2C_bus_write;
bno055.bus_read = BNO055_I2C_bus_read;
bno055.delay_msec = BNO055_delay_msek;
bno055.dev_addr = BNO055_I2C_ADDR1;
return BNO055_INIT_VALUE;
}
/************** I2C buffer length******/
#define I2C_BUFFER_LEN 8
#define I2C0 5
/*-------------------------------------------------------------------*
*
* This is a sample code for read and write the data by using I2C
* Use either I2C based on your need
* The device address defined in the bno055.h file
*
*--------------------------------------------------------------------*/
/* \Brief: The API is used as I2C bus write
* \Return : Status of the I2C write
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be written
* \param reg_data : It is a value hold in the array,
* will be used for write the value into the register
* \param cnt : The no of byte of data to be write
*/
s8 BNO055_I2C_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt)
{
s32 BNO055_iERROR = BNO055_INIT_VALUE;
u8 array[I2C_BUFFER_LEN];
u8 stringpos = BNO055_INIT_VALUE;
array[BNO055_INIT_VALUE] = reg_addr;
for (stringpos = BNO055_INIT_VALUE; stringpos < cnt; stringpos++)
{
array[stringpos + BNO055_I2C_BUS_WRITE_ARRAY_INDEX] = *(reg_data + stringpos);
}
}
/*
* Please take the below APIs as your reference for
* write the data using I2C communication
* "BNO055_iERROR = I2C_WRITE_STRING(DEV_ADDR, ARRAY, CNT+1)"
* add your I2C write APIs here
* BNO055_iERROR is an return value of I2C read API
* Please select your valid return value
* In the driver BNO055_SUCCESS defined as 0
* and FAILURE defined as -1
* Note :
* This is a full duplex operation,
* The first read data is discarded, for that extra write operation
* have to be initiated. For that cnt+1 operation done
* in the I2C write string function
* For more information please refer data sheet SPI communication:
*/
return (s8)BNO055_iERROR;
}
/* \Brief: The API is used as I2C bus read
* \Return : Status of the I2C read
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be read
* \param reg_data : This data read from the sensor,
* which is hold in an array
* \param cnt : The no of byte of data to be read
*/
s8 BNO055_I2C_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt)
{
s32 BNO055_iERROR = BNO055_INIT_VALUE;
u8 array[I2C_BUFFER_LEN] = { BNO055_INIT_VALUE };
u8 stringpos = BNO055_INIT_VALUE;
array[BNO055_INIT_VALUE] = reg_addr;
/* Please take the below API as your reference
* for read the data using I2C communication
* add your I2C read API here.
* "BNO055_iERROR = I2C_WRITE_READ_STRING(DEV_ADDR,
* ARRAY, ARRAY, 1, CNT)"
* BNO055_iERROR is an return value of SPI write API
* Please select your valid return value
* In the driver BNO055_SUCCESS defined as 0
* and FAILURE defined as -1
*/
for (stringpos = BNO055_INIT_VALUE; stringpos < cnt; stringpos++)
{
*(reg_data + stringpos) = array[stringpos];
}
return (s8)BNO055_iERROR;
}
/* Brief : The delay routine
* \param : delay in ms
*/
void BNO055_delay_msek(u32 msek)
{
/*Here you can write your own delay routine*/
}
#endif

2167
lib/hardware/sensors/gphoto/actions.c
File diff suppressed because it is too large
View File

112
lib/hardware/sensors/gphoto/actions.h

@ -0,0 +1,112 @@
/* actions.h
*
* Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef __ACTIONS_H__
#define __ACTIONS_H__
#include <gphoto2/gphoto2-camera.h>
#include <gphoto2/gphoto2-context.h>
#include "gp-params.h"
enum wait_type {
WAIT_TIME,
WAIT_EVENTS,
WAIT_FRAMES,
WAIT_STRING,
};
enum download_type { DT_NO_DOWNLOAD, DT_DOWNLOAD };
struct waitparams {
union {
int milliseconds;
int events;
int frames;
char *str;
} u;
enum wait_type type;
enum download_type downloadtype;
};
/* Image actions */
typedef int FileAction (GPParams *, const char *folder, const char *filename);
int print_file_action (GPParams *, const char *folder, const char *filename);
int print_exif_action (GPParams *, const char *folder, const char *filename);
int print_info_action (GPParams *, const char *folder, const char *filename);
int save_file_action (GPParams *, const char *folder, const char *filename);
int save_thumbnail_action (GPParams *, const char *folder, const char *filename);
int save_raw_action (GPParams *, const char *folder, const char *filename);
int save_audio_action (GPParams *, const char *folder, const char *filename);
int save_all_audio_action (GPParams *, const char *folder, const char *filename);
int save_exif_action (GPParams *, const char *folder, const char *filename);
int save_meta_action (GPParams *, const char *folder, const char *filename);
int delete_file_action (GPParams *, const char *folder, const char *filename);
/* Folder actions */
typedef int FolderAction (GPParams *);
int delete_all_action (GPParams *);
int list_files_action (GPParams *);
int list_folders_action (GPParams *);
int num_files_action (GPParams *);
/* Camera actions */
int action_camera_about (GPParams *);
int action_camera_summary (GPParams *);
int action_camera_manual (GPParams *);
int action_camera_set_port (GPParams *, const char *port);
int action_camera_set_speed (GPParams *, unsigned int speed);
int action_camera_set_model (GPParams *, const char *model);
int action_camera_show_abilities (GPParams *);
int action_camera_upload_file (GPParams *, const char *folder,
const char *path);
int action_camera_upload_metadata (GPParams *, const char *folder,
const char *path);
int action_camera_capture_preview (GPParams *);
int action_camera_show_preview (GPParams *);
int action_camera_capture_movie (GPParams *, const char *arg);
int action_camera_wait_event (GPParams *, enum download_type dt, const char*args);
/* Other actions */
int list_cameras_action (GPParams *);
int list_ports_action (GPParams *);
int auto_detect_action (GPParams *);
int set_folder_action (GPParams *, const char *folder);
int set_filename_action (GPParams *, const char *filename);
int print_version_action (GPParams *);
int override_usbids_action (GPParams *, int usb_vendor, int usb_product,
int usb_vendor_modified, int usb_product_modified);
int debug_action (GPParams *, const char *debug_loglevel, const char *debug_logfile_name);
int list_config_action (GPParams *);
int list_all_config_action (GPParams *);
int get_config_action (GPParams *, const char *name);
int set_config_action (GPParams *, const char *name, const char *value);
int set_config_index_action (GPParams *, const char *name, const char *value);
int set_config_value_action (GPParams *, const char *name, const char *value);
int print_storage_info (GPParams *);
void _get_portinfo_list (GPParams *p);
#endif /* __ACTIONS_H__ */
/*
* Local Variables:
* c-file-style:"linux"
* indent-tabs-mode:t
* End:
*/

2545
lib/hardware/sensors/gphoto/gPhotoCamera.cpp
File diff suppressed because it is too large
View File

287
lib/hardware/sensors/gphoto/gPhotoCamera.h

@ -0,0 +1,287 @@
#ifndef __GPHOTO_CAMERA_OBJECT_HEADER__
#define __GPHOTO_CAMERA_OBJECT_HEADER__
#include "../../../components/base/basicSettingsProvider.h"
#include "../../../components/base/basicThread.h"
#include "../../../components/base/basicMutex.h"
#include "../../../components/object/objectPathfinderBinaryLog.h"
#include "../../../pathfinder/pathfinderDBConnector.h"
#include <sys/types.h>
#include <utime.h>
#include <sys/time.h>
#include <gphoto2/gphoto2.h>
#include <gphoto2/gphoto2-camera.h>
#include <gphoto2/gphoto2-context.h>
#include <gphoto2/gphoto2-port.h>
#include <gphoto2/gphoto2-widget.h>
#include <queue>
#define GPHOTO_TAG_MOUNT_POINT "MOUNT_POINT"
#define GPHOTO_TAG_MOUNT_POINT_UID "UID"
#define GPHOTO_TAG_MOUNT_POINT_GID "GID"
typedef enum E_GP_COMMAND{
GP_NO_CMD = 0,
GP_SINGLE_SHOT = 1,
GP_START_BURST = 2,
GP_START_BURST_STAGE2 = 3,
GP_STOP_BURST_STAGE1 = 4,
GP_STOP_BURST = 5,
GP_SET_CONFIG = 6,
GP_RETREAVE = 7,
GP_PREVIEW_SHOT = 8,
GP_START_PREVIEW = 9,
GP_STOP_PREVIEW = 10,
GP_DEL_PHOTOS = 11
} GP_COMMAND;
typedef enum E_GP_CAP_TARGET{
GP_MEMORY = 0,
GP_SD_CARD = 1
} GP_CAP_TARGET;
typedef struct S_GP_CAM_COMMAND{
GP_COMMAND cmd;
char prm[128];
char var[128];
} GP_CAM_COMMAND;
typedef queue<GP_CAM_COMMAND *> GP_COMMAND_QUEUE;
typedef struct S_GP_CAP_INFO{
char folder[128];
char name[64];
uint64_t ts;
} GP_CAP_INFO;
typedef vector<GP_CAP_INFO *> GP_CAP_VECTOR;
typedef enum {
FLAGS_RECURSE = 1 << 0,
FLAGS_REVERSE = 1 << 1,
FLAGS_QUIET = 1 << 2,
FLAGS_FORCE_OVERWRITE = 1 << 3,
FLAGS_STDOUT = 1 << 4,
FLAGS_STDOUT_SIZE = 1 << 5,
FLAGS_NEW = 1 << 6,
FLAGS_RESET_CAPTURE_INTERVAL = 1 << 7,
FLAGS_KEEP = 1 << 8,
FLAGS_KEEP_RAW = 1 << 9,
FLAGS_SKIP_EXISTING = 1 << 10,
} Flags;
typedef enum {
MULTI_UPLOAD,
MULTI_UPLOAD_META,
MULTI_DOWNLOAD,
MULTI_DELETE
} MultiType;
enum download_type { DT_NO_DOWNLOAD, DT_DOWNLOAD };
#define GP_WM_NA 0
#define GP_WM_CTRL 1
#define GP_WM_STOR 2
#define GP_WM_PREV 3
#define GP_WM_BURST 4
class gPhotoCamera: public basicThread{
private:
basicLogCollection * m_pLog;
config_setting_t * m_pSettings;
PATHFINDER_DBC * m_pDBC;
objectPathfinderBinaryLog * m_pBLOG;
uint32_t m_nAccessUID;
uint32_t m_nAccessGID;
char m_pCamMountPoint[256];
basicMutex m_mCommandLock;
basicMutex m_mDataLock;
GP_COMMAND_QUEUE m_qCommands;
GP_CAP_INFO m_vCaptures;
uint8_t m_bOldWMode;
uint8_t m_bWMode;
int m_nCameraID;
CameraAbilities m_sCamAttribs;
CameraAbilitiesList * m_pAbilitiesList;
GPPortInfoList * m_pPortInfoList;
GPPortInfo m_pPortInfo; // pStruct
GPPortType m_ePortType; //Enum
Camera * m_pCamera;
CameraFile * m_pCamFile;
GPContext * m_pContext;
uint32_t m_nFlags;
char m_pCapFolder[128];
uint32_t m_nFolderID;
char m_pCapFile[64];
bool m_bBurstCapturing;
bool m_pChannelIsBusy;
int get_config_value_string ( Camera *camera, const char *key, char **str, GPContext *context );
int _lookup_widget( CameraWidget*widget, const char *key, CameraWidget **child );
bool fetchFile( uint32_t pictureID );
/*GPPhoto2 functions*/
int delete_all_action( char *folder );
int action_camera_upload_file( char *folder, char *path );
int action_camera_upload_metadata( char *folder, char *path );
int num_files_action();
int list_folders_action();
int list_files_action();
int print_info_action( char *folder, char *filename );
int print_file_action( char *folder, char *filename );
int save_file_action( char *folder, char *filename );
int save_exif_action( char *folder, char *filename );
int save_meta_action( char *folder, char *filename );
int save_thumbnail_action( char *folder, char *filename );
int save_raw_action( char *folder, char *filename );
int save_audio_action( char *folder, char *filename );
int save_all_audio_action( char *folder, char *filename );
int delete_file_action( char *folder, char *filename );
int print_exif_action( char *folder, char *filename );
int list_cameras_action();
void _get_portinfo_list();
int list_ports_action();
int auto_detect_action();
int action_camera_show_abilities();
int action_camera_set_port( const char *port );
int action_camera_about();
int action_camera_summary();
int action_camera_manual();
int action_camera_set_speed( unsigned int speed );
int action_camera_set_model( const char *model );
int set_folder_action( const char *folder );
int set_filename_action( const char *filename );
int print_version_action();
int _action_camera_capture_preview( int viewasciiart );
int action_camera_capture_preview();
int action_camera_show_preview();
int action_camera_capture_movie( const char *arg );
int action_camera_wait_event ( enum download_type downloadtype, const char*arg );
int print_storage_info();
int override_usbids_action( int usb_vendor, int usb_product, int usb_vendor_modified, int usb_product_modified );
void display_widgets( CameraWidget *widget, char *prefix, int dumpval );
int list_all_config_action();
int list_config_action();
int _find_widget_by_name( const char *name, CameraWidget **child, CameraWidget **rootconfig );
size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm);
int print_widget( const char *name, CameraWidget *widget );
int get_config_action( const char *name );
int set_config_action( const char *name, const char *value );
int set_config_index_action( const char *name, const char *value );
int set_config_value_action( const char *name, const char *value );
CameraAbilitiesList * gp_params_abilities_list();
//int save_file_to_file( Camera *camera, GPContext *context, uint32_t flags, char *folder, char *filename, CameraFileType type );
//int camera_file_exists( Camera *camera, GPContext *context, char *folder, char *filename, CameraFileType type );
//void ñli_error_print(char *format, ...);
//int get_path_for_file( const char *folder, const char *name, CameraFileType type, CameraFile *file, char **path);
//int camera_file_exists( Camera *camera, GPContext *context, const char *folder, const char *filename, CameraFileType type );
//int save_file_to_file( Camera *camera, GPContext *context, Flags flags, const char *folder, const char *filename, CameraFileType type);
//int save_camera_file_to_file( const char *folder, const char *fn, CameraFileType type, CameraFile *file, const char *tmpname);
int capture_generic( CameraCaptureType type, const char *name, int download);
void updateFileTree( int fsid, int parent, CSTR folder );
bool setWM( uint8_t NMode );
bool cancelWM( uint8_t NMode );
protected:
virtual void m_fThreadProc( void );
public:
explicit gPhotoCamera( config_setting_t *Settings );
explicit gPhotoCamera( PATHFINDER_DBC *DBC );
explicit gPhotoCamera( config_setting_t *Settings = NULL, PATHFINDER_DBC *DBC = NULL );
virtual ~gPhotoCamera();
bool makeShot();
bool makePreview();
bool validate();
bool create();
bool startBurst();
bool stopBurst();
bool startPreview();
bool stopPreview();
bool setCaptureTarget( GP_CAP_TARGET T );
bool retreavePicture( CSTR name );
bool switchToStorage();
bool switchToCamera();
bool deleteAllPictures();
bool isDead();
/*
/main/actions/syncdatetimeutc
/main/actions/syncdatetime
/main/actions/uilock
/main/actions/autofocusdrive
/main/actions/manualfocusdrive
/main/actions/cancelautofocus
/main/actions/eoszoom
/main/actions/eoszoomposition
/main/actions/viewfinder
/main/actions/eosremoterelease
/main/actions/opcode
/main/settings/datetimeutc
/main/settings/datetime
/main/settings/reviewtime
/main/settings/output
/main/settings/movierecordtarget
/main/settings/evfmode
/main/settings/ownername
/main/settings/artist
/main/settings/copyright
/main/settings/customfuncex
/main/settings/focusinfo
/main/settings/autopoweroff
/main/settings/depthoffield
/main/settings/capturetarget
/main/settings/capture
/main/status/serialnumber
/main/status/manufacturer
/main/status/cameramodel
/main/status/deviceversion
/main/status/vendorextension
/main/status/model
/main/status/ptpversion
/main/status/Battery Level
/main/status/batterylevel
/main/status/lensname
/main/status/eosserialnumber
/main/status/shuttercounter
/main/status/availableshots
/main/imgsettings/imageformat
/main/imgsettings/imageformatsd
/main/imgsettings/iso
/main/imgsettings/whitebalance
/main/imgsettings/whitebalanceadjusta
/main/imgsettings/whitebalanceadjustb
/main/imgsettings/whitebalancexa
/main/imgsettings/whitebalancexb
/main/imgsettings/colorspace
/main/capturesettings/exposurecompensation
/main/capturesettings/focusmode
/main/capturesettings/aspectratio
/main/capturesettings/storageid
/main/capturesettings/autoexposuremode
/main/capturesettings/drivemode
/main/capturesettings/picturestyle
/main/capturesettings/aperture
/main/capturesettings/shutterspeed
/main/capturesettings/meteringmode
/main/capturesettings/bracketmode
/main/capturesettings/aeb
*/
};
#endif

19
lib/hardware/sensors/gphoto/globals.h

@ -0,0 +1,19 @@
#ifndef __GLOBALS_H__
#define __GLOBALS_H__
extern char glob_cancel;
extern char *glob_folder;
extern char glob_cwd[];
extern int glob_option_count;
#endif
/*
* Local Variables:
* c-file-style:"linux"
* indent-tabs-mode:t
* End:
*/

545
lib/hardware/sensors/gphoto/gp-params.c

@ -0,0 +1,545 @@
/* gp-params.c
*
* Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "gp-params.h"
#include "i18n.h"
/* This needs to disappear. */
#include "globals.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#ifndef HAVE_SPAWNVE
#include "spawnve.h"
#endif
#ifndef MAX
#define MAX(x, y) (((x)>(y))?(x):(y))
#endif
#ifndef MIN
#define MIN(x, y) (((x)<(y))?(x):(y))
#endif
#ifdef __GNUC__
#define __unused__ __attribute__((unused))
#else
#define __unused__
#endif
static void
ctx_status_func (GPContext __unused__ *context, const char *str,
void *data)
{
GPParams *params = data;
if (params->flags & FLAGS_QUIET)
return;
fprintf (stderr, "%s\n", str);
fflush (stderr);
}
static void
ctx_error_func (GPContext __unused__ *context, const char *str, void __unused__ *data)
{
fprintf (stderr, "\n");
fprintf (stderr, _("*** Error *** \n"));
fprintf (stderr, "%s\n", str);
fflush (stderr);
}
#define MAX_PROGRESS_STATES 16
#define MAX_MSG_LEN 1024
static struct {
char message[MAX_MSG_LEN + 1];
float target;
unsigned long int count;
struct {
float current;
time_t time, left;
} last;
} progress_states[MAX_PROGRESS_STATES];
static unsigned int
ctx_progress_start_func (GPContext __unused__ *context, float target,
const char *str, void *data)
{
GPParams *p = data;
unsigned int id, len;
static unsigned char initialized = 0;
if (!initialized) {
memset (progress_states, 0, sizeof (progress_states));
initialized = 1;
}
if (p->flags & FLAGS_QUIET)
return 0;
/*
* If the message is too long, we will shorten it. If we have less
* than 4 cols available, we won't display any message.
*/
len = (p->cols * 0.5 < 4) ? 0 : MIN (p->cols * 0.5, MAX_MSG_LEN);
/* Remember message and target. */
for (id = 0; id < MAX_PROGRESS_STATES; id++)
if (!progress_states[id].target)
break;
if (id == MAX_PROGRESS_STATES)
id--;
progress_states[id].target = target;
strncpy (progress_states[id].message, str, len + 1);
progress_states[id].count = 0;
progress_states[id].last.time = time (NULL);
progress_states[id].last.current = progress_states[id].last.left = 0.;
/* If message is too long, shorten it. */
if (progress_states[id].message[len - 1]) {
progress_states[id].message[len - 1] = '\0';
progress_states[id].message[len - 2] = '.';
progress_states[id].message[len - 3] = '.';
progress_states[id].message[len - 4] = '.';
}
return (id);
}
static void
ctx_progress_update_func (GPContext __unused__ *context, unsigned int id,
float current, void *data)
{
GPParams *p = data;
static const char spinner[] = "\\|/-";
unsigned int i, width, pos;
float rate;
char remaining[10], buf[10];
time_t sec = 0;
/* Guard against buggy camera drivers */
if (id >= MAX_PROGRESS_STATES || ((int)id) < 0)
return;
if (p->flags & FLAGS_QUIET)
return;
/* How much time until completion? */
if ((time (NULL) - progress_states[id].last.time > 0) &&
(current - progress_states[id].last.current > 0)) {
rate = (time (NULL) - progress_states[id].last.time) /
(current - progress_states[id].last.current);
sec = (MAX (0, progress_states[id].target - current)) * rate;
if (progress_states[id].last.left) {
sec += progress_states[id].last.left;
sec /= 2.;
}
progress_states[id].last.time = time (NULL);
progress_states[id].last.current = current;
progress_states[id].last.left = sec;
} else
sec = progress_states[id].last.left;
memset (remaining, 0, sizeof (remaining));
if ((int) sec >= 3600) {
snprintf (buf, sizeof (buf), "%2ih", (int) sec / 3600);
sec -= ((int) (sec / 3600) * 3600);
strncat (remaining, buf, sizeof (remaining) - strlen (remaining) - 1);
}
if ((int) sec >= 60) {
snprintf (buf, sizeof (buf), "%2im", (int) sec / 60);
sec -= ((int) (sec / 60) * 60);
strncat (remaining, buf, sizeof (remaining) - strlen (remaining) - 1);
}
if ((int) sec) {
snprintf (buf, sizeof (buf), "%2is", (int) sec);
strncat (remaining, buf, sizeof (remaining) - strlen (remaining) - 1);
}
/* Determine the width of the progress bar and the current position */
width = MAX (0, (int) (p->cols -
strlen (progress_states[id].message) - 20));
pos = MIN (width, (MIN (current / progress_states[id].target, 100.) * width) + 0.5);
/* Print the progress bar */
printf ("%s |", progress_states[id].message);
for (i = 0; i < width; i++)
putchar ((i < pos) ? '-' : ' ');
if (pos == width)
putchar ('|');
else
putchar (spinner[progress_states[id].count & 0x03]);
progress_states[id].count++;
printf (" %5.1f%% %9.9s\r",
current / progress_states[id].target * 100., remaining);
fflush (stdout);
}
static void
ctx_progress_stop_func (GPContext __unused__ *context, unsigned int id,
void *data)
{
GPParams *p = data;
unsigned int i;
/* Guard against buggy camera drivers */
if (id >= MAX_PROGRESS_STATES || ((int)id) < 0)
return;
if (p->flags & FLAGS_QUIET)
return;
/* Clear the progress bar. */
for (i = 0; i < p->cols; i++)
putchar (' ');
putchar ('\r');
fflush (stdout);
progress_states[id].target = 0.;
}
static GPContextFeedback
ctx_cancel_func (GPContext __unused__ *context, void __unused__ *data)
{
if (glob_cancel) {
glob_cancel = 0;
return (GP_CONTEXT_FEEDBACK_CANCEL);
} else
return (GP_CONTEXT_FEEDBACK_OK);
}
static void
ctx_message_func (GPContext __unused__ *context, const char *str,
void __unused__ *data)
{
printf ("%s\n", str);
/* Only ask for confirmation if the user can give it. */
if (isatty (STDOUT_FILENO) && isatty (STDIN_FILENO)) {
printf (_("Press any key to continue.\n"));
fflush (stdout);
fgetc (stdin);
} else
fflush (stdout);
}
/** gp_params_init
* @param envp: The third char ** parameter of the main() function
*/
void
gp_params_init (GPParams *p, char **envp)
{
if (!p)
return;
memset (p, 0, sizeof (GPParams));
p->folder = strdup ("/");
if (!p->folder) {
fprintf (stderr, _("Not enough memory."));
fputc ('\n', stderr);
exit (1);
}
gp_camera_new (&p->camera);
p->cols = 79;
p->flags = FLAGS_RECURSE;
/* Create a context. Report progress only if users will see it. */
p->context = gp_context_new ();
gp_context_set_cancel_func (p->context, ctx_cancel_func, p);
gp_context_set_error_func (p->context, ctx_error_func, p);
gp_context_set_status_func (p->context, ctx_status_func, p);
gp_context_set_message_func (p->context, ctx_message_func, p);
if (isatty (STDOUT_FILENO))
gp_context_set_progress_funcs (p->context,
ctx_progress_start_func, ctx_progress_update_func,
ctx_progress_stop_func, p);
p->_abilities_list = NULL;
p->debug_func_id = -1;
p->envp = envp;
}
CameraAbilitiesList *
gp_params_abilities_list (GPParams *p)
{
/* If p == NULL, the behaviour of this function is as undefined as
* the expression p->abilities_list would have been. */
if (p->_abilities_list == NULL) {
gp_abilities_list_new (&p->_abilities_list);
gp_abilities_list_load (p->_abilities_list, p->context);
}
return p->_abilities_list;
}
void
gp_params_exit (GPParams *p)
{
if (!p)
return;
if (p->_abilities_list)
gp_abilities_list_free (p->_abilities_list);
if (p->camera)
gp_camera_unref (p->camera);
if (p->folder)
free (p->folder);
if (p->filename)
free (p->filename);
if (p->context)
gp_context_unref (p->context);
if (p->hook_script)
free (p->hook_script);
if (p->portinfo_list)
gp_port_info_list_free (p->portinfo_list);
memset (p, 0, sizeof (GPParams));
}
/* If CALL_VIA_SYSTEM is defined, use insecure system(3) instead of execve(2) */
/* #define CALL_VIA_SYSTEM */
static int
internal_run_hook(const char *const hook_script,
const char *const action, const char *const argument,
char **envp);
int
gp_params_run_hook (GPParams *params, const char *action, const char *argument)
{
/* printf("gp_params_run_hook(params, \"%s\", \"%s\")\n",
action, argument);
*/
if (params->hook_script == NULL) {
return 0;
}
return internal_run_hook(params->hook_script,
action, argument,
params->envp);
}
#ifdef CALL_VIA_SYSTEM
static void
internal_putenv(const char *const varname, const char *const value)
{
if (NULL != varname) {
if (NULL != value) {
const size_t varname_size = strlen(varname);
const size_t value_size = strlen(value);
/* '=' and '\0' */
const size_t buffer_size = varname_size + value_size + 2;
char buffer[buffer_size];
strcpy(buffer, varname);
strcat(buffer, "=");
strcat(buffer, value);
printf("putenv(\"%s\")\n", buffer);
if (0 != putenv(buffer)) {
printf("putenv error\n");
}
} else {
/* clear variable */
if (unsetenv(varname)) {
int my_errno = errno;
fprintf(stderr, "unsetenv(\"%s\"): %s",
varname, strerror(my_errno));
}
}
}
printf("%% %s=%s\n", varname, getenv(varname));
}
#endif
#ifndef CALL_VIA_SYSTEM
#define ASSERT(cond) \
do { \
if (!(cond)) { \
fprintf(stderr, "%s:%d: Assertion failed: %s\n", \
__FILE__, __LINE__, #cond); \
exit(13); \
} \
} while(0)
static char *
alloc_envar(const char *varname, const char *value)
{
const size_t varname_size = strlen(varname);
const size_t value_size = strlen(value);
const size_t buf_size = varname_size + 1 + value_size + 1;
char *result_buf = malloc(buf_size);
if (!result_buf) return NULL;
strcpy(result_buf, varname);
strcat(result_buf, "=");
strcat(result_buf, value);
return result_buf;
}
#endif
static int
internal_run_hook(const char *const hook_script,
const char *const action, const char *const argument,
char **envp)
{
#ifdef CALL_VIA_SYSTEM
int retcode;
/* run hook using system(3) */
internal_putenv("ACTION", action);
internal_putenv("ARGUMENT", argument);
retcode = system(hook_script);
if (retcode != 0) {
fprintf(stderr, "Hook script returned error code %d (0x%x)\n",
retcode, retcode);
return 1;
}
return 0;
#else
/* spawnve() based implementation of internal_run_hook()
*
* Most of the code here creates and destructs the
* char *child_argv[] and char *child_envp[] to be passed to
* spawnve() and thus execve().
*
* Error handling is simple:
* * If malloc() or calloc() fail, abort the whole program.
*/
/* A note on program memory layout:
*
* child_argv and child_envp MUST be in writable memory, so we
* malloc() them.
*/
char *my_hook_script = strdup(hook_script);
unsigned int i;
/* run hook using execve(2) */
char **child_argv = calloc(2, sizeof(child_argv[0]));
/* envars not to copy */
const char *const varlist[] = {
"ACTION", "ARGUMENT", NULL
};
/* environment variables for child process, and index going through them */
char **child_envp;
unsigned int envi = 0;
int retcode;
/* count number of environment variables currently set */
unsigned int envar_count;
for (envar_count=0; envp[envar_count] != NULL; envar_count++) {
/* printf("%3d: \"%s\"\n", envar_count, envp[envar_count]); */
}
ASSERT(my_hook_script != NULL);
child_argv[0] = my_hook_script;
/* Initialize environment. Start with newly defined vars, then copy
* all the existing ones. calloc() does the initialization with NULL.
* Total amount of char* is
* number of existing envars (envar_count)
* + max number of new envars (2)
* + NULL list terminator (1)
*/
child_envp = calloc(envar_count+((sizeof(varlist)/sizeof(varlist[0]))-1)+1,
sizeof(child_envp[0]));
ASSERT(child_envp != NULL);
/* own envars */
if (NULL != action) {
char *envar = alloc_envar("ACTION", action);
ASSERT(envar != NULL);
child_envp[envi++] = envar;
}
if (NULL != argument) {
char *envar = alloc_envar("ARGUMENT", argument);
ASSERT(envar != NULL);
child_envp[envi++] = envar;
}
/* copy envars except for those in varlist */
for (i=0; i<envar_count; i++) {
int skip = 0;
unsigned int n;
for (n=0; varlist[n] != NULL; n++) {
const char *varname = varlist[n];
const char *start = strstr(envp[i], varname);
if ((envp[i] == start) && (envp[i][strlen(varname)] == '=')) {
skip = 1;
break;
}
}
if (!skip) {
child_envp[envi++] = strdup(envp[i]);
}
}
/* Actually run the hook script */
retcode = spawnve(hook_script, child_argv, child_envp);
/* Free all memory */
for (i=0; child_envp[i] != NULL; i++) {
free(child_envp[i]);
}
free(child_envp);
for (i=0; child_argv[i] != NULL; i++) {
free(child_argv[i]);
}
free(child_argv);
/* And finally return to caller */
if (retcode != 0) {
fprintf(stderr, "Hook script returned error code %d (0x%x)\n",
retcode, retcode);
return 1;
}
return 0;
#endif
}
/*
* Local Variables:
* c-file-style:"linux"
* indent-tabs-mode:t
* End:
*/

93
lib/hardware/sensors/gphoto/gp-params.h

@ -0,0 +1,93 @@
/* gp-params.h
*
* Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef __GP_PARAMS_H__
#define __GP_PARAMS_H__
#include <gphoto2/gphoto2-camera.h>
#include <gphoto2/gphoto2-abilities-list.h>
#include <gphoto2/gphoto2-context.h>
typedef enum {
FLAGS_RECURSE = 1 << 0,
FLAGS_REVERSE = 1 << 1,
FLAGS_QUIET = 1 << 2,
FLAGS_FORCE_OVERWRITE = 1 << 3,
FLAGS_STDOUT = 1 << 4,
FLAGS_STDOUT_SIZE = 1 << 5,
FLAGS_NEW = 1 << 6,
FLAGS_RESET_CAPTURE_INTERVAL = 1 << 7,
FLAGS_KEEP = 1 << 8,
FLAGS_KEEP_RAW = 1 << 9,
FLAGS_SKIP_EXISTING = 1 << 10,
} Flags;
typedef enum {
MULTI_UPLOAD,
MULTI_UPLOAD_META,
MULTI_DOWNLOAD,
MULTI_DELETE
} MultiType;
typedef struct _GPParams GPParams;
struct _GPParams {
Camera *camera;
GPContext *context;
char *folder;
char *filename;
unsigned int cols;
Flags flags;
/** This field is supposed to be private. Usually, you use the
* gp_camera_abilities_list() function to access it.
*/
CameraAbilitiesList *_abilities_list;
GPPortInfoList *portinfo_list;
int debug_func_id;
MultiType multi_type;
CameraFileType download_type; /* for multi download */
char *hook_script; /* If non-NULL, hook script to run */
char **envp; /* envp from the main() function */
};
void gp_params_init (GPParams *params, char **envp);
void gp_params_exit (GPParams *params);
/* Use only this function to access the abilities_list member of the
* GPParams structure. This function makes sure that the
* abilities_list is only iniatilized if it is actually used. */
CameraAbilitiesList *gp_params_abilities_list (GPParams *params);
int gp_params_run_hook (GPParams *params, const char *command, const char *argument);
#endif
/*
* Local Variables:
* c-file-style:"linux"
* indent-tabs-mode:t
* End:
*/

21
lib/hardware/sensors/gphoto/gphoto2-master/.cvsignore

@ -0,0 +1,21 @@
*~ .*~
.arch-ids
configure
autom4te.cache
Makefile
Makefile.in
aclocal.m4
config.h.in
config.h
stamp-h.in
stamp-h
intl
ABOUT-NLS
config.guess
config.log
config.status
config.sub
ltmain.sh
{arch}
mkinstalldirs
config.rpath

84
lib/hardware/sensors/gphoto/gphoto2-master/.gitignore

@ -0,0 +1,84 @@
# Object files
*.o
*.ko
*.obj
*.elf
*.gmo
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.deps/
*.libs/
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
gphoto2/gphoto2
# Debug files
*.dSYM/
# backup files
*~
# auto generated files
*.pc
.dirstamp
po/*.header
auto-m4/
auto-aux/
Makefile
Makefile.in
ABOUT-NLS
aclocal.m4
autom4te.cache/
config.h
config.h.in
config.log
config.status
configure
doc/Doxyfile
doc/Doxyfile-internals
/INSTALL
libtool
po/Makefile.in.in
po/Makevars
po/Makevars.template
po/POTFILES
po/Rules-quot
po/boldquot.sed
po/insert-header.sin
po/quot.sed
po/remove-potcdate.sin
po/remove-potcdate.sed
stamp-h1
gphoto2/spawntest
gphoto2/spawntest.log
gphoto2/spawntest.trs
gphoto2/test-suite.log
packaging/rpm/package.spec
po/stamp-po
tests/log/
tests/test-suite.log
tests/testsuite.log
tests/testsuite.trs
packaging/rpm/gphoto2.spec
po/gphoto2.pot

42
lib/hardware/sensors/gphoto/gphoto2-master/.travis.yml

@ -0,0 +1,42 @@
language: c
os:
- linux
compiler:
- gcc
env:
- EXTRALIBS="libusb-1.0-0-dev libgd2-xpm-dev libpopt-dev gettext"
- EXTRALIBS="libusb-1.0-0-dev libgd2-xpm-dev libpopt-dev libaa1-dev gettext"
- EXTRALIBS="libusb-1.0-0-dev libgd2-xpm-dev libpopt-dev libaa1-dev libcdk5-dev gettext"
# Note: Keep the sudo commands in .travis.yml - they do not work from
# a helper shell script.
before_install:
- travis_retry git clone --depth=50 https://github.com/gphoto/libgphoto2.git lgp2
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update > /dev/null; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install $(sh lgp2/.travis-translate-pkgs $EXTRALIBS); fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH=/usr/local/opt/gettext/bin:$PATH; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y $(sh lgp2/.travis-translate-pkgs $EXTRALIBS); fi
install:
- cd lgp2
- git_sha=$(git rev-parse HEAD); echo git checkout -qf ${git_sha}; git checkout -qf ${git_sha}
- echo $PATH; which autopoint; which gettext
- autoreconf -vis
- ./configure --prefix=/usr --libdir=/usr/lib --enable-silent-rules --with-camlibs=directory
- make && sudo make install
- cd ..
script:
- autoreconf -v -i -f
- ./configure --prefix=$PWD/_i
- make && make check || cat tests/log/test037.out
- make && make install && make installcheck
notifications:
email:
on_success: change
on_failure: always

7
lib/hardware/sensors/gphoto/gphoto2-master/AUTHORS

@ -0,0 +1,7 @@
Lutz Mueller <lutz@users.sourceforge.net>
Hans Ulrich Niedermann <gp@n-dimensional.de>
Christophe Barbe <christophe@ufies.org>
Hubert Figuiere <hfiguiere@teaser.fr>
Colin Marquardt <colin@marquardt-home.de>
Marcus Meissner <marcus@jet.franken.de>
Theodore Kilgore <kilgota@auburn.edu>

340
lib/hardware/sensors/gphoto/gphoto2-master/COPYING

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

484
lib/hardware/sensors/gphoto/gphoto2-master/ChangeLog

@ -0,0 +1,484 @@
2011-08-19 Marcus Meissner <marcus@jet.franken.de>
* Added "--keep" and "--no-keep" options for capture tethered
and capture image.
* --wait-event and --capture-tethered can now do:
* nr of events (200)
* seconds (100s)
* milliseconds (200ms) (1/1000 of a second)
* frames (50f) (number of images)
* New --list-all-config gives the full config tree.
2009-09-30 Jonathan McIlnay-Moe <jmacmoe@gmail.com>
* main.c: Added a "bulb" option for capture.
--capture-image-and-download -B 5 ...
--capture-image-and-download --bulb 5 ...
It requires a camera with "bulb" support (currently
newer EOS cameras only).
2009-07-23 Marcus Meissner <marcus@jet.franken.de>
* shell.c,action.c,main.c:
--capture-tethered ported to be just --wait-event + downloading
New --wait-event-and-download commandline option.
--capture-tethered and --wait-event-and-download take optional
counts or seconds, default is infinite waiting.
Added 3 new shell commands:
wait-event=x (just like wait-event cmdline option, default 1)
capture-tethered=x (just like capture-tethered cmdline option, default 1)
wait-event-and-download=x (just like wait-event-and-download cmdline option, default 1)
2009-06-21 Marcus Meissner <marcus@jet.franken.de>
* main.c,action.c,shell.c:
Added seperate --set-config-index and --set-config-value functions
for menu choice settings.
* main.c: Save files with current umask, not 0600.
2009-04-10 Marcus Meissner <marcus@jet.franken.de>
* main.c: --wait-event=x now can wait for "x" events,
or 1 second timeouts. (so longest wait time will be "x" seconds).
* main.c: --trigger-capture to trigger the camera capture
* main.c: --capture-image, --capture-image-and-download:
added a second implementation using "trigger capture" and "wait event".
* actions.c: ctrl-c can abort tethered capture now
* main.c: --capture made more quiet on --quiet
2008-12-04 T E Dixon <https://sourceforge.net/users/dixonte/>
* main.c: Allow graceful exiting interval capture with SIGUSR2.
2008-08-28 Marcus Meissner <marcus@jet.franken.de>
* gphoto2/main.c: Allow to specify a camera by port.
For instance:
gphoto2 --port usb:005,003 --capture-image
2008-05-24 Marcus Meissner <marcus@jet.franken.de>
* gphoto2/{main.c,main.h,shell.c}:
--capture-image split into:
--capture-image: just capture the image
--capture-image-and-download:
capture the image and download it.
2007-10-28 Dan Fandrich <dan@coneharvesters.com>
Marcus Meissner <marcus@jet.franken.de>
* tests/**: Start of a testsuite from Dan.
Integrated into automake framework and fixed
bugs shown by "make distcheck"
2007-07-21 Marcus Meissner <marcus@jet.franken.de>
* implemented --capture-tethered
2007-01-19 Marcus Meissner <marcus@jet.franken.de>
From Victor Wagner <vbwagner@users.sourceforge.net>
* gphoto2/main.c: read hook script and
filename from settings file.
2006-11-25 Hubert Figuiere <hub@figuiere.net>
* configure.ac: version post 2.3.0 because 2.3.0 has
been branched.
2006-03-23 Marcus Meissner <marcus@jet.franken.de>
* gphoto2/{main,action}.{ch}: Added
"--wait-event" functionality to exercise/test new
gp_camera_wait_for_event() functionality.
2006-03-18 Marcus Meissner <marcus@jet.franken.de>
* gphoto2/main.c: Allow wildcard gphoto2 -u *
upload, download and deletion, by handling the
rest of the arguments after popt option handling.
* gphoto2/shell.c: Added "put" shell cmd.
Added "list-config", "set-config", "get-config" shell
cmds. Added "capture-image" shell cmd.
2006-03-11 Hubert Figuiere <hub@figuiere.net>
* doc/gphoto2.1: Fix a typo in the man page. Patch
by <jnovy AT redhat DOT com>
2006-02-17 Marcus Meissner <marcus@jet.franken.de>
* gphoto2/actions.c: Fixed --port handling
when supplying regexp matched devices, by
keeping the GPPortInfoList* over the gphoto2
runtime.
2006-01-27 Theodore Kilgore <kilgota@auburn.edu>
* gphoto2/actions.c: added an entry for "Delete all" to
action_camera_show_abilities.
2006-01-01 Hubert Figuiere <hub@figuiere.net>
* configure.ac: version 2.1.99
2005-12-30 Hubert Figuiere <hub@figuiere.net>
* configure.ac: require libgphoto2 2.1.99
2005-05-13 Marcus Meissner <marcus@jet.franken.de>
* po/eu.po: baskish translation from dooteo <dooteo@euskalgnu.org>
2005-04-14 Hans Ulrich Niedermann <gp@n-dimensional.de>
* */configure.in, */Makefile.am, ...: updated build system.
See "./autogen.sh --help" and ./configure --help" for help.
* m4/, m4m/: use common m4 macro dir "m4m" now ("cvs co m4m")
2005-04-13 Colin Marquardt <colin@marquardt-home.de>
* configure.in (ALL_LINGUAS): Added rw.
* po/rw.po: New file courtesy Steve Murphy.
* po/nl.po, po/sk.po, po/sr.po, po/cs.po: Update.
2005-01-17 Colin Marquardt <colin@marquardt-home.de>
* po/ja.po: Update thanks to Takeshi AIHANA.
2004-01-08 Marcus Meissner <marcus@jet.franken.de>
* gphoto2/*.[ch]:
Merged patch from Hervé Eychenne <eychenne@users.sourceforge.net>:
- new flag handling, obsoleting some global ints
- --new handling, check for downloaded images.
- some fprintf(stdout -> printf( cleanups.
2004-01-08 Marcus Meissner <marcus@jet.franken.de>
* gphoto2/action.c, gphoto2/main.c:
- Implemented --set-config <name>=<value> option.
2004-01-05 Marcus Meissner <marcus@jet.franken.de>
* gphoto2/main.c: Change the filename handling to use
strftime() directly. This is sourceforge patch [ 1031367 ],
by Lauri Nurmi <lanurmi@users.sourceforge.net>
2004-01-05 Marcus Meissner <marcus@jet.franken.de>
* po/ru.po: Checked in update of ru.po from Vyacheslav Dikonov <slava@altlinux.ru>
2004-12-21 Colin Marquardt <colin@marquardt-home.de>
* po/ru.po: Update thanks to Vitaly Lipatov and Dmitry Kostrov.
2004-12-15 Hubert Figuiere <hfiguiere@teaser.fr>
* configure.in: version 2.1.5
2004-11-26 Hubert Figuiere <hfiguiere@teaser.fr>
* configure.in: version 2.1.5rc1
2004-09-11 Marcus Meissner <marcus@jet.franken.de>
* gphoto2/actions.[ch],main.c: Added
--list-config - dump the configuration tree of the camera
--get-config var - get the configuration entry <var>
2004-07-26 Colin Marquardt <colin@marquardt-home.de>
* configure.in (ALL_LINGUAS): Added nl
* nl.po: New Dutch translation, courtesy Julie Vermeersch.
2004-07-09 Colin Marquardt <colin@marquardt-home.de>
* configure.in (ALL_LINGUAS): Added fi
* fi.po: New Finnish translation, courtesy Matti Pöllä.
2004-06-10 Hubert Figuiere <hfiguiere@teaser.fr>
* configure.in (ALL_LINGUAS): Added hu
2004-06-04 Lutz Mueller <lutz@users.sourceforge.net>
* configure.in
* exif/actions.c: Make gphoto2 compile with libexif-0.6.9.
2004-04-20 Colin Marquardt <colin@marquardt-home.de>
* po/uk.po: Update.
* po/en_GB.po: New English (British) translation, courtesy Gareth Owen.
* configure.in: Add en_GB to ALL_LINGUAS.
2004-04-20 Marcus Meissner <marcus@jet.franken.de>
Patch by Darryl Sokoloski <darryl@k0r3dump.net>
* gphoto2/main.c: Added
--frames=count
--interval=seconds
capture sub options.
Cleaned up, corrected translations.
* gphoto2/main.h: Increased option description length.
2004-03-23 Lutz Mueller <lutz@users.sourceforge.net>
Patch by Michael Haardt <michael@moria.de>:
* gphoto2/gphoto2-cmd-config.c: Allow ranges like 1.5 ... 5.5 with
increments of 1.
2004-03-22 Colin Marquardt <colin@marquardt-home.de>
* po/az.po: New Azerbaijani translation, courtesy Metin Amiroff.
* po/sr.po: New Serbian translation, courtesy Aleksandar Jelenak.
* configure.in: Add az and sr to ALL_LINGUAS.
2004-02-17 Christophe Barbe <christophe@ufies.org>
* gphoto2/shell.c: Fixed shell_command_generator function
that was enough to only segfault on alpha.
2004-01-04 Christophe Barbe <christophe@ufies.org>
Patch by Terran Melconian <terran@consistent.org>:
* doc/gphoto2.1: The --camera option is silently ignored without the
--port option.
2003-12-11 Lutz Mueller <lutz@users.sourceforge.net>
Patch by Andreas Burmester <a.burmester@hamburg.de>:
* gphoto2/gp-params.c: Only use 79 columns so that the screen doesn't
get messed up on terminals with 80 columns and line wrap.
2003-12-09 Hubert Figuiere <hfiguiere@teaser.fr>
* configure.in: required version is 2.1.2 because of gp_library_version
2003-10-27 Lutz Mueller <lutz@users.sourceforge.net>
* gphoto2/main.c: Make mkdir and rmdir do what they are supposed to
do. Reported by Marek Kassur <marco@bpmok.waw.pl>.
2003-10-14 Colin Marquardt <colin@marquardt-home.de>
* po/ro.po: New romanian translation courtesy Laurentiu Buzdugan.
* configure.in: Add ro to ALL_LINGUAS.
2003-09-09 Colin Marquardt <colin@marquardt-home.de>
* po/cs.po: New slovak translation courtesy Andrej Kacian.
* configure.in: Add sk to ALL_LINGUAS.
2003-09-01 Hubert Figuiere <hfiguiere@teaser.fr>
* gphoto2/main.c (save_camera_file_to_file): call fflush();
See <https://sourceforge.net/tracker/?func=detail&atid=358874&aid=798071&group_id=8874>
2003-08-24 Lutz Mueller <lutz@users.sourceforge.net>
* gphoto2/actions.c: Fix off-by-one bug (closes #729791).
2003-08-22 Hubert Figuiere <hfiguiere@teaser.fr>
* gphoto2/actions.c (action_camera_show_abilities): Display that
capture is not supported by the driver instead of an empty string
to fix bug 642394
<https://sf.net/tracker/index.php?func=detail&aid=642394&group_id=8874&atid=108874>
2003-06-22 Christophe Barbe <christophe@ufies.org>
* gphoto2/main.c, po/*.po:
s/gphoto-devel@gphoto.org/gphoto-devel@lists.sourceforge.net/
2003-05-17 Hans Ulrich Niedermann <gp@n-dimensional.de>
* configure.in: 2.1.2dev6, with CVS tags
* configure.in: 2.1.2dev7, without CVS tags, for development
2003-05-04 Colin Marquardt <colin@marquardt-home.de>
* po/cs.po: New translation courtesy Miloslav Trmac.
* configure.in: Add cs to ALL_LINGUAS.
2003-03-03 Colin Marquardt <colin@marquardt-home.de>
* po/da.po: New translation/update.
2003-02-20 Lutz Mueller <lutz@users.sourceforge.net>
* gphoto2/main.c: Small date/time related fix by
Ralph Corderoy <ralph@inputplus.co.uk>.
2003-02-01 Patrick Mansfield <patmans@users.sourceforge.net>
* foreach.c: Change the CR and CL macro to use "__r" versus "r",
so the result we want to actually check is not hidden by a new
declaration of 'r'. Specifically for_each_file_in_range never
noticed an error of GP_ERROR_NOT_SUPPORTED. actions.c and
shell.c have no problem (i.e. they don't use the variable 'r' in
any functions).
2002-11-08 Hans Ulrich Niedermann <gp@n-dimensional.de>
* configure.in: 2.1.1dev7
* gphoto2/version.[ch]: added: version/feature reporting mechanism
* gphoto2/Makefile.am: added version.[ch]
* gphoto2/actions.c: added version/feature reports
2002-11-06 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c:
* gphoto2/actions.[c,h]: Print some information on the build options
when --debug.
2002-11-06 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/foreach.c (for_each_file_in_range: Supply the correct
folder.
2002-11-05 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/actions.c:
* gphoto2/foreach.c:
* gphoto2/main.c: While trying to hunt down a bug: Initialize some
variables, set them to NULL after free, etc.
2002-11-04 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/foreach.c: Fix for-loop.
2002-11-03 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/actions.h: Fix typo in comment.
2002-11-03 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/options.[c,h]:
* gphoto2/main.c: Make --without-popt compile again.
2002-11-03 Mark McLoughlin <mark@skynet.ie>
* gphoto2/foreach.c: (for_each_file): actually recurse into the
sub-folder.
2002-10-18 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c:
* gphoto2/gp-param.h: force -> force_overwrite.
2002-10-17 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/gp-params.[c,h]: New. Simplifies passing around parameters.
* gphoto2/main.c: New --force parameter.
* gphoto2/foreach.[c,h]:
* gphoto2/actions.[c,h]: Adjust to above changes.
2002-10-08 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/actions.c: "!result" should have been "result < 0". I
apologize.
2002-10-08 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c: Only show instructions on how to get debugging
messages if --debug has not been used.
2002-10-08 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c: Additional debugging messages in order to prepare
fixing the introduced bugs.
2002-10-03 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c: Kill warning.
2002-10-03 Lutz Müller <lutz@users.sourceforge.net>
* configure.in: Require libgphoto2-2.1.1.
* gphoto2/main.c: Create the context before the abilities list.
2002-10-03 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c: Don't call gp_cmd_config #ifndef HAVE_CDK.
2002-09-29 Lutz Müller <lutz@users.sourceforge.net>
* configure.in: Use popt.h if available.
* gphoto2/*: Use popt.h if available.
2002-09-12 Hans Ulrich Niedermann <gp@n-dimensional.de>
* configure.in: 2.1.1dev6
* Makefile.am: create .tar.bz2 dists again
2002-08-08 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c: '%n' should work now for non-root folders, too.
2002-08-08 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c: Add %f for filename without suffix.
2002-08-08 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c: tm->tm_wday starts with 0.
2002-08-07 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c: Add %C (filename suffix).
2002-08-07 Lutz Müller <lutz@users.sourceforge.net>
* gphoto2/main.c: Let users specify %A, %y, etc. in --filename.
2002-08-01 Hans Ulrich Niedermann <gp@n-dimensional.de>
* Makefile.am:
* doc/Makefile.am:
* configure.in: added doc/ directory
2002-07-31 Hans Ulrich Niedermann <gp@n-dimensional.de>
* autogen.sh: patch from Arnaud Launay: check for pkg-config
2002-07-30 Hans Ulrich Niedermann <gp@n-dimensional.de>
* gphoto2/main.c: moved away code for --print-usb-usermap
* configure.in: 2.1.1 -> 2.1.1dev4
* .cvsignore: added everything created by build and unknown to CVS
* gphoto2/.cvsignore: added everything created by build and unknown to CVS
* po/.cvsignore: added everything created by build and unknown to CVS
2002-07-29 Lutz Müller <lutz@users.sourceforge.net>
* README: The first few lines.
2002-07-29 Lutz Müller <lutz@users.sourceforge.net>
gphoto2 is now functional.
2002-07-28 Lutz Müller <lutz@users.sourceforge.net>
Initial setup.

7
lib/hardware/sensors/gphoto/gphoto2-master/Makefile.am

@ -0,0 +1,7 @@
SUBDIRS = gphoto-m4 contrib doc gphoto2 packaging po tests
ACLOCAL_AMFLAGS = -I auto-m4 -I gphoto-m4
EXTRA_DIST = README.md
README: $(srcdir)/README.md
cp $(srcdir)/README.md README

269
lib/hardware/sensors/gphoto/gphoto2-master/NEWS

@ -0,0 +1,269 @@
gphoto2 2.5.20.1 development
---------------------------------------------------------------------------------
gphoto2 2.5.20 release
* maximum number in file ranges bumped from 16384 to 65536
* add shell commands to match commandline: summary, storage-info, trigger-capture
* fixed a fd leak
* translations: updated simplified chinese
gphoto2 2.5.17 release
* handle GP_EVENT_FILE_CHANGED event
gphoto2 2.5.15 release
* In the config getters, print out the Readonly flag and also an END marker
* Fixed "now" timesetting also for set-config-value
gphoto2 2.5.14 release
* translation updates: french, esperanto
* some bugfixes
* (2.5.12 and 2.5.13 were skipped due to insufficient changes)
gphoto2 2.5.11 release
* some errors result in exit 0, where it should have been an error exit
* some windows bugfixes
* translation updates: icelandic
gphoto2 2.5.10 release
* use new single configuration set/get if possible
* updated translations: serbian, russian, hungarian, vietnamese, ukrainian, polish, swedish, brazilian portuguese
* require libgphoto2 2.5.10 or newer
gphoto2 2.5.9 release
Now maintained (source and issue tracker) in GIT at https://github.com/gphoto/gphoto2
* Added testcamera.pl, a tool for testing attached cameras with gphoto2.
* fixed some bugs
* report trigger capture in --ability
* capture-preview can honor filename and prefixes
* updated translations: french, ukrainian, vietnamese, polish, russian, italian
gphoto2 2.5.8 release
* --keep-raw option added, which leaves non-JPEG files on camera during
capture or wait-event-and-download
* --show-preview option split out of --capture-preview. --show-preview
now displays the ascii art preview, --capture-preview no longer does.
* updated translations: french, ukrainian, vietnamese, russian, polish,
dutch, hungarian, esperanto, serbian, danish
gphoto2 2.5.6
* --wait-event / --wait-event-and-download can now wait for strings
--wait-event=CAPTURECOMPLETE
--wait-event=FILEADDED
--wait-event="Property 5001"
* updated translations: french, ukrainian, dutch, polish, russian, vietnamese, hungarian, serbian
gphoto2 2.5.5
* manpage updated
* updated translations
* bugfix for DST usage in handling date/time widgets
* adjusted wait time heuristics after capture
* --debug-loglevel=(debug|verbose|data|all) option added to select debug verbosity
* fixed --filename with cross-device usage
gphoto2 2.5.4
* --skip-existing option that skips if a local file would already exist
* %F for foldername inclusion added to format strings for --filename
* add the commandline arguments to the debug log
gphoto2 2.5.3
* translations updated: dutch, polish, ukrainian, russian, taiwanese
* small --show-info bugfix
gphoto2 2.5.2
* new --reset option to reset usb devices.
* using --filename, if the camera reports 1. Jan 1970, fall back to
use the current date/time.
* translations updated: french, polish, vietnamese, russian, simplified chinese, danish
gphoto2 2.5.1
* Fixed that the meaning of --keep and --no-keep was switched.
* Allow passing absolute filenames to
-p, -d, -r/--rmdir, -m/--mkdir, -t, --show-info, --get-metadata,
--get-raw-data, --get-audio-data,
like e.g.:
gphoto2 -p /store_00010001/DCIM/100D7000/DSC_0001.JPG
* -L --quiet now prints a list of all files, 1 per line.
* -l --quiet now prints a list of all folders, 1 per line.
gphoto2 2.5.0
* Added "--keep" and "--no-keep" options for capture tethered
and capture image.
* --wait-event and --capture-tethered can now do:
* nr of events (200)
* seconds (100s)
* milliseconds (200ms) (1/1000 of a second)
* frames (50f) (number of images)
* New --list-all-config gives the full config tree.
gphoto2 2.4.99.2
* Updated for new GPPortInfo in libgphoto2 2.5.0
* Updated for various changed file interfaces in libgphoto2 2.5.0
* Capture mainloop changed to handle JPEG+RAW capture (one release
resulting in 1 or more files).
(Also: refactored and rewritten to be more beautiful)
* Capture mainloop uses trigger capture + waitevent if present.
* Fixed use-after-free problem in file save
* Fixed %n to use an incremental counter, instead of a filesystem index.
gphoto2 2.4.10.1
* Switched %n behaviour to be linear increasing, instead of
a folder index.
gphoto2 2.4.10
* Event loop handling non-waitevent able cameras.
* --capture-movie (optional arguments: frames, or seconds)
now loops over preview capture as fast as possible
and writes the frames continously.
The resulting file is "MotionJPEG" and can be postprocessed
or displayed (by mplayer).
Also output to stdout is possible for pipeing like:
gphoto2 --stdout --capture-movie | someotherprogram
gphoto2 2.4.9
* Capture main event loop rewritten to always use wait event
to also support multiple image captures. (JPEG+RAW)
* Fixed various bugs and memory leaks.
* Translation updates.
gphoto2 2.4.8
* Output CAPTURECOMPLETE on waitevent
* On --filename "foo/bar/berk.jpg" create subdirectories if
not yet present.
* New shell command:
capture-preview
* Added Bulb Mode in interval capture with -B / --bulb <seconds>
gphoto2 2.4.7
* New cmdline options: --set-config-index and --set-config-value
to avoid ambiguity of the --set-config supporting both modes.
* --wait-event can take "5s" as argument for 5 seconds of event taking
* added --wait-event-and-download=x (same as --wait-event but with download)
* New shell commands:
wait-event (events or seconds)
wait-event-and-download (events or seconds)
capture-tethered
set-config-index entry=choiceindex
set-config-value entry=value
* Enhanced --quietness.
* Added AC_SYS_LARGEFILE, enabling support to download files > 2GB.
* Updated translations.
* Various bugfixes.
gphoto2 2.4.5
* Updated translations.
* Handle ctrl-c on tethered capture.
gphoto2 2.4.4
* Updated translations.
* SIGUSR2 added ... "exit interval capture after next shot"
gphoto2 2.4.3
* Updated translations.
* For multiple cameras, specifying with --port usb:xxx,yyy is now
sufficient (previously needed --port and --camera).
gphoto2 2.4.2
* Updated translations.
* Major change in behaviour:
--capture-image split into:
--capture-image : Just captures image, no download.
--capture-image-and-download : captures image and downloads it.
gphoto2 2.4.1
* Made capture preview that saves to files work
* capture-image has no arguments
* version check for libgphoto2 fixed
* cs,da,it,vi translations updated
* Fix a few C99isms.
gphoto2 2.4.0
* Add contrib/ directory with scripts and things contributed by users.
* Ditched autogen.sh, use standard autoreconf from stock autoconf.
* Put auto* files into auto-aux/ and auto-m4/.
* New --storage-info function to get direct storage information
from the camera via API.
* Use SIGUSR1 to trigger premature image capture in --interval mode.
* New --reset-interval parameter makes SIGUSR1 reset the capture interval.
* New --capture-tethered command to wait for presses of the camera shutter
button and download. Confirmed working only with Nikon DSC.
gphoto2 2.3.1
FIXME: Update this list from 2.3.1 release.
* Added --hook-script option, including man page update and test-hook.sh.
* Fix: --get-all-metadata takes no argument.
* Use the "UNIX fd" based CameraFile handling code for downloading and uploading
files, without using system memory.
FIXME: For a release, do require a libgphoto2 version with the
proper version number at compile time, and/or check linking
with that function.
gphoto2 2.3.0
* Require popt library to parse command line options.
* Partitioned command line options into groups of related options.
* Added --debug-logfile=FILENAME option.
* Only load all camlibs if necessary.
* (Half-)Fix to make --with-libgphoto2=PREFIX configure parameter work.
* Preliminary support for lower-case filenames in --filename pattern: %:
* Added "rmdir" command to gphoto2 --shell.
gphoto2 2.2
* Some speed-ups by avoiding to load
list of ports/cameras multiple times.
* More --shell commands added:
put, rmdir, mkdir, configuration, capture
* Metadata down and upload added.
* Waiting for events added.
gphoto2 2.2.0.trunk
* Option --debug-logfile=FILENAME added.
* Options grouped for a little structure in --help output.
gphoto2 2.1.99
* Requires libgphoto2 2.1.99 to build
* Various new translations
gphoto2 2.1.6

43
lib/hardware/sensors/gphoto/gphoto2-master/README.md

@ -0,0 +1,43 @@
# gphoto2
## What is gphoto2?
gphoto2 is a command-line frontend to libgphoto2.
## Where can I find more information?
Visit the gphoto project web site. It should always be found at least
at one of the following URLs:
- http://www.gphoto.com/
- http://www.gphoto.org/
- http://gphoto.sourceforge.net/
- https://github.com/gphoto/
- http://sf.net/projects/gphoto
The man page is in the file doc/gphoto2.1
## How do I build it?
```
autoreconf -is #If using SVN source
configure
make
make install
```
Out-of-tree builds are supported. `configure --help` may help.
To build gphoto2 you will need besides the common build tools:
- The libgphoto2 library.
- The popt libraries (for commandline option handling), package named popt-devel or popt-dev
Optional:
- The EXIF library. (libexif-devel, libexif-dev or similar)
- The JPEG library. (libjpeg-devel, libjpeg-dev, or jpeg-dev or similar)
- The CDK library (for ncurses based configuration UI). (cdk-devel or similar)
- The AALIB library (for ascii art rendering of previews). (aalib-devel or similar)
## How do I test it?
```
make check
```
The test suite checks the installation and basic functionality of the gphoto2
program and the 'Directory Browse' libgphoto2 camera driver.

15
lib/hardware/sensors/gphoto/gphoto2-master/TODO

@ -0,0 +1,15 @@
some orthogonalization of the options:
- unify frame count handling
use --frames / -F for both controlled capture and waitevents?
- download or not download flag
introduce --download / --no-download flag?
both for --capture-image and --wait-event
- --list-ids
to list USB ids

427
lib/hardware/sensors/gphoto/gphoto2-master/configure.ac

@ -0,0 +1,427 @@
AC_PREREQ(2.59)
dnl Next stable release must be 2.5.21 or later
AC_INIT([gphoto2 command line interface], [2.5.20.1], [gphoto-devel@lists.sourceforge.net], [gphoto2])
AC_CONFIG_SRCDIR([gphoto2/main.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([auto-m4])
AC_CONFIG_AUX_DIR([auto-aux])
AM_INIT_AUTOMAKE([-Wall -Werror gnu 1.9 dist-bzip2 check-news])
if test ! -d "$srcdir/gphoto-m4"; then
AC_MSG_ERROR([
You are missing the gphoto-m4/ directory in your top
$PACKAGE_TARNAME source directory.
copying it from the gphoto/gphoto-m4 github repository
and re-running autogen.sh might help.
])
fi
GP_CHECK_SHELL_ENVIRONMENT
GP_CONFIG_MSG([Build])
GP_CONFIG_MSG([Source code location],[${srcdir}])
AM_CPPFLAGS=""
AM_LDFLAGS=""
dnl ---------------------------------------------------------------------------
dnl Some programs we need
dnl ---------------------------------------------------------------------------
AC_PROG_CC
AC_PROG_CPP
AM_PROG_CC_C_O
m4_pattern_allow([AM_PROG_AR], [AM_PROG_AR])
AM_PROG_LIBTOOL
AC_PROG_INSTALL
AC_SYS_LARGEFILE
GP_CONFIG_MSG([Compiler],[${CC}])
AC_DEFINE_UNQUOTED([HAVE_CC],"$CC",[The C compiler we're using])
dnl AC_STRUCT_TIMEZONE
GP_CONFIG_MSG([Features])
# ----------------------------------------------------------------------
# References to external resources (web sites, mailing listes, etc.)
# ----------------------------------------------------------------------
GP_REFERENCES()dnl
dnl ---------------------------------------------------------------------------
dnl i18n support
dnl ---------------------------------------------------------------------------
GP_GETTEXT_HACK([],[Lutz Müller and others],[${MAIL_GPHOTO_TRANSLATION}])
ALL_LINGUAS="az cs da de en_GB es eu fi fr hu id is it ja nl pa pl pt_BR ro ru rw sk sr sv uk vi zh_CN zh_TW"
AM_GNU_GETTEXT_VERSION([0.14.1])
AM_GNU_GETTEXT([external])
AM_PO_SUBDIRS()
AM_ICONV()
GP_GETTEXT_FLAGS()
dnl We cannot use AC_DEFINE_UNQUOTED() for these definitions, as
dnl we require make to do insert the proper $(datadir) value
AC_SUBST([localedir],["\$(datadir)/locale"])
AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\""
dnl ---------------------------------------------------------------------------
dnl Check for libgphoto2
dnl ---------------------------------------------------------------------------
GP_CHECK_LIBRARY([LIBGPHOTO2], [libgphoto2], [>= 2.5.17])
AC_CHECK_FUNCS([strptime])
AC_CHECK_FUNCS([signal pause sleep])
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h process.h signal.h sys/time.h sys/wait.h])
AC_CHECK_FUNCS([spawnve])
AC_CHECK_LIB(m,floor)
dnl ---------------------------------------------------------------------------
dnl pthread: The gphoto2 shell (--shell) keeps up a connection to the
dnl camera. Some cameras need to be sent keep-alive-messages
dnl in order to prevent a shut-down. This is what we need
dnl pthread for.
dnl ---------------------------------------------------------------------------
pthread_msg=no
try_pthread=:
AC_ARG_WITH(pthread, [ --without-pthread Don't use pthread],
if test x$withval = xno; then
try_pthread=false
fi)
if $try_pthread; then
AC_CHECK_HEADER(pthread.h, [
AC_CHECK_LIB(pthread, pthread_exit, [
AC_DEFINE(HAVE_PTHREAD,1,[Define if we use pthread.h.])
pthread_msg="yes (-lpthread)"
PTHREAD_LIBS="-lpthread"],[
AC_CHECK_LIB(c_r, pthread_create, [
AC_DEFINE(HAVE_PTHREAD,1,[Define if we use pthread.h.])
pthread_msg="yes (-pthread)"
PTHREAD_LIBS="-pthread"
])
])
])
fi
AC_SUBST([PTHREAD_LIBS])
GP_CONFIG_MSG([pthread support],[$pthread_msg])
dnl ---------------------------------------------------------------------------
dnl CDK: If you would like to interactively access the camera's configuration
dnl using gphoto2, the command-line frontend, you need CDK. For pure
dnl command-line access to the config, you don't need CDK, though.
dnl Old versions of CDK don't include fscale, therefore check for it here.
dnl ---------------------------------------------------------------------------
cdk_msg="no (http://dickey.his.com/cdk/cdk.html)"
try_cdk=:
have_cdk=false
AC_ARG_WITH([cdk],AS_HELP_STRING([--without-cdk],[Do not use cdk]), [
if test x$withval = xno; then
try_cdk=false
cdk_msg="no (not requested)"
fi
])
cdk_prefix=$ac_default_prefix
AC_ARG_WITH([cdk-prefix],AS_HELP_STRING([--with-cdk-prefix=PREFIX],
[Location of cdk]), [
cdk_prefix="$withval"
])
if $try_cdk; then
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="-I$cdk_prefix/include $CPPFLAGS"
AC_CHECK_HEADER([cdk/cdk.h], [
have_cdk=:
AC_PATH_PROG([CDK_CONFIG], [cdk5-config])
if test -n "${CDK_CONFIG}"; then
CDK_CFLAGS=`$CDK_CONFIG --cflags`
CDK_LIBS=`$CDK_CONFIG --libs`
else
CDK_CFLAGS="-I$cdk_prefix/include"
CDK_LIBS="-L$cdk_prefix/lib -lcdk -lncurses"
fi
AC_DEFINE([HAVE_CDK],1,[whether we have CDK])
LDFLAGS_save="$LDFLAGS"
LDFLAGS="$CDK_LIBS"
AC_CHECK_LIB([cdk], [newCDKFScale], [cdk_msg="yes"], [
AC_DEFINE([HAVE_CDK_20010421],1,
[whether we have old CDK])
cdk_msg="yes (but without fscale)"
])
LDFLAGS="$LDFLAGS_save"
])
CPPFLAGS="$CPPFLAGS_save"
fi
AM_CONDITIONAL([HAVE_CDK], [$have_cdk])
AC_SUBST([CDK_CFLAGS])
AC_SUBST([CDK_LIBS])
GP_CONFIG_MSG([Interactive config support],[$cdk_msg])
dnl We emulate signals in Windows
dnl This is taken from: https://github.com/OpenVPN/openvpn/blob/master/configure.ac
AC_CHECK_DECLS(
[SIGHUP],
,
[AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
)
AC_CHECK_DECLS(
[SIGINT],
,
[AC_DEFINE([SIGINT], [2], [SIGINT replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
)
AC_CHECK_DECLS(
[SIGUSR1],
,
[AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
)
AC_CHECK_DECLS(
[SIGUSR2],
,
[AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
)
AC_CHECK_DECLS(
[SIGTERM],
,
[AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
)
dnl ---------------------------------------------------------------------------
dnl libjpeg: Right now, libjpeg is only used to interpret JPEG previews in
dnl order to feed them to aalib (see below).
dnl ---------------------------------------------------------------------------
jpeg_msg=no
try_jpeg=:
have_jpeg=false
AC_ARG_WITH([jpeg],AS_HELP_STRING([--without-jpeg],[Do not use jpeg]),[
if test x$withval = xno; then
try_jpeg=false
jpeg_msg="no (not requested)"
fi
])
jpeg_prefix=$ac_default_prefix
AC_ARG_WITH(jpeg-prefix, AS_HELP_STRING([--with-jpeg-prefix=PREFIX],
[Location of jpeg]), [
jpeg_prefix="$withval"
])
if $try_jpeg; then
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="-I$jpeg_prefix/include"
AC_CHECK_HEADER([jpeglib.h], [
AC_CHECK_LIB([jpeg], [jpeg_read_scanlines], [
have_jpeg=:
jpeg_msg="yes"
AC_DEFINE([HAVE_JPEG],1,[whether we use libjpeg])
JPEG_LIBS="-ljpeg"
JPEG_CFLAGS=$CPPFLAGS
], [
LDFLAGS_save="$LDFLAGS"
LDFLAGS="-L$jpeg_prefix/lib"
AC_CHECK_LIB([jpeg], [jpeg_stdio_src], [
have_jpeg=:
jpeg_msg="yes (in '$jpeg_prefix')"
AC_DEFINE([HAVE_JPEG],1,
[whether we use libjpeg])
JPEG_LIBS="-L$jpeg_prefix/lib -ljpeg"
JPEG_CFLAGS=$CPPFLAGS
], [
jpeg_msg="no (could not link)"
])
LDFLAGS=$LDFLAGS_save
])
])
CPPFLAGS="$CPPFLAGS_save"
fi
AM_CONDITIONAL([HAVE_JPEG], [$have_jpeg])
AC_SUBST([JPEG_LIBS])
AC_SUBST([JPEG_CFLAGS])
GP_CONFIG_MSG([JPEG support],[$jpeg_msg])
dnl ---------------------------------------------------------------------------
dnl libexif: The CameraFilesystem can use libexif for extracting thumbnails
dnl out of EXIF data. Similarly, it can extract the mtime of
dnl a file.
dnl libexif is available from
dnl http://www.sourceforge.net/projects/libexif
dnl ---------------------------------------------------------------------------
GP_CHECK_LIBRARY([LIBEXIF],[libexif],[>= 0.3.2],
[libexif/exif-data.h],[exif_data_new],[
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="${LIBEXIF_CFLAGS}"
AC_CHECK_HEADER([libexif/exif-log.h], [
AC_DEFINE([HAVE_LIBEXIF_LOG],1,
[whether libexif has exif-log.h (>= 0.6.9)])dnl
])
AC_CHECK_HEADER([libexif/exif-ifd.h], [
AC_DEFINE([HAVE_LIBEXIF_IFD],1,
[whether libexif has exif-ifd.h (>= 0.5.3)])dnl
])
CPPFLAGS="$CPPFLAGS_save"
],[],[default-on])
dnl ---------------------------------------------------------------------------
dnl aalib: gphoto2 (the frontend) has been designed as a command-line tool.
dnl However, live previews make only sense when you can actually
dnl see the preview. This is where aalib fits in - it gives you the
dnl possibility to view live previews on any console.
dnl ---------------------------------------------------------------------------
aa_msg="no (http://www.sourceforge.net/projects/aa-project)"
try_aa=:
have_aa=false
AC_ARG_WITH([aalib],AS_HELP_STRING([--with-aalib],[Do use aalib for preview ASCII rendering]),[
if test x$withval = xno; then
try_aa=false
aa_msg="no (not requested)"
fi
])
if $try_aa; then
AC_CHECK_HEADER([aalib.h],[
have_aa=:
aa_msg=yes
AC_DEFINE([HAVE_AA], [1], [whether we use aalib])
AC_PATH_PROG([AALIB_CONFIG], [aalib-config])
if test -n "${AALIB_CONFIG}"; then
AA_CFLAGS=`$AALIB_CONFIG --cflags`
AA_LIBS=`$AALIB_CONFIG --libs`
else
AA_LIBS="-laa"
fi
])
fi
AM_CONDITIONAL([HAVE_AA], [$have_aa])
AC_SUBST([AA_LIBS])
AC_SUBST([AA_CFLAGS])
GP_CONFIG_MSG([Text preview support],[$aa_msg])
dnl ---------------------------------------------------------------------------
dnl popt.h: Simplifies handling of command-line options enormously.
dnl ---------------------------------------------------------------------------
GP_CHECK_POPT([mandatory])
dnl ---------------------------------------------------------------------------
dnl readline: Readline is pretty cool - it allows you to use <tab> to complete
dnl commands in the gphoto2 shell or to use <up> or <down> to
dnl navigate through the history.
dnl ---------------------------------------------------------------------------
rl_msg="no (http://cnswww.cns.cwru.edu/~chet/readline/rltop.html)"
try_readline=:
have_readline=false
AC_ARG_WITH([readline],AS_HELP_STRING([--without-readline],
[Do not use readline]),[
if test "x${withval}" = "xno"; then
try_readline=false
rl_msg="no (not requested)"
fi
])
if $try_readline; then
AC_CHECK_HEADER([readline/readline.h], [
AC_CHECK_LIB([readline], [rl_completion_append_character], [
AC_CHECK_LIB([readline], [rl_completion_matches], [
have_readline=:
rl_msg="yes (doesn't require explicit -lncurses)"
RL_LIBS="-lreadline"
RL_CFLAGS=""
AC_DEFINE([HAVE_RL], [1], [whether we use readline])
], [
rl_msg="no (available version too old)"
])
], [
LDFLAGS_save="$LDFLAGS"
LDFLAGS="-lncurses"
AC_CHECK_LIB([readline], [rl_completion_matches], [
have_readline=:
rl_msg="yes (requires explicit -lncurses)"
RL_LIBS="-lreadline -lncurses"
RL_CFLAGS=""
AC_DEFINE(HAVE_RL,1,[whether we use readline])
], [
rl_msg="no (couldn't link against it or version too old)"
])
LDFLAGS="$LDFLAGS_save"
])
])
fi
AM_CONDITIONAL([HAVE_RL], [$have_readline])
AC_SUBST([RL_LIBS])
AC_SUBST([RL_CFLAGS])
GP_CONFIG_MSG([Readline support], [$rl_msg])
dnl ---------------------------------------------------------------------------
dnl Turn on all warnings when using gcc
dnl ---------------------------------------------------------------------------
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -Wall"
CFLAGS="$CFLAGS -Wmissing-declarations -Wmissing-prototypes"
# FIXME: Check for --enable-debug here
CFLAGS="$CFLAGS -g"
LDFLAGS="$LDFLAGS -g"
fi
AM_CPPFLAGS="$AM_CPPFLAGS -D_GPHOTO2_INTERNAL_CODE"
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_LDFLAGS])
# ---------------------------------------------------------------------------
# Create output files
# ---------------------------------------------------------------------------
AC_CONFIG_FILES([
po/Makefile.in
Makefile
gphoto2/Makefile
gphoto-m4/Makefile
doc/Makefile
contrib/Makefile
packaging/Makefile
packaging/rpm/Makefile
packaging/rpm/package.spec
tests/data/Makefile
tests/staging/subdir1/Makefile
tests/staging/subdir2/Makefile
tests/staging/Makefile
tests/Makefile
])
AC_OUTPUT()dnl
# Status output
GP_CONFIG_OUTPUT

7
lib/hardware/sensors/gphoto/gphoto2-master/contrib/Makefile.am

@ -0,0 +1,7 @@
CLEANFILES =
EXTRA_DIST =
# EXTRA_DIST += subdir/file.txt
include multi-capture/Makefile-files
include simple-mtpupload/Makefile-files

24
lib/hardware/sensors/gphoto/gphoto2-master/contrib/README

@ -0,0 +1,24 @@
========================================================================
Contributed scripts, docs, etc.
========================================================================
In this directory, you can find scripts and other things contributed by
users. They may be useful as they are, they may need some work to be use-
ful for you, or they may not help you at all... you'll have to judge them
yourself.
You can see a list of contributions with a short summary below.
multi-capture/
Alesan's scripts and stuff which captures from four cameras
simultanously.
simple-mtpupload/
Marcus script to upload MP3s +metadata to a MTP player.
Needs external MP3::Info perl module (from CPAN for instance).
========================================================================
End of file.
========================================================================

3
lib/hardware/sensors/gphoto/gphoto2-master/contrib/multi-capture/Makefile-files

@ -0,0 +1,3 @@
# -*- Makefile -*-
# EXTRA_DIST += %reldir%/foo.sh

3
lib/hardware/sensors/gphoto/gphoto2-master/contrib/simple-mtpupload/Makefile-files

@ -0,0 +1,3 @@
# -*- Makefile -*-
EXTRA_DIST += %reldir%/uploadmp3s.pl

113
lib/hardware/sensors/gphoto/gphoto2-master/contrib/simple-mtpupload/uploadmp3s.pl

@ -0,0 +1,113 @@
#!/usr/bin/perl
#
# Uploads MP3s from current directory, recursively.
# Optional arguments can be directories.
#
use File::Basename;
use MP3::Info qw(:DEFAULT :utf8);
if ($ENV{'LANG'} =~ /utf-8/i) {
use_mp3_utf8();
}
foreach $dir (@ARGV) {
push @dirs,`find $dir -type d`;
}
if ($#dirs < 0) {
@dirs = `find . -type d`;
}
chomp @dirs;
#AudioWAVECodec Track OriginalReleaseDate SampleRate AudioBitDepth
sub escape {
my ($txt) = @_;
return $txt;
}
sub dump_tags {
my ($file) = @_;
my $key;
my $metafn;
my $tinfo = get_mp3tag($file);
my %tmap = %{$tinfo};
#foreach $key (keys %tmap) { print STDERR "$key -> " . $tmap{$key} . "\n"; }
my $finfo = get_mp3info($file);
my %fmap = %{$finfo};
#foreach $key (keys %fmap) { print STDERR "$key -> " . $fmap{$key} . "\n"; }
$metafn = $file;
$metafn =~ s/.*\/([^\/]*)$/meta_$1/;
open(META,">$metafn") || die "$metafn:$!\n";
if (defined($tmap{TITLE}) && $tmap{TITLE} ne "") {
print META "<Name>" . escape($tmap{TITLE}) . "</Name>\n";
}
if (defined($tmap{ARTIST}) && $tmap{ARTIST} ne "") {
print META "<Artist>" . escape($tmap{ARTIST}) . "</Artist>\n";
}
if (defined($tmap{ALBUM}) && $tmap{ALBUM} ne "") {
print META "<AlbumName>" . escape($tmap{ALBUM}) . "</AlbumName>\n";
}
if (defined($tmap{GENRE}) && $tmap{GENRE} ne "") {
print META "<Genre>" . escape($tmap{GENRE}) . "</Genre>\n";
}
if ($tmap{STEREO} == 1) {
print META "<NumberOfChannels>2</NumberOfChannels>\n";
} elsif ($tmap{STEREO} == 0) {
print META "<NumberOfChannels>1</NumberOfChannels>\n";
} else {
# default stereo
print META "<NumberOfChannels>2</NumberOfChannels>\n";
}
if (defined($fmap{SECS})) {
# in milliseconds
printf META "<Duration>%d</Duration>\n",$fmap{SECS}*1000;
}
if (defined($fmap{BITRATE})) {
printf META "<AudioBitRate>%d</AudioBitRate>\n",$fmap{BITRATE};
}
if (defined($fmap{FREQUENCY})) {
printf META "<SampleRate>%d</SampleRate>\n",$fmap{FREQUENCY}*1000;
}
close(META);
return $metafn;
}
%seendir = ();
foreach $dir (@dirs) {
$dir =~ s/^\.\///;
@files = `find '$dir' -maxdepth 1 -name "*.mp3"`;
chomp @files;
next unless (@files > 0);
@dircomp = split(/\//,$dir);
$xdir = "";
foreach $subdir (@dircomp) {
$parentdir = $xdir;
if ($xdir eq "") {
$xdir .= "$subdir";
} else {
$xdir .= "/$subdir";
}
next if ($seendir{$xdir});
system("gphoto2 -f '/store_00010001/Music/$parentdir' --mkdir '$subdir'");
# print "gphoto2 -f '/store_00010001/Music/$parentdir' --mkdir '$subdir'\n";
$seendir{$xdir} = 1;
}
$uploadline = " -f '/store_00010001/Music/$dir'";
foreach $file (@files) {
$metafn = dump_tags($file);
$uploadline .= " -u \'" . $file . "\'";
if ($metafn) {
push @metas, $metafn;
$uploadline .= " --upload-metadata \'" . $metafn . "\'";
}
}
system("gphoto2 $uploadline");
unlink(@metas);
}

2
lib/hardware/sensors/gphoto/gphoto2-master/doc/.cvsignore

@ -0,0 +1,2 @@
Makefile
Makefile.in

3
lib/hardware/sensors/gphoto/gphoto2-master/doc/Makefile.am

@ -0,0 +1,3 @@
man_MANS = gphoto2.1
EXTRA_DIST = gphoto2.1

929
lib/hardware/sensors/gphoto/gphoto2-master/doc/gphoto2.1

@ -0,0 +1,929 @@
'\" t
.\" Title: gphoto2
.\" Author: The gPhoto2 Team
.\" Generator: DocBook XSL Stylesheets v1.79.0 <http://docbook.sf.net/>
.\" Date: <pubdate>2015-08-01</pubdate>August 2006
.\" Manual: The gPhoto2 Reference (the man pages)
.\" Source: [FIXME: source]
.\" Language: English
.\"
.TH "GPHOTO2" "1" "<pubdate>2015-08-01</pubdate>August 2006" "[FIXME: source]" "The gPhoto2 Reference (the man"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
gphoto2 \- command\-line gphoto2 client
.SH "SYNOPSIS"
.HP \w'\fBgphoto2\fR\ 'u
\fBgphoto2\fR [\-\-debug] [\-\-debug\-logfile\ \fIFILENAME\fR] [\-\-debug\-loglevel\ \fILEVEL\fR] [[\-q] | [\-\-quiet]] [[\-v] | [\-\-verbose]] [[\-h] | [\-\-help]] [\-\-usage]
.br
[\-\-hook\-script\ \fIFILENAME\fR]
.br
[\-\-list\-cameras] [\-\-list\-ports] [\-\-stdout] [\-\-stdout\-size]
.br
[\-\-auto\-detect] [\-\-port\ \fIPATH\fR] [\-\-speed\ \fISPEED\fR] [\-\-camera\ \fIMODEL\fR]
.br
[\-\-filename\ \fIFILENAME\fR]
.br
[\-\-usbid\ \fIUSBIDS\fR]
.br
[[\-a] | [\-\-abilities]]
.br
[[\-\-folder\ \fIFOLDER\fR] | [\-f\ \fIFOLDER\fR]] [[[\-R] | [\-\-recurse]] | [\-\-no\-recurse]]
.br
[[\-l] | [\-\-list\-folders]]
.br
[[\-L] | [\-\-list\-files]] [[\-m\ \fINAME\fR] | [\-\-mkdir\ \fINAME\fR]]
.br
[[\-r\ \fINAME\fR] | [\-\-rmdir\ \fINAME\fR]] [[\-n] | [\-\-num\-files]]
.br
[[\-p\ \fIRANGE\ or\ NAME\fR] | [\-\-get\-file\ \fIRANGE\ or\ NAME\fR]] [[\-P] | [\-\-get\-all\-files]]
.br
[[\-t\ \fIRANGE\ or\ NAME\fR] | [\-\-get\-thumbnail\ \fIRANGE\ or\ NAME\fR]]
.br
[[\-T] | [\-\-get\-all\-thumbnails]]
.br
[\-\-get\-raw\-data\ \fIRANGE\ or\ NAME\fR] [\-\-get\-all\-raw\-data]
.br
[\-\-get\-audio\-data\ \fIRANGE\ or\ NAME\fR] [\-\-get\-all\-audio\-data]
.br
[\-\-get\-metadata\ \fIRANGE\ or\ NAME\fR] [\-\-get\-all\-metadata] [\-\-upload\-metadata\ \fIFILENAME\fR]
.br
[\-\-force\-overwrite]
.br
[\-\-new]
.br
[[\-d\ \fIRANGE\ or\ NAME\fR] | [\-\-delete\-file\ \fIRANGE\ or\ NAME\fR]] [[\-D] | [\-\-delete\-all\-files]]
.br
[[\-u\ \fIFILENAME\fR] | [\-\-upload\-file\ \fIFILENAME\fR]] [\-\-config]
.br
[\-\-list\-config] [\-\-list\-all\-config]
.br
[\-\-get\-config\ \fICONFIGENTRY\fR] [\-\-set\-config\ \fICONFIGENTRY=CONFIGVALUE\fR] [\-\-set\-config\-index\ \fICONFIGENTRY=CONFIGINDEX\fR] [\-\-set\-config\-value\ \fICONFIGENTRY=CONFIGVALUE\fR] [\-\-reset]
.br
[\-\-capture\-preview] [\-\-show\-preview]
.br
[[\-F\ \fICOUNT\fR] | [\-\-frames\ \fICOUNT\fR]] [[\-I\ \fISECONDS\fR] | [\-\-interval\ \fISECONDS\fR]]
.br
[\-\-reset\-interval]
.br
[\-\-capture\-image] [\-\-trigger\-capture] [\-\-capture\-movie\ \fISECONDS\ or\ COUNT\fR] [\-\-capture\-sound]
.br
[\-\-capture\-tethered\ \fISECONDS,\ COUNT\ or\ STRING\fR]
.br
[\-\-wait\-event\ \fISECONDS,\ COUNT\ or\ STRING\fR] [\-\-wait\-event\-and\-download\ \fISECONDS,\ COUNT\ or\ STRING\fR]
.br
[\-\-keep] [\-\-no\-keep]
.br
[\-\-show\-info\ \fIRANGE\ or\ NAME\fR]
.br
[\-\-show\-exif\ \fIRANGE\ or\ NAME\fR]
.br
[\-\-storage\-info]
.br
[\-\-summary]
.br
[\-\-manual]
.br
[\-\-about]
.br
[\-\-shell]
.SH "DESCRIPTION"
.PP
libgphoto2(3)
is a cross\-platform digital camera library, and
gphoto2(1)
is a command\-line client for it\&.
.PP
Where an option takes a
\fIRANGE\fR
of files, thumbnails, or other data, they are numbered beginning at 1\&. A range is a comma\-separated list of numbers or spans (\(lq\fIfirst\fR\-\fIlast\fR\(rq)\&. Ranges are XOR (exclusive or), so that
\(lq1\-5,3,7\(rq
is equivalent to
\(lq1,2,4,5,7\(rq\&.
.PP
\fB\-\-debug\fR
.RS 4
Turn on debugging output\&. Debugging output is written to stderr by default, or to the filename given to the
\fB\-\-debug\-logfile\fR
option\&.
.RE
.PP
\fB\-\-debug\-logfile\fR \fIFILENAME\fR (since 2\&.3\&.0)
.RS 4
The logfile to write the debugging info to, if
\fB\-\-debug\fR
is given\&.
.RE
.PP
\fB\-\-debug\-loglevel\fR \fILEVEL\fR (since 2\&.5\&.5)
.RS 4
The verbosity of debug logging\&. Possible values with incrementing verbosity are:
\fBerror\fR,
\fBdebug\fR,
\fBdata\fR,
\fBall\fR\&. Default is
\fBall\fR\&.
.RE
.PP
\fB\-\-hook\-script\fR \fIFILENAME\fR (new after 2\&.3\&.0)
.RS 4
Execute the hook script
\fIFILENAME\fR
every time a certain event happens within
\fBgphoto2\fR\&. The hook script reads the environment variable
\fBACTION\fR\&. It must ignore
\fBACTION\fR
values unknown to it\&.
.PP
\fBACTION\fR=init
.RS 4
\fBgphoto2\fR
has just been initialized\&. If the hook script returns with a non\-zero exit code now,
\fBgphoto2\fR
will abort\&.
.RE
.PP
\fBACTION\fR=start
.RS 4
\fBgphoto2\fR
has just finished parsing the command line and is about to start executing the commands given on the command line\&.
.RE
.PP
\fBACTION\fR=download
.RS 4
\fBgphoto2\fR
has just downloaded a file to the computer, storing it in the file indicated by the environment variable
\fBARGUMENT\fR\&.
.RE
.PP
\fBACTION\fR=stop
.RS 4
\fBgphoto2\fR
is about to finish\&. Do your final cleanups here\&.
.RE
.sp
All other environment variables are passed to the hook script unchanged\&. You can make use of that to pass data to the hook script\&.
.sp
Hook script may be specified in the
~/\&.gphoto/settings
file as
\fBgphoto2=hook\-script=\fR\fIfilename\fR\&.
.RE
.PP
\fB\-q\fR, \fB\-\-quiet\fR
.RS 4
Quiet output (default=verbose)\&.
.RE
.PP
\fB\-v\fR, \fB\-\-version\fR
.RS 4
Display version and exit\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Display options and short description\&.
.RE
.PP
\fB\-\-usage\fR
.RS 4
Display a short usage message\&.
.RE
.PP
\fB\-\-list\-cameras\fR
.RS 4
List supported camera models\&.
.RE
.PP
\fB\-\-list\-ports\fR
.RS 4
List supported port devices\&.
.RE
.PP
\fB\-\-stdout\fR
.RS 4
Send file to stdout\&.
.RE
.PP
\fB\-\-stdout\-size\fR
.RS 4
Print filesize before data\&.
.RE
.PP
\fB\-\-auto\-detect\fR
.RS 4
List auto\-detected cameras and the ports to which they are connected\&.
.RE
.PP
\fB\-\-port\fR \fIPATH\fR
.RS 4
Specify port device\&. The
\fB\-\-list\-ports\fR
prints a list of valid, usable ports\&. In case of multiple USB cameras, the
\fB\-\-auto\-detect\fR
shows you the specific port each camera is connected to\&.
.RE
.PP
\fB\-\-speed\fR \fISPEED\fR
.RS 4
Specify serial transfer speed\&.
.RE
.PP
\fB\-\-camera\fR \fIMODEL\fR
.RS 4
Specify camera model\&. The
\fB\-\-list\-cameras\fR
option prints a list of all explicitly supported cameras\&.
.sp
Most model names contain spaces: remember to enclose the name in quotes so that the shell knows it is one parameter\&. For example:
\fB\fB\-\-camera\fR\fR\fB "Kodak DC240"\fR\&.
.sp
Note that if you specify
\fB\fB\-\-camera\fR\fR, you must also specify
\fB\fB\-\-port\fR\fR\&. Otherwise the
\fB\fB\-\-camera\fR\fR
option will be silently ignored\&.
.RE
.PP
\fB\-\-filename\fR \fIFILENAME\fR
.RS 4
When downloading files from the camera, specify the file name or file name pattern to use when storing the downloaded file on the local disk\&. When uploading a file to the camera, specify the filename to store the uploaded file as on the camera\&.
.sp
The
\fB\-\-filename\fR
option accepts %a, %A, %b, %B, %d, %H, %k, %I, %l, %j, %m, %M, %S, %y, %%, (see date(1)) and, in addition, %n for the number, %C for the filename suffix, %f for the filename without suffix, %F for the foldername, %: for the complete filename in lowercase\&.
.sp
Note that %: is still in alpha stage, and the actual character or syntax may still be changed\&. E\&.g\&. it might be possible to use %#f and %#C for lower case versions, and %^f and %^C for upper case versions\&.
.sp
%n is the only conversion specifier to accept a padding character and width: %03n will pad with zeros to width 3 (e\&.g\&. print the number 7 as
\(lq007\(rq)\&. Leaving out the padding character (e\&.g\&. %3n) will use an implementation specific default padding character which may or may not be suitable for use in file names\&.
.sp
Default value for this option can be specified in the
~/\&.gphoto/settings
file as
\fBgphoto2=filename=value\fR\&.
.RE
.PP
\fB\-\-usbid\fR \fI\fIUSBIDS\fR\fR
.RS 4
(Expert only) Override
USB
IDs\&.
\fI \fR\fI\fIUSBIDS\fR\fRmust be of the form
\fI \fR\fI\fIDetectedVendorID\fR\fR\fI:\fR\fI\fIDetectedProductID\fR\fR\fI=\fR\fI\fITreatAsVendorID\fR\fR\fI:\fR\fI\fITreatAsProductID\fR\fR
to treat any USB device detected as
\fI\fIDetectedVendorID\fR\fR\fI:\fR\fI\fIDetectedProductID\fR\fR
as
\fI\fITreatAsVendorID\fR\fR\fI:\fR\fI\fITreatAsProductID\fR\fR
instead\&. All the VendorIDs and ProductIDs should be hexadecimal numbers beginning in C notation, i\&.e\&. beginning with \*(Aq0x\*(Aq\&.
.sp
Example:
\fB\-\-usbid \fR\fB\fI0x4a9:0x306b=0x4a9:0x306c\fR\fR
.RE
.PP
\fB\-a\fR, \fB\-\-abilities\fR
.RS 4
Display the camera and driver abilities specified in the libgphoto2 driver\&. This all does not query the camera, it uses data provided by the library\&. Use
\fB\-\-summary\fR
to query an overview of the camera\&.
.RE
.PP
\fB\-f\fR, \fB\-\-folder\fR \fIFOLDER\fR
.RS 4
Specify camera folder (default="/")\&.
.RE
.PP
\fB\-R\fR, \fB\-\-recurse\fR
.RS 4
Recursion (default for download)\&.
.RE
.PP
\fB\-\-no\-recurse\fR
.RS 4
No recursion (default for deletion)\&.
.RE
.PP
\fB\-l\fR, \fB\-\-list\-folders\fR
.RS 4
List folders in folder\&.
.RE
.PP
\fB\-L\fR, \fB\-\-list\-files\fR
.RS 4
List files in folder\&.
.RE
.PP
\fB\-m\fR, \fB\-\-mkdir\fR \fINAME\fR
.RS 4
Create a directory\&.
.RE
.PP
\fB\-r\fR, \fB\-\-rmdir\fR \fINAME\fR
.RS 4
Remove a directory\&.
.RE
.PP
\fB\-n\fR, \fB\-\-num\-files\fR
.RS 4
Display number of files\&.
.RE
.PP
\fB\-p\fR, \fB\-\-get\-file\fR \fIRANGE\fR
.RS 4
Get files given in range\&.
.RE
.PP
\fB\-P\fR, \fB\-\-get\-all\-files\fR
.RS 4
Get all files from folder\&.
.RE
.PP
\fB\-t\fR, \fB\-\-get\-thumbnail\fR \fIRANGE\fR
.RS 4
Get thumbnails given in range\&.
.RE
.PP
\fB\-T\fR, \fB\-\-get\-all\-thumbnails\fR
.RS 4
Get all thumbnails from folder\&.
.RE
.PP
\fB\-\-get\-raw\-data\fR \fIRANGE\fR
.RS 4
Get raw data given in range\&.
.RE
.PP
\fB\-\-get\-all\-raw\-data\fR
.RS 4
Get all raw data from folder\&.
.RE
.PP
\fB\-\-get\-audio\-data\fR \fIRANGE\fR
.RS 4
Get audio data given in range\&.
.RE
.PP
\fB\-\-get\-all\-audio\-data\fR
.RS 4
Get all audio data from folder\&.
.RE
.PP
\fB\-\-upload\-metadata\fR \fIFILENAME\fR
.RS 4
Upload meta data for the specific file, taken from a file prefix with meta_ \&.
.RE
.PP
\fB\-\-get\-metadata\fR \fIRANGE\fR
.RS 4
Get meta data given in range\&.
.RE
.PP
\fB\-\-get\-all\-metadata\fR
.RS 4
Get all meta data from folder\&.
.RE
.PP
\fB\-\-force\-overwrite\fR
.RS 4
Overwrite files without asking\&.
.RE
.PP
\fB\-\-skip\-existing\fR
.RS 4
Skip files if they exist already on the local directory\&.
.RE
.PP
\fB\-\-new\fR
.RS 4
Only get not already downloaded files\&. This option depends on camera support of flagging already downloaded images and is not available for all drivers\&.
.RE
.PP
\fB\-d\fR, \fB\-\-delete\-file\fR \fIRANGE\fR
.RS 4
Delete files given in range\&.
.RE
.PP
\fB\-D\fR, \fB\-\-delete\-all\-files\fR
.RS 4
Delete all files in folder (defaults to
\fB\-\-no\-recurse\fR)\&.
.RE
.PP
\fB\-u\fR, \fB\-\-upload\-file\fR \fIFILENAME\fR
.RS 4
Upload a file to camera\&.
.RE
.PP
\fB\-\-capture\-preview\fR
.RS 4
Capture a quick preview\&.
.RE
.PP
\fB\-B\fR\fB\-\-bulb\fR \fISECONDS\fR
.RS 4
Do a bulb capture for the specified amount of seconds\&.
.RE
.PP
\fB\-\-show\-preview\fR
.RS 4
Capture a quick preview and displays it in the terminal using Ascii Art (if aalib was used during build)\&.
.RE
.PP
\fB\-F \fR\fB\fICOUNT\fR\fR, \fB\-\-frames \fR\fB\fICOUNT\fR\fR
.RS 4
Number of frames to capture in one run\&. Default is infinite number of frames\&.
.RE
.PP
\fB\-I \fR\fB\fISECONDS\fR\fR, \fB\-\-interval \fR\fB\fISECONDS\fR\fR
.RS 4
Time between capture of multiple frames\&.
.sp
(Since 2\&.4) If
SIGUSR1 signal
is received, a picture is taken immediately without waiting for the end of the current interval period (see
the section called \(lqSIGNALS\(rq)\&. A value of \-1 will let gphoto2 wait forever, i\&.e\&. until a signal arrives\&. See also
\fB\-\-reset\-interval\fR\&.
.RE
.PP
\fB\-\-reset\-interval\fR
.RS 4
Setting this option will reset the time interval to the value given by the
\fB\-I|\-\-interval\fR option
when a
SIGUSR1 signal
is received in time\-lapse mode\&.
.RE
.PP
\fB\-\-capture\-image\fR
.RS 4
Capture an image and keep it on the camera\&.
.RE
.PP
\fB\-\-capture\-image\-and\-download\fR
.RS 4
Capture an image and download it immediately to the computer\&.
.RE
.PP
\fB\-\-trigger\-capture\fR
.RS 4
Triggers the capture an image and return\&. If you want to get the image downloaded, see \-\-wait\-event\-and\-download\&.
.sp
This feature is only available for some camera brands and drivers\&.
.RE
.PP
\fB\-\-keep\fR
.RS 4
When doing \-\-capture\-image\-and\-download or interval capture, this option will keep the images on the memory card of the camera\&.
.RE
.PP
\fB\-\-no\-keep\fR
.RS 4
When doing \-\-capture\-image\-and\-download or interval capture, this option will not keep the images on the memory card of the camera after downloading them during capture\&. (default)
.RE
.PP
\fB\-\-keep\-raw\fR
.RS 4
When doing \-\-capture\-image\-and\-download or interval capture, this option will keep the RAW images on the memory card of the camera, but still download the JPEG images\&. This is useful when doing dual mode capture and you want to review the JPEGs already during capture\&.
.RE
.PP
\fB\-\-capture\-movie \fR\fB\fISECONDS\fR\fR
.RS 4
Capture a movie\&. If the camera supports previews, this will capture a stream of previews (motion\-jpeg) as fast as the camera can\&.
.sp
If not argument is specified, it will capture preview frames until you press Ctrl\-C\&. Arguments that can be specified are either seconds of capture or number of preview frames\&.
.RE
.PP
\fB\-\-capture\-sound\fR
.RS 4
Capture an audio clip\&. No driver supports this at this time\&.
.RE
.PP
\fB\-\-capture\-tethered \fR\fB\fISECONDS, MILLISECONDS, COUNT or MATCHSTRING\fR\fR
.RS 4
Lets gphoto2 wait for notifications from the camera that an object was added\&. This is useful for tethered capture, where pressing the shutter on the camera immediately transfer the image to the machine for processing\&.
.sp
Together with the
\fB\-\-hook\-script\fR
to immediately postprocess or display the images this can help a studio workflow\&.
.sp
This option requires support in the driver and by the camera, currently newer Canon EOS and Nikon DLSR work\&.
.RE
.PP
\fB\-\-wait\-event \fR\fB\fISECONDS, MILLISECONDS, COUNT or MATCHSTRING\fR\fR, \fB\-\-wait\-event\-and\-download \fR\fB\fISECONDS, MILLISECONDS, COUNT or MATCHSTRING\fR\fR
.RS 4
Lets gphoto2 wait for notifications from the camera for various events\&. This is useful for seeing what the camera does and waiting for objects to be added\&. The objects are kept on camera in the
\(lq\-\-wait\-event\(rq
version, with
\(lq\-\-wait\-event\-and\-download\(rq
they are downloaded\&.
.sp
\-\-wait\-event\-and\-download is equivalent to \-\-capture\-tethered\&.
.sp
The time to wait can be either specified as full seconds with a "s" suffix, a number of milliseconds with a "ms" suffix, as a number of events (just a number), or a sub\-string to match\&. If nothing happens, a timeout is generated after 1 second, so a
\(lqwait\-event=5\(rq
will take at most 5 seconds\&. A
\(lq\-\-wait\-event=5s\(rq
will take exactly 5 second\&.
.sp
If no argument is given, the wait time is 1 million events (basically forever)\&.
.sp
In the download variant this can be used together with the
\fB\-\-hook\-script\fR
to immediately postprocess or display the images this can help a studio workflow\&.
.sp
This option requires support in the driver and by the camera, currently newer Canon EOS and Nikon DSC are known to work\&.
.RE
.PP
\fB\-\-show\-info\fR \fIRANGE\fR
.RS 4
Show information for a single or multiple images, like width, height, size and/or the capture time
.RE
.PP
\fB\-\-config\fR
.RS 4
Starts a ncurses based text configuration menu\&. gphoto2 needs to built against CDK for this feature\&.
.RE
.PP
\fB\-\-list\-config\fR
.RS 4
List all configuration entries\&.
.RE
.PP
\fB\-\-list\-all\-config\fR
.RS 4
List all configuration entries and their values and choices\&.
.sp
This command is a combination of
\fB\-\-list\-config\fR
and calling
\fB\-\-get\-config\fR
on all the entries\&.
.RE
.PP
\fB\-\-get\-config\fR \fICONFIGENTRY\fR
.RS 4
Get the specified configuration entry\&.
.sp
This command will list the type, the current value and also the available options of this configuration value\&.
.RE
.PP
\fB\-\-set\-config\fR \fICONFIGENTRY=CONFIGVALUE\fR
.RS 4
Set the specified configuration entry\&. For lists of choices of values this setting first looks up CONFIGVALUE as value and then as index into the choice list\&. Since this is not fully clear, you can use
\fB\-\-set\-config\-index\fR
or
\fB\-\-set\-config\-value\fR
to be more clear what is searched for\&.
.sp
Look at the output of
\fB\-\-get\-config\fR
to see what values are possible to set here\&.
.RE
.PP
\fB\-\-set\-config\-index\fR \fICONFIGENTRY=CONFIGINDEX\fR
.RS 4
Set the specified configuration entry by specifying the index into the list of choices for the configuration value\&. This of course only works for configuration settings that offer list of choices\&.
.sp
Look at the output of
\fB\-\-get\-config\fR
to see what indices are possible to set here\&.
.RE
.PP
\fB\-\-set\-config\-value\fR \fICONFIGENTRY=CONFIGVALUE\fR
.RS 4
Set the specified configuration entry by specifying its new value\&. For lists of choices the value is looked up and set\&.
.sp
Look at the output of
\fB\-\-get\-config\fR
to see what values are possible to set here\&.
.RE
.PP
\fB\-\-reset\fR
.RS 4
Resets the specified (or autodetected) USB port\&.
.sp
This command resets the USB port of either the first auto\-detected camera, or the port specified with
\fB\-\-port usb:XXX,YYY\fR\&. This option is useful if somehow the protocol talking to the camera locked up and simulates plugging out and in the camera\&.
.RE
.PP
\fB\-\-storage\-info\fR
.RS 4
Display information about the camera\*(Aqs storage media\&.
.RE
.PP
\fB\-\-summary\fR
.RS 4
Summary of camera status\&.
.RE
.PP
\fB\-\-manual\fR
.RS 4
Camera driver manual\&.
.RE
.PP
\fB\-\-about\fR
.RS 4
About the camera driver\&.
.RE
.PP
\fB\-\-shell\fR
.RS 4
Start the gphoto2 shell, an interactive environment\&. See
SHELL MODEfor a detailed description\&.
.RE
.SH "SHELL MODE"
.PP
The following commands are available:
.PP
cd \fIDIRECTORY\fR
.RS 4
Change to the specified directory on the camera\&.
.RE
.PP
ls
.RS 4
List the contents of the current directory on the camera\&.
.RE
.PP
lcd \fIDIRECTORY\fR
.RS 4
Change to the specified directory on the local machine\&.
.RE
.PP
get \fIFILENAME\fR
.RS 4
Download the specified file to the current directory\&.
.RE
.PP
put \fIFILENAME\fR
.RS 4
Upload the specified file from the current system directory to the cameras current directory\&.
.RE
.PP
get\-thumbnail \fIFILENAME\fR
.RS 4
Download the specified thumbnail to the current directory\&.
.RE
.PP
get\-raw \fIFILENAME\fR
.RS 4
Download the specified raw data to the current directory\&.
.RE
.PP
show\-info \fIFILENAME\fR
.RS 4
Show information of the specified file\&.
.RE
.PP
delete \fIFILENAME\fR
.RS 4
Delete the specified file or directory\&.
.RE
.PP
mkdir \fIDIRECTORY\fR
.RS 4
Creates a directory named
\(lqDIRECTORY\(rq\&.
.RE
.PP
rmdir \fIDIRECTORY\fR
.RS 4
Removes a directory named
\(lqDIRECTORY\(rq\&.
.RE
.PP
show\-exif \fIFILENAME\fR
.RS 4
Show EXIF information (only if compiled with EXIF support)\&.
.RE
.PP
capture\-image
.RS 4
Captures a single image and keeps it on the camera\&.
.RE
.PP
capture\-image\-and\-download
.RS 4
Captures a single image and downloads it from the camera\&.
.RE
.PP
capture\-preview
.RS 4
Captures a preview image and downloads it from the camera\&.
.RE
.PP
list\-config
.RS 4
Lists all configuration values\&.
.RE
.PP
get\-config \fINAME\fR
.RS 4
Gets the configuration specified by
\(lqNAME\(rq\&.
.RE
.PP
set\-config \fINAME=VALUE\fR
.RS 4
Sets the configuration specified by
\(lqNAME\(rq
to
\(lqVALUE\(rq\&.
.RE
.PP
set\-config\-value \fINAME=VALUE\fR
.RS 4
Sets the configuration specified by
\(lqNAME\(rq
to
\(lqVALUE\(rq\&.
.RE
.PP
set\-config\-index \fINAME=VALUE\fR
.RS 4
Sets the configuration specified by
\(lqNAME\(rq
to the
\(lqINDEX\(rq
into the list of choices\&. Works only for Menu or Radio button entries\&.
.RE
.PP
wait\-event \fICOUNT or SECONDS\fR
.RS 4
Waits for events from the camera for the specified time in SECONDS (if suffixed with s) or the COUNT of events from the camera, where every seconds a timeout event happens\&. Newly added images are kept on the camera\&.
.sp
Default is 1 event\&.
.RE
.PP
wait\-event\-and\-download \fICOUNT or SECONDS\fR, capture\-tethered \fICOUNT or SECONDS\fR
.RS 4
Waits for events from the camera for the specified time in SECONDS (if suffixed with s) or the COUNT of events from the camera, where every seconds a timeout event happens\&. Newly added images are downloaded from the camera\&.
.sp
Default is 1 event\&.
.RE
.PP
help, ?
.RS 4
Displays command usage\&.
.RE
.PP
exit, quit, q
.RS 4
Exit the gphoto2 shell\&.
.RE
.SH "ENVIRONMENT VARIABLES"
.PP
\fBCAMLIBS\fR
.RS 4
If set, defines the directory where the
libgphoto2
library looks for its camera drivers (camlibs)\&. You only need to set this on OS/2 systems and broken/test installations\&.
.RE
.PP
\fBIOLIBS\fR
.RS 4
If set, defines the directory where the
libgphoto2_port
library looks for its I/O drivers (iolibs)\&. You only need to set this on OS/2 systems and broken/test installations\&.
.RE
.PP
\fBLD_DEBUG\fR
.RS 4
Set this to
\fIall\fR
to receive lots of debug information regarding library loading on
\fBld\fR
based systems\&.
.RE
.PP
\fBUSB_DEBUG\fR
.RS 4
If set, defines the numeric debug level with which the
libusb
library will print messages\&. In order to get some debug output, set it to
\fI1\fR\&.
.RE
.SH "SIGNALS"
.PP
SIGUSR1 (since 2\&.4)
.RS 4
In time\-lapse capture mode, receiving a SIGUSR1 signal makes gphoto2 take a picture immediately\&.
.sp
If the
\fB\-\-reset\-interval\fR option
is given, the time counter is reset to the value given by the
\fB\-I|\-\-interval\fR option\&. Note that the camera will need some time (from 50ms to a few seconds) to actually capture the image\&.
.RE
.SH "SEE ALSO"
.PP
libgphoto2(3),
\m[blue]\fBThe gPhoto2 Manual\fR\m[]\&\s-2\u[1]\d\s+2,
\m[blue]\fBThe gphoto\&.org website\fR\m[]\&\s-2\u[2]\d\s+2,
\m[blue]\fBDigital Camera Support for UNIX, Linux and BSD\fR\m[]\&\s-2\u[3]\d\s+2
.SH "EXAMPLES"
.PP
\fBgphoto2 \fR\fB\fB\-\-list\-ports\fR\fR
.RS 4
Shows what kinds of ports (USB
and serial) you have\&.
.RE
.PP
\fBgphoto2 \fR\fB\fB\-\-auto\-detect\fR\fR
.RS 4
Shows what camera(s) you have connected\&.
.RE
.PP
\fBgphoto2 \fR\fB\fB\-\-list\-files\fR\fR
.RS 4
List files on camera\&.
.RE
.PP
\fBgphoto2 \fR\fB\fB\-\-get\-file\fR\fR\fB \fR\fB\fI7\-13\fR\fR
.RS 4
Get files number 7 through 13 from the list output by
\fB\fBgphoto2\fR\fR\fB \fR\fB\fB\-\-list\-files\fR\fR\&.
.RE
.PP
\fBgphoto2 \fR\fB\fB\-\-capture\-image\fR\fR\fB \fR\fB\fB\-\-interval\fR\fR\fB \fR\fB\fI60\fR\fR\fB \fR\fB\fB\-\-hook\-script\fR\fR\fB \fR\fB\fI/usr/share/doc/gphoto2/test\-hook\&.sh\fR\fR
.RS 4
Capture one image every 60 seconds from now to eternity\&. The example hook script will be called after each captured image has been stored on the computer\&.
.RE
.PP
To track down errors, you can add the
\fB\-\-debug\fR
parameter to the
\fBgphoto2\fR
command line and, if dealing with USB problems, setting the environment variable
\fBUSB_DEBUG\fR\fI=1\fR\&.
.SH "AUTHORS"
.PP
\fBTim Waugh\fR
.RS 4
Author.
.RE
.PP
\fBHans Ulrich Niedermann, current maintainer\fR <\&gp@n-dimensional.de\&>
.RS 4
Author.
.RE
.PP
\fBMichael J. Rensing\fR
.RS 4
Author.
.RE
.PP
\fBMarcus Meissner\fR <\&marcus@jet.franken.de\&>
.RS 4
Author.
.RE
.PP
\fBMiscellanous Contributors.\fR
.PP
\fBThe gPhoto2 Team\fR
.RS 4
Author.
.RE
.PP
\fBTim Waugh\fR <\&twaugh@redhat\&.com\&>
.RS 4
Original man page author\&.
.RE
.PP
\fBHans Ulrich Niedermann\fR <\&gp@n\-dimensional\&.de\&>
.RS 4
Current man page editor\&.
.RE
.SH "NOTES"
.IP " 1." 4
The gPhoto2 Manual
.RS 4
\%http://www.gphoto.org/doc/manual/
.RE
.IP " 2." 4
The gphoto.org website
.RS 4
\%http://www.gphoto.org/
.RE
.IP " 3." 4
Digital Camera Support for UNIX, Linux and BSD
.RS 4
\%http://www.teaser.fr/~hfiguiere/linux/digicam.html
.RE

30
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/Makefile-files

@ -0,0 +1,30 @@
# -*- Makefile -*-
EXTRA_DIST += %reldir%/README.md
EXTRA_DIST += %reldir%/gphoto-m4-sync
EXTRA_DIST += %reldir%/gp-byteorder.m4
EXTRA_DIST += %reldir%/gp-camlibs.m4
EXTRA_DIST += %reldir%/gp-check-doxygen.m4
EXTRA_DIST += %reldir%/gp-check-library.m4
EXTRA_DIST += %reldir%/gp-check-popt.m4
EXTRA_DIST += %reldir%/gp-check-shell-environment.m4
EXTRA_DIST += %reldir%/gp-config-msg.m4
EXTRA_DIST += %reldir%/gp-documentation.m4
EXTRA_DIST += %reldir%/gp-dynamic-libraries.m4
EXTRA_DIST += %reldir%/gp-gettext-hack.m4
EXTRA_DIST += %reldir%/gp-internal-docs.m4
EXTRA_DIST += %reldir%/gp-libltdl.m4
EXTRA_DIST += %reldir%/gp-manual-docbook-xml.m4
EXTRA_DIST += %reldir%/gp-manual-documentation.m4
EXTRA_DIST += %reldir%/gp-manual-fig2dev.m4
EXTRA_DIST += %reldir%/gp-manual-graphviz.m4
EXTRA_DIST += %reldir%/gp-manual-gtk-doc.m4
EXTRA_DIST += %reldir%/gp-manual-pstoimg.m4
EXTRA_DIST += %reldir%/gp-manual-w3m.m4
EXTRA_DIST += %reldir%/gp-packaging.m4
EXTRA_DIST += %reldir%/gp-references.m4
EXTRA_DIST += %reldir%/gp-stdint.m4
EXTRA_DIST += %reldir%/gp-subpackage.m4
EXTRA_DIST += %reldir%/gp-udev.m4
EXTRA_DIST += %reldir%/gp-va-copy.m4

7
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/Makefile.am

@ -0,0 +1,7 @@
# This is the compatibility Makefile.am - you are probably better off
# just including the Makefile-files directly from your top-level
# Makefile.am.
EXTRA_DIST =
include Makefile-files

140
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/README.md

@ -0,0 +1,140 @@
gphoto-m4
=========
`gphoto-m4` is the gPhoto projects' collection of m4 macros for use
with the autoconf/automake based build systems.
It has been designed to be used in
* `gphoto2`
* `libgphoto2`
* `libgphoto2_port` (located in `libgphoto2/`)
* `gtkam`
Some macros are re-used ones from `libexif`.
Since the gPhoto project moved from SVN to git, we have not figured
out yet how to properly include the `gphoto-m4` files into the
respective software's `gphoto-m4/` subdirectory (either `git subtree`
or `git submodule` come to mind).
So for the time being, we manually update and synchronize the files.
Use of `gphoto-m4` after the switch to git from SVN
---------------------------------------------------
Since the gPhoto project moved from SVN to git, we have not figured
out yet how to properly include the `gphoto-m4` files into the
respective software's `gphoto-m4/` subdirectory. The options are:
1. Manually update (and hopefully synchronize) the files.
Advantages:
* No special commands needed for users or developers.
Disadvantages:
* The manual work for the maintainers is exhausting and error
prone.
2. Use `git submodule`.
Advantages:
* Defined mechanism for syncing and updating the `gphoto-m4/*`
files.
Disadvantages:
* Requires special git commands from everybody (users,
developers, and maintainers) all the time (e.g. `git clone
--recursive` instead of `git clone`).
This is the showstopper for `git submodule`.
3. Use `git subtree`.
Advantages:
* Defined mechanism for syncing and updating the `gphoto-m4/*`
files.
* Requires no special git commands from users or developers.
* Not even people actually messing with the files in
`gphoto-m4/*` strictly need special commands.
Only the maintainers who do the syncing and updating of the
`gphoto-m4/*` files need the special commands.
Disadvantages:
* Requires special knowledge of special commands instead of
just copying files around. The concept is less complex than
copying files round, but it does require special commands.
* No rebasing possible across pulls to `gphoto-m4/`. Not really
necessary anyway, though.
* Pushes of changes to from, say, `gphoto2/gphoto-m4` to
upstream `gphoto-m4` create a lot of commit history noise in
the `gphoto-m4` repository by including the complete history
of the `gphoto2` repository.
Note this cannot be avoided by using `git subtree split`:
That is executed internally by `git subtree push`.
So it appears that using `git subtree push` will push all
projects' commit history into the `gphoto-m4` repo.
That is if not a showstopper, then at least very ugly.
For the time being, we manually update and synchronize the files.
Manually syncing and updating files
-----------------------------------
This section has not been written yet.
Using `git submodule`
---------------------
This section has not been written yet.
Using `git subtree`
-------------------
### Using `gphoto-m4` as git subtree ###
This section describes how to use `gphoto-m4` when it has been set up
as a `git subtree` (e.g. in `gphoto2` and `libgphoto2`).
Add a remote for `gphoto-m4`:
git remote add origin-gphoto-m4 git@github.com:gphoto/gphoto-m4.git
Pull changes to origin-gphoto-m4 into local `gphoto-m4`:
git subtree pull --prefix gphoto-m4 origin-gphoto-m4 master --squash
Now we can push local changes to 'gphoto-m4/*' back to
`origin-gphoto-m4` as follows:
git subtree push --prefix gphoto-m4 origin-gphoto-m4 master
FIXME: Add more typical uses cases.
### Setting up `gphoto-m4` as git subtree ###
This section describes how we initially set up `gphoto-m4` as a git
subtree for `gphoto2`. This is only required once by one person, then
never needs to be done by anybody else ever again.
git subtree add --prefix gphoto-m4 origin-gphoto-m4 master --squash

450
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-byteorder.m4

@ -0,0 +1,450 @@
dnl AC_NEED_BYTEORDER_H ( HEADER-TO-GENERATE )
dnl Originally written by Dan Fandrich <dan@coneharvesters.com>
dnl My contribution is hereby placed into the public domain.
dnl No warranty is expressed or implied.
dnl
dnl Create a header file that guarantees that byte swapping macros of the
dnl ntohl variety as well as the extended types included in OpenBSD and
dnl NetBSD such as le32toh are defined. If possible, the standard ntohl
dnl are overloaded as they are optimized for the given platform, but when
dnl this is not possible (e.g. on a big-endian machine) they are defined
dnl in this file.
dnl Look for a symbol in a header file
dnl AC_HAVE_SYMBOL ( IDENTIFIER, HEADER-FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND )
AC_DEFUN([AC_HAVE_SYMBOL],
[
AC_MSG_CHECKING(for $1 in $2)
AC_EGREP_CPP([symbol is present|\<$1\>],[
#include <$2>
#ifdef $1
symbol is present
#endif
],
[AC_MSG_RESULT(yes)
$3
],
[AC_MSG_RESULT(no)
$4
])])
dnl Create a header file that defines extended byte swapping macros
AC_DEFUN([AC_NEED_BYTEORDER_H],
[
ac_dir=`AS_DIRNAME(["$1"])`
if test "$ac_dir" != "$1" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && AS_MKDIR_P(["$ac_dir"])
fi
# We're only interested in the target CPU, but it's not always set
effective_target="$target"
if test "x$effective_target" = xNONE -o "x$effective_target" = x ; then
effective_target="$host"
fi
AC_SUBST(effective_target)
cat > "$1" << EOF
/* This file is generated automatically by configure */
/* It is valid only for the system type ${effective_target} */
#ifndef __BYTEORDER_H
#define __BYTEORDER_H
EOF
dnl First, do an endian check
AC_C_BIGENDIAN
dnl Look for NetBSD-style extended byte swapping macros
AC_HAVE_SYMBOL(le32toh,machine/endian.h,
[HAVE_LE32TOH=1
cat >> "$1" << EOF
/* extended byte swapping macros are already available */
#include <machine/endian.h>
EOF],
[
dnl Look for standard byte swapping macros
AC_HAVE_SYMBOL(ntohl,arpa/inet.h,
[cat >> "$1" << EOF
/* ntohl and relatives live here */
#include <arpa/inet.h>
#define __HAVE_NTOHL
EOF],
[AC_HAVE_SYMBOL(ntohl,netinet/in.h,
[cat >> "$1" << EOF
/* ntohl and relatives live here */
#include <netinet/in.h>
#define __HAVE_NTOHL
EOF],true)])
])
dnl Look for generic byte swapping macros
dnl OpenBSD
AC_HAVE_SYMBOL(swap32,machine/endian.h,
[cat >> "$1" << EOF
/* swap32 and swap16 are defined in machine/endian.h */
EOF],
[
dnl Linux GLIBC
AC_HAVE_SYMBOL(bswap_32,byteswap.h,
[cat >> "$1" << EOF
/* Define generic byte swapping functions */
#include <byteswap.h>
#define swap16(x) bswap_16(x)
#define swap32(x) bswap_32(x)
#define swap64(x) bswap_64(x)
EOF],
[
dnl NetBSD
AC_HAVE_SYMBOL(bswap32,machine/endian.h,
dnl We're already including machine/endian.h if this test succeeds
[cat >> "$1" << EOF
/* Define generic byte swapping functions */
EOF
if test "$HAVE_LE32TOH" != "1"; then
echo '#include <machine/endian.h>'>> "$1"
fi
cat >> "$1" << EOF
#define swap16(x) bswap16(x)
#define swap32(x) bswap32(x)
#define swap64(x) bswap64(x)
EOF],
[
dnl FreeBSD
AC_HAVE_SYMBOL(__byte_swap_long,sys/types.h,
[cat >> "$1" << EOF
/* Define generic byte swapping functions */
#include <sys/types.h>
#define swap16(x) __byte_swap_word(x)
#define swap32(x) __byte_swap_long(x)
/* No optimized 64 bit byte swapping macro is available */
#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\
((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\
((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\
((x) >> 8) & 0x00000000ff000000ULL | \\
((x) >> 24) & 0x0000000000ff0000ULL | \\
((x) >> 40) & 0x000000000000ff00ULL | \\
((x) >> 56) & 0x00000000000000ffULL))
EOF],
[
dnl OS X
AC_HAVE_SYMBOL(NXSwapLong,machine/byte_order.h,
[cat >> "$1" << EOF
/* Define generic byte swapping functions */
#include <machine/byte_order.h>
#define swap16(x) NXSwapShort(x)
#define swap32(x) NXSwapLong(x)
#define swap64(x) NXSwapLongLong(x)
EOF],
[
if test $ac_cv_c_bigendian = yes; then
cat >> "$1" << EOF
/* No other byte swapping functions are available on this big-endian system */
#define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8)))
#define swap32(x) ((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL | \\
((uint32_t)(x) << 8) & 0x00ff0000UL | \\
((x) >> 8) & 0x0000ff00UL | \\
((x) >> 24) & 0x000000ffUL))
#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\
((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\
((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\
((x) >> 8) & 0x00000000ff000000ULL | \\
((x) >> 24) & 0x0000000000ff0000ULL | \\
((x) >> 40) & 0x000000000000ff00ULL | \\
((x) >> 56) & 0x00000000000000ffULL))
EOF
else
cat >> "$1" << EOF
/* Use these as generic byteswapping macros on this little endian system */
/* on windows we might not have ntohs / ntohl without including winsock.dll,
* so use generic macros */
#ifdef __HAVE_NTOHL
# define swap16(x) htons(x)
# define swap32(x) htonl(x)
#else
# define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8)))
# define swap32(x) ((uint32_t)((((uint32_t)(x) << 24) & 0xff000000UL) | \\
(((uint32_t)(x) << 8) & 0x00ff0000UL) | \\
(((x) >> 8) & 0x0000ff00UL) | \\
(((x) >> 24) & 0x000000ffUL)))
#endif
/* No optimized 64 bit byte swapping macro is available */
#define swap64(x) ((uint64_t)((((uint64_t)(x) << 56) & 0xff00000000000000ULL) | \\
(((uint64_t)(x) << 40) & 0x00ff000000000000ULL) | \\
(((uint64_t)(x) << 24) & 0x0000ff0000000000ULL) | \\
(((uint64_t)(x) << 8) & 0x000000ff00000000ULL) | \\
(((x) >> 8) & 0x00000000ff000000ULL) | \\
(((x) >> 24) & 0x0000000000ff0000ULL) | \\
(((x) >> 40) & 0x000000000000ff00ULL) | \\
(((x) >> 56) & 0x00000000000000ffULL)))
EOF
fi
])
])
])
])
])
[
if test "$HAVE_LE32TOH" != "1"; then
cat >> "$1" << EOF
/* The byte swapping macros have the form: */
/* EENN[a]toh or htoEENN[a] where EE is be (big endian) or */
/* le (little-endian), NN is 16 or 32 (number of bits) and a, */
/* if present, indicates that the endian side is a pointer to an */
/* array of uint8_t bytes instead of an integer of the specified length. */
/* h refers to the host's ordering method. */
/* So, to convert a 32-bit integer stored in a buffer in little-endian */
/* format into a uint32_t usable on this machine, you could use: */
/* uint32_t value = le32atoh(&buf[3]); */
/* To put that value back into the buffer, you could use: */
/* htole32a(&buf[3], value); */
/* Define aliases for the standard byte swapping macros */
/* Arguments to these macros must be properly aligned on natural word */
/* boundaries in order to work properly on all architectures */
#ifndef htobe16
# ifdef __HAVE_NTOHL
# define htobe16(x) htons(x)
# else
# ifdef WORDS_BIGENDIAN
# define htobe16(x) (x)
# else
# define htobe16(x) swap16(x)
# endif
# endif
#endif
#ifndef htobe32
# ifdef __HAVE_NTOHL
# define htobe32(x) htonl(x)
# else
# ifdef WORDS_BIGENDIAN
# define htobe32(x) (x)
# else
# define htobe32(x) swap32(x)
# endif
# endif
#endif
#ifndef be16toh
# define be16toh(x) htobe16(x)
#endif
#ifndef be32toh
# define be32toh(x) htobe32(x)
#endif
#define HTOBE16(x) (x) = htobe16(x)
#define HTOBE32(x) (x) = htobe32(x)
#define BE32TOH(x) (x) = be32toh(x)
#define BE16TOH(x) (x) = be16toh(x)
EOF
if test $ac_cv_c_bigendian = yes; then
cat >> "$1" << EOF
/* Define our own extended byte swapping macros for big-endian machines */
#ifndef htole16
# define htole16(x) swap16(x)
#endif
#ifndef htole32
# define htole32(x) swap32(x)
#endif
#ifndef htole64
# define htole64(x) swap64(x)
#endif
#ifndef le16toh
# define le16toh(x) swap16(x)
#endif
#ifndef le32toh
# define le32toh(x) swap32(x)
#endif
#ifndef le64toh
# define le64toh(x) swap64(x)
#endif
#ifndef htobe64
# define htobe64(x) (x)
#endif
#ifndef be64toh
# define be64toh(x) (x)
#endif
#define HTOLE16(x) (x) = htole16(x)
#define HTOLE32(x) (x) = htole32(x)
#define HTOLE64(x) (x) = htole64(x)
#define LE16TOH(x) (x) = le16toh(x)
#define LE32TOH(x) (x) = le32toh(x)
#define LE64TOH(x) (x) = le64toh(x)
#define HTOBE64(x) (void) (x)
#define BE64TOH(x) (void) (x)
EOF
else
cat >> "$1" << EOF
/* On little endian machines, these macros are null */
#ifndef htole16
# define htole16(x) (x)
#endif
#ifndef htole32
# define htole32(x) (x)
#endif
#ifndef htole64
# define htole64(x) (x)
#endif
#ifndef le16toh
# define le16toh(x) (x)
#endif
#ifndef le32toh
# define le32toh(x) (x)
#endif
#ifndef le64toh
# define le64toh(x) (x)
#endif
#define HTOLE16(x) (void) (x)
#define HTOLE32(x) (void) (x)
#define HTOLE64(x) (void) (x)
#define LE16TOH(x) (void) (x)
#define LE32TOH(x) (void) (x)
#define LE64TOH(x) (void) (x)
/* These don't have standard aliases */
#ifndef htobe64
# define htobe64(x) swap64(x)
#endif
#ifndef be64toh
# define be64toh(x) swap64(x)
#endif
#define HTOBE64(x) (x) = htobe64(x)
#define BE64TOH(x) (x) = be64toh(x)
EOF
fi
fi
cat >> "$1" << EOF
/* Define the C99 standard length-specific integer types */
#include <_stdint.h>
EOF
case "${effective_target}" in
i[3456]86-*)
cat >> "$1" << EOF
/* Here are some macros to create integers from a byte array */
/* These are used to get and put integers from/into a uint8_t array */
/* with a specific endianness. This is the most portable way to generate */
/* and read messages to a network or serial device. Each member of a */
/* packet structure must be handled separately. */
/* The i386 and compatibles can handle unaligned memory access, */
/* so use the optimized macros above to do this job */
#ifndef be16atoh
# define be16atoh(x) be16toh(*(uint16_t*)(x))
#endif
#ifndef be32atoh
# define be32atoh(x) be32toh(*(uint32_t*)(x))
#endif
#ifndef be64atoh
# define be64atoh(x) be64toh(*(uint64_t*)(x))
#endif
#ifndef le16atoh
# define le16atoh(x) le16toh(*(uint16_t*)(x))
#endif
#ifndef le32atoh
# define le32atoh(x) le32toh(*(uint32_t*)(x))
#endif
#ifndef le64atoh
# define le64atoh(x) le64toh(*(uint64_t*)(x))
#endif
#ifndef htob16a
# define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x)
#endif
#ifndef htobe32a
# define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x)
#endif
#ifndef htobe64a
# define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x)
#endif
#ifndef htole16a
# define htole16a(a,x) *(uint16_t*)(a) = htole16(x)
#endif
#ifndef htole32a
# define htole32a(a,x) *(uint32_t*)(a) = htole32(x)
#endif
#ifndef htole64a
# define htole64a(a,x) *(uint64_t*)(a) = htole64(x)
#endif
EOF
;;
*)
cat >> "$1" << EOF
/* Here are some macros to create integers from a byte array */
/* These are used to get and put integers from/into a uint8_t array */
/* with a specific endianness. This is the most portable way to generate */
/* and read messages to a network or serial device. Each member of a */
/* packet structure must be handled separately. */
/* Non-optimized but portable macros */
#define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1]))
#define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3]))
#define be64atoh_x(x,off,shift) (((uint64_t)((x)[off]))<<shift)
#define be64atoh(x) ((uint64_t)(be64atoh_x(x,0,56)|be64atoh_x(x,1,48)|be64atoh_x(x,2,40)| \\
be64atoh_x(x,3,32)|be64atoh_x(x,4,24)|be64atoh_x(x,5,16)|be64atoh_x(x,6,8)|((x)[7])))
#define le16atoh(x) ((uint16_t)(((x)[1]<<8)|(x)[0]))
#define le32atoh(x) ((uint32_t)(((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
#define le64atoh_x(x,off,shift) (((uint64_t)(x)[off])<<shift)
#define le64atoh(x) ((uint64_t)(le64atoh_x(x,7,56)|le64atoh_x(x,6,48)|le64atoh_x(x,5,40)| \\
le64atoh_x(x,4,32)|le64atoh_x(x,3,24)|le64atoh_x(x,2,16)|le64atoh_x(x,1,8)|((x)[0])))
#define htobe16a(a,x) (a)[0]=(uint8_t)((x)>>8), (a)[1]=(uint8_t)(x)
#define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\
(a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x)
#define htobe64a(a,x) (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \\
(a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \\
(a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \\
(a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x)
#define htole16a(a,x) (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
#define htole32a(a,x) (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\
(a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
#define htole64a(a,x) (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \\
(a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \\
(a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\
(a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
EOF
;;
esac
]
cat >> "$1" << EOF
#endif /*__BYTEORDER_H*/
EOF])

170
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-camlibs.m4

@ -0,0 +1,170 @@
dnl GP_CAMLIB & Co.
dnl
dnl Redundancy free definition of libgphoto2 camlibs.
dnl
dnl Removes the redundany from the camlib lists, and executes
dnl additional consistency checks, e.g. to ensure that subdirectories
dnl actually exist.
dnl
dnl You can mark camlibs as unlisted, i.e. they won't be listed
dnl explicitly but still be recognized.
dnl
dnl Example usage:
dnl
dnl GP_CAMLIB([canon])
dnl GP_CAMLIB([casio])
dnl [...]
dnl GP_CAMLIB([ptp],[unlisted])
dnl GP_CAMLIB([ptp2])
dnl [...]
dnl GP_CAMLIB([toshiba])
dnl GP_CAMLIBS_DEFINE([camlibs])
dnl
dnl The camlibs basedir parameter of GP_CAMLIBS_DEFINE is optional.
dnl
dnl ####################################################################
dnl
AC_DEFUN([GP_CAMLIBS_INIT],[dnl
AC_BEFORE([$0],[GP_CAMLIB])dnl
m4_define_default([gp_camlib_srcdir], [camlibs])dnl
m4_define_default([gp_camlibs], [])dnl
m4_define_default([gp_camlibs_unlisted], [])dnl
])dnl
dnl
dnl ####################################################################
dnl
AC_DEFUN([GP_CAMLIB],[dnl
AC_REQUIRE([GP_CAMLIBS_INIT])dnl
AC_BEFORE([$0],[GP_CAMLIBS_DEFINE])dnl
m4_if([$2],[unlisted],[dnl
# $0($1,$2)
m4_append([gp_camlibs_unlisted], [$1], [ ])dnl
],[$#],[1],[dnl
# $0($1)
m4_append([gp_camlibs], [$1], [ ])dnl
],[dnl
m4_errprint(__file__:__line__:[ Error:
*** Illegal parameter 2 to $0: `$2'
*** Valid values are: undefined or [unlisted]
])dnl
m4_exit(1)dnl
])dnl
])dnl
dnl
dnl ####################################################################
dnl
AC_DEFUN([GP_CAMLIBS_WARNING],[dnl
AC_MSG_WARN([
# Caution: You have chosen to build a non-standard set of camlibs.
# You may have disabled the camlib required for your camera, or
# enabled a camlib that does *not* work, and overrides the camlib
# that does work. Consequently,
# YOUR CAMERA MAY NOT WORK!
#
# Many cameras of several brands are supported by a camlib with a
# name different from the name of the camera brand or model. If you
# are unsure, please
# * enable at least the "ptp2" camlib
# * or even better, just build "all" camlibs.
])
sleep 2
])
dnl
dnl ####################################################################
dnl
AC_DEFUN([GP_CAMLIBS_DEFINE],[dnl
AC_REQUIRE([GP_CAMLIBS_INIT])dnl
m4_pattern_allow([m4_strip])dnl
m4_ifval([$1],[m4_define([gp_camlib_srcdir],[$1])])dnl
dnl for camlib in m4_strip(gp_camlibs) m4_strip(gp_camlibs_unlisted)
dnl do
dnl if test -d "$srcdir/m4_strip(gp_camlib_srcdir)/$camlib"; then :; else
dnl AC_MSG_ERROR([
dnl * Fatal:
dnl * Source subdirectory for camlib \`$camlib' not found in
dnl * directory \`$srcdir/m4_strip(gp_camlib_srcdir)/'
dnl ])
dnl fi
dnl done
AC_MSG_CHECKING([which camlibs to compile])
dnl Yes, that help output won't be all that pretty, but we at least
dnl do not have to edit it by hand.
AC_ARG_WITH([camlibs],[AS_HELP_STRING(
[--with-camlibs=<list>],
[Compile camera drivers (camlibs) in <list>. ]dnl
[Drivers may be separated with commas. ]dnl
[CAUTION: DRIVER NAMES AND CAMERA NAMES MAY DIFFER. ]dnl
['all' is the default and compiles all camlibs. ]dnl
[Possible camlibs are: ]dnl
m4_strip(gp_camlibs))],
[camlibs="$withval"],
[camlibs="all"])dnl
dnl
ALL_DEFINED_CAMLIBS="m4_strip(gp_camlibs) m4_strip(gp_camlibs_unlisted)"
ALL_DEFAULT_CAMLIBS="m4_strip(gp_camlibs)"
BUILD_THESE_CAMLIBS_BASE=""
if test "$camlibs" = "all"; then
BUILD_THESE_CAMLIBS_BASE="$ALL_DEFAULT_CAMLIBS"
AC_MSG_RESULT([all])
else
# If the string starts with "all,", we start with the default list
# and add the explicitly defined ones later
if echo "$camlibs" | grep "^all," > /dev/null; then
BUILD_THESE_CAMLIBS_BASE="$ALL_DEFAULT_CAMLIBS"
camlibs="$(echo "$camlibs" | sed 's/^all,//')"
fi
# camlibs=$(echo $camlibs | sed 's/,/ /g')
IFS_save="$IFS"
IFS=",$IFS"
# Walk through enumeration of camlibs given by user and add them to list
# of camlibs to build if we know them.
for camlib in ${camlibs}; do
IFS="$IFS_save"
found=false
for from_all_camlib in ${ALL_DEFINED_CAMLIBS}; do
if test "$camlib" = "$from_all_camlib"; then
if test "x$BUILD_THESE_CAMLIBS_BASE" = "x"; then
BUILD_THESE_CAMLIBS_BASE="$camlib"
else
BUILD_THESE_CAMLIBS_BASE="$BUILD_THESE_CAMLIBS_BASE $camlib"
fi
found=:
break
fi
done
if $found; then :; else
AC_MSG_ERROR([Unknown camlib $camlib!])
fi
done
if test "x$BUILD_THESE_CAMLIBS_BASE" = "xcanon" ; then
# Gentoo mode... if user just said "canon", add "ptp2" ... should save support requests.
BUILD_THESE_CAMLIBS_BASE="$BUILD_THESE_CAMLIBS_BASE ptp2"
camlibs="$camlibs ptp2"
AC_MSG_WARN([
"You have just selected the old canon driver. However most current Canons\n"
"are supported by the PTP2 driver.\n"
"Autoselecting ptp2 driver too to avoid support requests.\n"
])
fi
IFS="$IFS_save"
AC_MSG_RESULT([$camlibs])
GP_CAMLIBS_WARNING
AC_DEFINE_UNQUOTED([INCOMPLETE_CAMLIB_SET], ["$BUILD_THESE_CAMLIBS_BASE"],
[Whether the set of camlibs built is incomplete])
fi
BUILD_THESE_CAMLIBS=""
for f in $BUILD_THESE_CAMLIBS_BASE
do
BUILD_THESE_CAMLIBS="${BUILD_THESE_CAMLIBS}${BUILD_THESE_CAMLIBS+ }${f}.la"
done
AC_SUBST([BUILD_THESE_CAMLIBS])
AC_SUBST([ALL_DEFINED_CAMLIBS])
AC_SUBST([ALL_DEFAULT_CAMLIBS])
])dnl
dnl
dnl ####################################################################
dnl
dnl Local Variables:
dnl mode: autoconf
dnl End:

21
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-check-doxygen.m4

@ -0,0 +1,21 @@
dnl doxygen related stuff
dnl look for tools
dnl define substitutions for Doxyfile.in
AC_DEFUN([GP_CHECK_DOXYGEN],[dnl
AC_REQUIRE([GP_CHECK_DOC_DIR])dnl
AC_PATH_PROG([DOT], [dot], [false])
AC_PATH_PROG([DOXYGEN], [doxygen], [false])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "xfalse"])
AM_CONDITIONAL([HAVE_DOT], [test "x$DOT" != "xfalse"])
if test "x$DOT" != "xfalse"; then
AC_SUBST([HAVE_DOT],[YES])
else
AC_SUBST([HAVE_DOT],[NO])
fi
AC_SUBST([HTML_APIDOC_DIR], ["${PACKAGE_TARNAME}-api.html"])
AC_SUBST([DOXYGEN_OUTPUT_DIR], [doxygen-output])
AC_SUBST([HTML_APIDOC_INTERNALS_DIR], ["${PACKAGE_TARNAME}-internals.html"])
])dnl

456
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-check-library.m4

@ -0,0 +1,456 @@
dnl @synopsis GP_CHECK_LIBRARY([VARNAMEPART],[libname],[VERSION-REQUIREMENT],
dnl [headername],[functionname],
dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
dnl [OPTIONAL-REQUIRED-ETC],[WHERE-TO-GET-IT])
dnl
dnl Checks for the presence of a certain library.
dnl
dnl Parameters:
dnl
dnl VARNAMEPART partial variable name for variable definitions
dnl libname name of library
dnl VERSION-REQUIREMENT check for the version using pkg-config.
dnl default: []
dnl headername name of header file
dnl default: []
dnl functionname name of function name in library
dnl default: []
dnl ACTION-IF-FOUND shell action to execute if found
dnl default: []
dnl ACTION-IF-NOT-FOUND shell action to execute if not found
dnl default: []
dnl OPTIONAL-REQUIRED-ETC one of "mandatory", "default-on", "default-off"
dnl "disable-explicitly"
dnl default: [mandatory]
dnl WHERE-TO-GET-IT place where to find the library, e.g. a URL
dnl default: []
dnl
dnl What the ACTION-IFs can do:
dnl
dnl * change the variable have_[$1] to "yes" or "no" and thus change
dnl the outcome of the test
dnl * execute additional checks to define more specific variables, e.g.
dnl for different API versions
dnl
dnl What the OPTIONAL-REQUIRED-ETC options mean:
dnl
dnl mandatory Absolute requirement, cannot be disabled.
dnl default-on If found, it is used. If not found, it is not used.
dnl default-off In case of --with-libfoo, detect it. Without
dnl --with-libfoo, do not look for and use it.
dnl disable-explicitly Required by default, but can be disabled by
dnl explicitly giving --without-libfoo.
dnl
dnl These results have happened after calling GP_CHECK_LIBRARY:
dnl
dnl AM_CONDITIONAL([HAVE_VARPREFIX],[ if found ])
dnl AM_SUBST([have_VARPREFIX], [ "yes" if found, "no" if not found ])
dnl AM_SUBST([VARPREFIX_CFLAGS],[ -I, -D and stuff ])
dnl AM_SUBST([VARPREFIX_LIBS], [ /path/to/libname.la -L/path -lfoo ])
dnl
dnl Parameters to ./configure which influence the GP_CHECK_LIBRARY results:
dnl
dnl * VARNAMEPART_LIBS=/foobar/arm-palmos/lib/libname.la
dnl VARNAMEPART_CFLAGS=-I/foobar/include
dnl * --without-libfoo
dnl * --with-libfoo=/usr/local
dnl * --with-libfoo-include-dir=/foobar/include
dnl * --with-libfoo-lib=/foobar/arm-palmos/lib
dnl * --with-libfoo=autodetect
dnl
dnl Examples:
dnl GP_CHECK_LIBRARY([LIBEXIF], [libexif])dnl
dnl GP_CHECK_LIBRARY([LIBEXIF], [libexif-gtk], [>= 0.3.3])dnl
dnl note the space! ^
dnl
dnl Possible enhancements:
dnl
dnl * Derive VAR_PREFIX directly from libname
dnl This will change the calling conventions, so be aware of that.
dnl * Give names of a header file and function name and to a test
dnl compilation.
dnl
AC_DEFUN([_GP_CHECK_LIBRARY_SOEXT],[dnl
AC_MSG_CHECKING([for dynamic library extension])
soext=""
case "$host" in
*linux*) soext=".so" ;;
*sunos*) soext=".so" ;;
*solaris*) soext=".so" ;;
*bsd*) soext=".so" ;;
*darwin*) soext=".dylib" ;;
*w32*) soext=".dll" ;;
esac
case "$host_os" in
gnu*) soext=".so" ;;
esac
if test "x$soext" = "x"; then
soext=".so"
AC_MSG_RESULT([${soext}])
AC_MSG_WARN([
Host system "${host}" not recognized, defaulting to "${soext}".
])
else
AC_MSG_RESULT([${soext}])
fi
])dnl
dnl
AC_DEFUN([_GP_CHECK_LIBRARY],[
# ----------------------------------------------------------------------
# [GP_CHECK_LIBRARY]([$1],[$2],[$3],
# [$4],[$5],
# [...],[...],[$8])
m4_ifval([$9],[dnl
# $9
])dnl
# ----------------------------------------------------------------------
dnl
AC_REQUIRE([GP_CONFIG_MSG])dnl
AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_REQUIRE([_GP_CHECK_LIBRARY_SOEXT])dnl
# Use _CFLAGS and _LIBS given to configure.
# This makes it possible to set these vars in a configure script
# and AC_CONFIG_SUBDIRS this configure.
AC_ARG_VAR([$1][_CFLAGS], [CFLAGS for compiling with ][$2])dnl
AC_ARG_VAR([$1][_LIBS], [LIBS to add for linking against ][$2])dnl
dnl
AC_MSG_CHECKING([for ][$2][ to use])
m4_ifval([$3],[REQUIREMENTS_FOR_][$1][="][$2][ $3]["],
[REQUIREMENTS_FOR_][$1][="][$2]["])
userdef_[$1]=no
have_[$1]=no
if test "x${[$1][_LIBS]}" = "x" && test "x${[$1][_CFLAGS]}" = "x"; then
# define --with/--without argument
m4_if([$8], [default-off],
[m4_pushdef([gp_lib_arg],[--without-][$2])dnl
try_[$1]=no
],
[m4_pushdef([gp_lib_arg],[--with-][$2])dnl
try_[$1]=auto
])dnl
AC_ARG_WITH([$2],[AS_HELP_STRING([gp_lib_arg][=PREFIX],[where to find ][$2][, "no" or "auto"])],[try_][$1][="$withval"])
if test "x${[try_][$1]}" = "xno"; then
[REQUIREMENTS_FOR_][$1][=]
fi
if test "x${[try_][$1]}" = "xauto"; then [try_][$1]=autodetect; fi
AC_MSG_RESULT([${try_][$1][}])
m4_popdef([gp_lib_arg])dnl
if test "x${[try_][$1]}" = "xautodetect"; then
# OK, we have to autodetect.
# We start autodetection with the cleanest known method: pkg-config
if test "x${[have_][$1]}" = "xno"; then
# we need that line break after the PKG_CHECK_MODULES
m4_ifval([$3],
[PKG_CHECK_MODULES([$1],[$2][ $3],[have_][$1][=yes],[:])],
[PKG_CHECK_MODULES([$1],[$2], [have_][$1][=yes],[:])]
)
fi
# If pkg-config didn't find anything, try the libfoo-config program
# certain known libraries ship with.
if test "x${[have_][$1]}" = "xno"; then
AC_MSG_CHECKING([$2][ config program])
m4_pushdef([gp_lib_config],[m4_if([$2],[libusb],[libusb-config],
[$2],[libgphoto2],[gphoto2-config],
[$2],[libgphoto2_port],[gphoto2-port-config],
[$2],[gdlib],[gdlib-config],
[$2],[libxml-2.0],[xml2-config],
[none])])dnl
AC_MSG_RESULT([gp_lib_config])
AC_PATH_PROG([$1][_CONFIG_PROG],[gp_lib_config])
if test -n "${[$1][_CONFIG_PROG]}" &&
test "${[$1][_CONFIG_PROG]}" != "none"; then
m4_ifval([$3],[
AC_MSG_CHECKING([for ][$2][ version according to ][gp_lib_config])
m4_pushdef([gp_lib_compop],[regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*.*], [\1])])dnl comparison operator
m4_if( gp_lib_compop,[>=],[_][$1][_COMPN="-lt"],
gp_lib_compop,[>], [_][$1][_COMPN="-le"],
gp_lib_compop,[<], [_][$1][_COMPN="-ge"],
gp_lib_compop,[<=],[_][$1][_COMPN="-gt"],
gp_lib_compop,[=], [_][$1][_COMPN="-ne"],
[m4_errprint(__file__:__line__:[ Error:
Illegal version comparison operator: `gp_lib_compop'
It must be one of ">=", ">", "<", "<=", "=".
])m4_exit(1)])
m4_popdef([gp_lib_compop])dnl
# split requested version number using m4 regexps
_[$1]_REQ_1="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\).*], [\2])"
_[$1]_REQ_2="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\)\.\([0-9]+\).*], [\3])"
_[$1]_REQ_3="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\).*], [\4])"
_[$1]_REQ_4="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)\(.*\)], [\5])"
# split installed version number via shell and sed
_[$1]_VERSION="$("${[$1][_CONFIG_PROG]}" --version | sed 's/^.* //')"
_[$1]_VER_1="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\).*/\1/g')"
_[$1]_VER_2="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/g')"
_[$1]_VER_3="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/g')"
_[$1]_VER_4="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)\(.*\)/\4/g')"
AC_MSG_RESULT([${_][$1][_VERSION}])
_tmp=false
if test "${_[$1]_VER_1}" "${_[$1]_COMPN}" "${_[$1]_REQ_1}"; then _tmp=true;
elif test "${_[$1]_VER_2}" "${_[$1]_COMPN}" "${_[$1]_REQ_2}"; then _tmp=true;
elif test "${_[$1]_VER_3}" "${_[$1]_COMPN}" "${_[$1]_REQ_3}"; then _tmp=true;
elif test "x${_[$1]_VER_4}" = "x" && test "x${_[$1]_REQ_4}" != "x"; then _tmp=true;
elif test "${_[$1]_VER_4}" "${_[$1]_COMPN}" "${_[$1]_REQ_4}"; then _tmp=true;
fi
AC_MSG_CHECKING([if ][$2][ version is matching requirement ][$3])
if "${_tmp}"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Version requirement ][$2][ ][$3][ not met. Found: ${_][$1][_VERSION}])
else
AC_MSG_RESULT([yes])
fi
])dnl if version requirement given
AC_MSG_CHECKING([for ][$2][ parameters from ][gp_lib_config])
[$1]_LIBS="$(${[$1][_CONFIG_PROG]} --libs || echo "*error*")"
[$1]_CFLAGS="$(${[$1][_CONFIG_PROG]} --cflags || echo "*error*")"
if test "x${[$1]_LIBS}" = "*error*" ||
test "x${[$1]_CFLAGS}" = "*error*"; then
AC_MSG_RESULT([error])
else
have_[$1]=yes
AC_MSG_RESULT([ok])
fi
fi
m4_popdef([gp_lib_config])dnl
fi
m4_ifval([$3],[# Version requirement given, so we do not rely on probing.],[
# Neither pkg-config, nor the libfoo-config program have found anything.
# So let's just probe the system.
AC_MSG_WARN([The `$2' library could not be found using pkg-config or its known config program.
No version checks will be performed if it is found using any other method.])
if test "x${[have_][$1]}" = "xno"; then
ifs="$IFS"
IFS=":" # FIXME: for W32 and OS/2 we may need ";" here
for _libdir_ in \
${LD_LIBRARY_PATH} \
"${libdir}" \
"${prefix}/lib64" "${prefix}/lib" \
/usr/lib64 /usr/lib \
/usr/local/lib64 /usr/local/lib \
/opt/lib64 /opt/lib
do
IFS="$ifs"
for _soext_ in .la ${soext} .a; do
if test -f "${_libdir_}/[$2]${_soext_}"
then
if test "x${_soext_}" = "x.la" ||
test "x${_soext_}" = "x.a"; then
[$1]_LIBS="${_libdir_}/[$2]${_soext_}"
else
[$1]_LIBS="-L${_libdir_} -l$(echo "$2" | sed 's/^lib//')"
fi
break
fi
done
if test "x${[$1][_LIBS]}" != "x"; then
break
fi
done
IFS="$ifs"
if test "x${[$1][_LIBS]}" != "x"; then
have_[$1]=yes
fi
fi
])
elif test "x${[try_][$1]}" = "xno"; then
:
else
# We've been given a prefix to look in for library $2.
# We start looking for $2.la files first.
AC_MSG_CHECKING([for ][$2][.la file in ${[try_][$1]}])
if test -f "${[try_][$1]}/lib/[$2].la"; then
[$1][_LIBS]="${[try_][$1]}/lib/[$2].la"
[$1][_CFLAGS]="-I${[try_][$1]}/include"
AC_MSG_RESULT([libtool file $][$1][_LIBS (good)])
have_[$1]=yes
elif test -f "${[try_][$1]}/lib64/[$2].la"; then # HACK
[$1][_LIBS]="${[try_][$1]}/lib64/[$2].la"
[$1][_CFLAGS]="-I${[try_][$1]}/include"
AC_MSG_RESULT([libtool file $][$1][_LIBS (good)])
have_[$1]=yes
else
AC_MSG_RESULT([wild guess that something is in $try_][$1])
[$1][_LIBS]="-L${[try_][$1]}/lib -l$(echo "$2" | sed 's/^lib//')"
[$1][_CFLAGS]="-I${[try_][$1]}/include"
have_[$1]=yes
AC_MSG_WARN([
* Warning:
* libtool file $2.la could not be found.
* We may be linking against the WRONG library.
])
fi
fi
elif test "x${[$1][_LIBS]}" != "x" && test "x${[$1][_CFLAGS]}" != "x"; then
AC_MSG_RESULT([user-defined])
userdef_[$1]=yes
have_[$1]=yes
else
AC_MSG_RESULT([broken call])
AC_MSG_ERROR([
* Fatal:
* When calling configure for ${PACKAGE_TARNAME}
* ${PACKAGE_NAME}
* either set both [$1][_LIBS] *and* [$1][_CFLAGS]
* or neither.
])
fi
AC_SUBST([REQUIREMENTS_FOR_][$1])
dnl
dnl ACTION-IF-FOUND
dnl
m4_ifval([$6],[dnl
if test "x${[have_][$1]}" = "xyes"; then
# ACTION-IF-FOUND
$6
fi
])dnl
dnl
dnl ACTION-IF-NOT-FOUND
dnl
m4_ifval([$7],[dnl
if test "x${[have_][$1]}" = "xno"; then
# ACTION-IF-NOT-FOUND
$7
fi
])dnl
dnl
dnl Run our own test compilation
dnl
m4_ifval([$4],[dnl
if test "x${[have_][$1]}" = "xyes"; then
dnl AC_MSG_CHECKING([whether ][$2][ test compile succeeds])
dnl AC_MSG_RESULT([${[have_][$1]}])
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="${[$1]_CFLAGS}"
AC_CHECK_HEADER([$4],[have_][$1][=yes],[have_][$1][=no])
CPPFLAGS="$CPPFLAGS_save"
fi
])dnl
dnl
dnl Run our own test link
dnl Does not work for libraries which be built after configure time,
dnl so we deactivate it for them (userdef_).
dnl
m4_ifval([$5],[dnl
if test "x${[userdef_][$1]}" = "xno" && test "x${[have_][$1]}" = "xyes"; then
AC_MSG_CHECKING([for function ][$5][ in ][$2])
LIBS_save="$LIBS"
LIBS="${[$1]_LIBS}"
AC_TRY_LINK_FUNC([$5],[],[have_][$1][=no])
LIBS="$LIBS_save"
AC_MSG_RESULT([${[have_][$1]}])
fi
])dnl
dnl
dnl Abort configure script if mandatory, but not found
dnl
m4_if([$8],[mandatory],[
if test "x${[have_][$1]}" = "xno"; then
AC_MSG_ERROR([
PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
[$1][_LIBS]=${[$1][_LIBS]}
[$1][_CFLAGS]=${[$1][_CFLAGS]}
* Fatal: ${PACKAGE_NAME} requires $2 $3 to build.
*
* Possible solutions:
* - set PKG_CONFIG_PATH to adequate value
* - call configure with [$1][_LIBS]=.. and [$1][_CFLAGS]=..
* - call configure with one of the --with-$2 parameters
][m4_ifval([$9],[dnl
* - get $2 and install it:
* $9],[dnl
* - get $2 and install it])])
fi
])dnl
dnl
dnl Abort configure script if not found and not explicitly disabled
dnl
m4_if([$8],[disable-explicitly],[
if test "x${[try_][$1]}" != "xno" && test "x${[have_][$1]}" = "xno"; then
AC_MSG_ERROR([
PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
[$1][_LIBS]=${[$1][_LIBS]}
[$1][_CFLAGS]=${[$1][_CFLAGS]}
* Fatal: ${PACKAGE_NAME} by default requires $2 $3 to build.
* You must explicitly disable $2 to build ${PACKAGE_TARNAME} without it.
*
* Possible solutions:
* - call configure with --with-$2=no or --without-$2
* - set PKG_CONFIG_PATH to adequate value
* - call configure with [$1][_LIBS]=.. and [$1][_CFLAGS]=..
* - call configure with one of the --with-$2 parameters
][m4_ifval([$9],[dnl
* - get $2 and install it:
* $9],[dnl
* - get $2 and install it
])][m4_if([$2],[libusb],[dnl
* - if you have libusb >= 1.0 installed, you must also install
* either the libusb0 compat library or a libusb 0.x version
])])
fi
])dnl
AM_CONDITIONAL([HAVE_][$1], [test "x$have_[$1]" = "xyes"])
if test "x$have_[$1]" = "xyes"; then
AC_DEFINE([HAVE_][$1], 1, [whether we compile with ][$2][ support])
GP_CONFIG_MSG([$2],[yes])dnl
AC_MSG_CHECKING([$2][ library flags])
AC_MSG_RESULT(["${[$1][_LIBS]}"])
AC_MSG_CHECKING([$2][ cpp flags])
AC_MSG_RESULT(["${[$1][_CFLAGS]}"])
else
[REQUIREMENTS_FOR_][$1][=]
GP_CONFIG_MSG([$2],[no])dnl
fi
dnl AC_SUBST is done implicitly by AC_ARG_VAR above.
dnl AC_SUBST([$1][_LIBS])
dnl AC_SUBST([$1][_CFLAGS])
])dnl
dnl
dnl ####################################################################
dnl
AC_DEFUN([_GP_CHECK_LIBRARY_SYNTAX_ERROR],[dnl
m4_errprint(__file__:__line__:[ Error:
*** Calling $0 macro with old syntax
*** Aborting.
])dnl
m4_exit(1)dnl
])dnl
dnl
dnl ####################################################################
dnl
AC_DEFUN([GP_CHECK_LIBRARY],[dnl
m4_if([$4], [mandatory], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)],
[$4], [default-enabled], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)],
[$4], [default-disabled], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)])dnl
m4_if([$8], [], [dnl
_GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[mandatory],[$9])],
[$8], [default-on], [dnl
_GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])],
[$8], [disable-explicitly], [dnl
_GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])],
[$8], [default-off], [dnl
_GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])],
[$8], [mandatory], [dnl
_GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])],
[m4_errprint(__file__:__line__:[ Error:
Illegal argument 6 to $0: `$6'
It must be one of "default-on", "default-off", "mandatory".
])m4_exit(1)])dnl
])dnl
dnl
m4_pattern_disallow([GP_CHECK_LIBRARY])
m4_pattern_disallow([_GP_CHECK_LIBRARY])
m4_pattern_disallow([_GP_CHECK_LIBRARY_SYNTAX_ERROR])
m4_pattern_disallow([_GP_CHECK_LIBRARY_SOEXT])
dnl
dnl ####################################################################
dnl
dnl Please do not remove this:
dnl filetype: 6e60b4f0-acb2-4cd5-8258-42014f92bd2c
dnl I use this to find all the different instances of this file which
dnl are supposed to be synchronized.
dnl
dnl Local Variables:
dnl mode: autoconf
dnl End:

241
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-check-popt.m4

@ -0,0 +1,241 @@
dnl @synopsis GP_CHECK_POPT(FLAG)
dnl
dnl Check whether libpopt is available.
dnl FLAG must be one of
dnl "mandatory"
dnl "default-enabled"
dnl "default-disabled"
dnl
AC_DEFUN([GP_CHECK_POPT],[
#
# [GP_CHECK_POPT]
#
AC_REQUIRE([GP_CONFIG_MSG])dnl
m4_if([$1],[mandatory], [_GP_CHECK_POPT([mandatory])],
[$1],[default-enabled], [_GP_CHECK_POPT([disable])],
[$1],[default-disabled], [_GP_CHECK_POPT([enable])],
[m4_errprint(__file__:__line__:[ Error:
Illegal argument to $0: `$1'
Valid values are: mandatory, default-enabled, default-disabled
])m4_exit(1)])dnl
])dnl
dnl
AC_DEFUN([_GP_CHECK_POPT],[
m4_if([$1],[mandatory],[
try_popt=yes
require_popt=yes
],[
try_popt=auto
require_popt=no
AC_ARG_ENABLE([popt],
[AS_HELP_STRING([--$1-popt],[Do not use popt])],
[ if test "x$enableval" = xno \
|| test "x$enableval" = xoff \
|| test "x$enableval" = xfalse;
then
try_popt=no
require_popt=no
elif test "x$enableval" = xyes \
|| test "x$enableval" = xon \
|| test "x$enableval" = xtrue
then
try_popt=yes
require_popt=yes
fi
])dnl
])dnl
AC_MSG_CHECKING([whether popt is required])
AC_MSG_RESULT([${require_popt}])
if test "$require_popt" != yes; then
AC_MSG_CHECKING([whether popt is requested])
AC_MSG_RESULT([${try_popt}])
fi
dnl Implicit AC_SUBST
AC_ARG_VAR([POPT_CFLAGS],[cppflags to compile with libpopt])dnl
AC_ARG_VAR([POPT_LIBS],[location of libpopt to link against])dnl
have_popt=no
if test "x$POPT_CFLAGS" = "x" && test "x$POPT_LIBS" = "x"; then
# try to find options to compile popt.h
CPPFLAGS_save="$CPPFLAGS"
popth_found=no
case "$MSYSTEM" in
MINGW32)
if test -n "/mingw32"; then
:
elif test -d "/mingw32/include"; then
CPPFLAGS="-I/mingw32/include ${CPPFLAGS}"
else
continue
fi
ac_cv_header_popt_h=""
unset ac_cv_header_popt_h
AC_CHECK_HEADER([popt.h], [popth_found=yes])
;;
MINGW64)
if test -n "${popt_prefix}"; then
:
elif test -d "/mingw64/include"; then
CPPFLAGS="-I/mingw64/include ${CPPFLAGS}"
else
continue
fi
ac_cv_header_popt_h=""
unset ac_cv_header_popt_h
AC_CHECK_HEADER([popt.h], [popth_found=yes])
;;
*)
for popt_prefix in "" /usr /usr/local
do
if test -n "${popt_prefix}"; then
:
elif test -d "${popt_prefix}/include"; then
CPPFLAGS="-I${popt_prefix}/include ${CPPFLAGS}"
else
continue
fi
ac_cv_header_popt_h=""
unset ac_cv_header_popt_h
AC_CHECK_HEADER([popt.h], [popth_found=yes])
if test "$popth_found" = yes; then break; fi
done
;;
esac
CPPFLAGS="$CPPFLAGS_save"
if test "$popth_found" = "yes"; then
if test "$popt_prefix" = ""; then
POPT_CFLAGS=""
else
POPT_CFLAGS="-I${popt_prefix}/include"
fi
elif test "$require_popt" = "yes"; then
AC_MSG_ERROR([
* Cannot autodetect popt.h
*
* Set POPT_CFLAGS and POPT_LIBS correctly.
])
fi
# try to find options to link against popt
LDFLAGS_save="$LDFLAGS"
popt_links=no
case "$MSYSTEM" in
MINGW32)
# for ldir in "" lib; do
popt_libdir="/mingw32/lib"
if test "${popt_libdir}" = "/"; then
popt_libdir=""
elif test -d "${popt_libdir}"; then
LDFLAGS="-L${popt_libdir} ${LDFLAGS}"
else
continue
fi
# Avoid caching of results
ac_cv_lib_popt_poptStuffArgs=""
unset ac_cv_lib_popt_poptStuffArgs
AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes])
;;
MINGW64)
popt_libdir="/mingw64/lib"
if test "${popt_libdir}" = "/"; then
popt_libdir=""
elif test -d "${popt_libdir}"; then
LDFLAGS="-L${popt_libdir} ${LDFLAGS}"
else
continue
fi
# Avoid caching of results
ac_cv_lib_popt_poptStuffArgs=""
unset ac_cv_lib_popt_poptStuffArgs
AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes])
;;
*)
for popt_prefix in /usr "" /usr/local; do
# We could have "/usr" and "lib64" at the beginning of the
# lists. Then the first tested location would
# incidentally be the right one on 64bit systems, and
# thus work around a bug in libtool on 32bit systems:
#
# 32bit libtool doesn't know about 64bit systems, and so the
# compilation will fail when linking a 32bit library from
# /usr/lib to a 64bit binary.
#
# This hack has been confirmed to workwith a
# 32bit Debian Sarge and 64bit Fedora Core 3 system.
for ldir in lib64 "" lib; do
popt_libdir="${popt_prefix}/${ldir}"
if test "${popt_libdir}" = "/"; then
popt_libdir=""
elif test -d "${popt_libdir}"; then
LDFLAGS="-L${popt_libdir} ${LDFLAGS}"
else
continue
fi
# Avoid caching of results
ac_cv_lib_popt_poptStuffArgs=""
unset ac_cv_lib_popt_poptStuffArgs
AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes])
if test "$popt_links" = yes; then break; fi
done
if test "$popt_links" = yes; then break; fi
done
;;
esac
LDFLAGS="$LDFLAGS_save"
if test "$popt_links" = "yes"; then
if test "$popt_libdir" = ""; then
POPT_LIBS="-lpopt"
else
POPT_LIBS="-L${popt_libdir} -lpopt"
fi
have_popt=yes
elif test "$require_popt" = "yes"; then
AC_MSG_ERROR([
* Cannot autodetect library directory containing popt
*
* Set POPT_CFLAGS and POPT_LIBS correctly.
])
fi
elif test "x$POPT_CFLAGS" != "x" && test "x$POPT_LIBS" != "x"; then
# just use the user specivied option
popt_msg="yes (user specified)"
have_popt=yes
else
AC_MSG_ERROR([
* Fatal: Either set both POPT_CFLAGS and POPT_LIBS or neither.
])
fi
AC_MSG_CHECKING([if popt is functional])
if test "$require_popt$have_popt" = "yesno"; then
AC_MSG_RESULT([no, but required])
AC_MSG_ERROR([
* popt library not found
* Fatal: ${PACKAGE_NAME} (${PACKAGE_TARNAME}) requires popt
* Please install it and/or set POPT_CFLAGS and POPT_LIBS.
])
fi
AC_MSG_RESULT([${have_popt}])
GP_CONFIG_MSG([use popt library], [${have_popt}])
if test "$have_popt" = "yes"; then
AC_DEFINE([HAVE_POPT],[1],[whether the popt library is available])
GP_CONFIG_MSG([popt libs],[${POPT_LIBS}])
GP_CONFIG_MSG([popt cppflags],[${POPT_CFLAGS}])
fi
AM_CONDITIONAL([HAVE_POPT],[test "$have_popt" = "yes"])
])dnl
dnl
dnl Please do not remove this:
dnl filetype: 7595380e-eff3-49e5-90ab-e40f1d544639
dnl I use this to find all the different instances of this file which
dnl are supposed to be synchronized.
dnl
dnl Local Variables:
dnl mode: autoconf
dnl End:

48
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-check-shell-environment.m4

@ -0,0 +1,48 @@
dnl @synopsis GP_CHECK_SHELL_ENVIRONMENT([SHOW-LOCALE-VARS])
dnl
dnl Check that the shell environment is sane.
dnl
dnl If SHOW-LOCALE-VARS is set to [true], print all LC_* and LANG*
dnl variables at configure time. (WARNING: This is not portable!)
dnl
dnl
AC_DEFUN([GP_CHECK_SHELL_ENVIRONMENT],
[
# make sure "cd" doesn't print anything on stdout
if test x"${CDPATH+set}" = xset
then
CDPATH=:
export CDPATH
fi
# make sure $() command substitution works
AC_MSG_CHECKING([for POSIX sh \$() command substitution])
if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`" # ''''
then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
uname=`uname 2>&1` # ''
uname_a=`uname -a 2>&1` # ''
AC_MSG_ERROR([
* POSIX sh \$() command substition does not work with this shell.
*
* You are running a very rare species of shell. Please report this
* sighting to <${PACKAGE_BUGREPORT}>:
* SHELL=${SHELL}
* uname=${uname}
* uname-a=${uname_a}
* Please also include your OS and version.
*
* Run this configure script using a better (i.e. POSIX compliant) shell.
])
fi
dnl
m4_if([$1],[true],[dnl
printenv | grep -E '^(LC_|LANG)'
])dnl
dnl
])dnl
dnl

102
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-config-msg.m4

@ -0,0 +1,102 @@
dnl
dnl GP_CONFIG_INIT
dnl use default LHS width (called implicitly if not called explicitly)
dnl GP_CONFIG_INIT([WIDTH-OF-LHS])
dnl explicitly set the LHS width to the given value
dnl
dnl GP_CONFIG_MSG
dnl empty output line
dnl GP_CONFIG_MSG([LHS],[RHS])
dnl formatted output line "LHS: RHS"
dnl
dnl GP_CONFIG_OUTPUT
dnl print all the output messages we collected in the mean time
dnl
dnl Simple way to print a configuration summary at the end of ./configure.
dnl
dnl Example usage:
dnl
dnl GP_CONFIG_INIT
dnl GP_CONFIG_MSG([Source code location],[${srcdir}])
dnl GP_CONFIG_MSG([Compiler],[${CC}])
dnl GP_CONFIG_MSG
dnl GP_CONFIG_MSG([Feature foo],[${foo}])
dnl GP_CONFIG_MSG([Location of bar],[${bar}])
dnl [...]
dnl AC_OUTPUT
dnl GP_CONFIG_OUTPUT
dnl
dnl
AC_DEFUN([GP_CONFIG_INIT],
[dnl
AC_REQUIRE([GP_CHECK_SHELL_ENVIRONMENT])
dnl the empty string must contain at least as many spaces as the substr length
dnl FIXME: let m4 determine that length
dnl (collect left parts in array and choose largest length)
m4_if([$1],[],[gp_config_len="30"],[gp_config_len="$1"])
gp_config_empty=""
gp_config_len3="$(expr "$gp_config_len" - 3)"
n="$gp_config_len"
while test "$n" -gt 0; do
gp_config_empty="${gp_config_empty} "
n="$(expr "$n" - 1)"
done
gp_config_msg="
Configuration (${PACKAGE_TARNAME} ${PACKAGE_VERSION}):
"
])dnl
dnl
dnl
AC_DEFUN([GP_CONFIG_MSG],
[AC_REQUIRE([GP_CONFIG_INIT])dnl
m4_if([$1],[],[
gp_config_msg="${gp_config_msg}
"
],[$2],[],[
gp_config_msg="${gp_config_msg}
[$1]
"
],[
gp_config_msg_len="$(expr "[$1]" : '.*')"
if test "$gp_config_msg_len" -ge "$gp_config_len"; then
gp_config_msg_lhs="$(expr "[$1]" : "\(.\{0,${gp_config_len3}\}\)")..:"
else
gp_config_msg_lhs="$(expr "[$1]:${gp_config_empty}" : "\(.\{0,${gp_config_len}\}\)")"
fi
gp_config_msg="${gp_config_msg} ${gp_config_msg_lhs} [$2]
"
])])dnl
dnl
AC_DEFUN([GP_CONFIG_MSG_SUBDIRS],[dnl
# Message about configured subprojects
if test "x$subdirs" != "x"; then
GP_CONFIG_MSG()dnl
_subdirs=""
for sd in $subdirs; do
ssd="$(basename "$sd")"
if test "x$_subdirs" = "x"; then
_subdirs="$ssd";
else
_subdirs="$_subdirs $ssd"
fi
done
GP_CONFIG_MSG([Subprojects],[${_subdirs}])dnl
fi
])dnl
dnl
AC_DEFUN([GP_CONFIG_OUTPUT],
[AC_REQUIRE([GP_CONFIG_INIT])dnl
AC_REQUIRE([GP_CONFIG_MSG])dnl
AC_REQUIRE([GP_CONFIG_MSG_SUBDIRS])dnl
echo "${gp_config_msg}
You may run \"make\" and \"make install\" now."
])dnl
dnl
dnl Please do not remove this:
dnl filetype: de774af3-dc3b-4b1d-b6f2-4aca35d3da16
dnl I use this to find all the different instances of this file which
dnl are supposed to be synchronized.
dnl
dnl Local Variables:
dnl mode: autoconf
dnl End:

113
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-documentation.m4

@ -0,0 +1,113 @@
dnl
dnl check where to install documentation
dnl
dnl determines documentation "root directory", i.e. the directory
dnl where all documentation will be placed in
dnl
AC_DEFUN([GP_CHECK_DOC_DIR],
[
AC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl
AC_BEFORE([$0], [GP_CHECK_DOXYGEN])dnl
AC_ARG_WITH([doc-dir],
[AS_HELP_STRING([--with-doc-dir=PATH],
[Where to install docs [default=autodetect]])])
# check for the main ("root") documentation directory
AC_MSG_CHECKING([main docdir])
if test "x${with_doc_dir}" != "x"
then # docdir is given as parameter
docdir="${with_doc_dir}"
AC_MSG_RESULT([${docdir} (from parameter)])
else # otherwise invent a docdir hopefully compatible with system policy
if test -d "/usr/share/doc"
then
maindocdir='${prefix}/share/doc'
AC_MSG_RESULT([${maindocdir} (FHS style)])
elif test -d "/usr/doc"
then
maindocdir='${prefix}/doc'
AC_MSG_RESULT([${maindocdir} (old style)])
else
maindocdir='${datadir}/doc'
AC_MSG_RESULT([${maindocdir} (default value)])
fi
AC_MSG_CHECKING([package docdir])
# check whether to include package version into documentation path
# FIXME: doesn't work properly.
if ls -d /usr/{share/,}doc/make-[0-9]* > /dev/null 2>&1
then
docdir="${maindocdir}/${PACKAGE}-${VERSION}"
AC_MSG_RESULT([${docdir} (redhat style)])
else
docdir="${maindocdir}/${PACKAGE}"
AC_MSG_RESULT([${docdir} (default style)])
fi
fi
AC_SUBST([docdir])
])dnl
dnl
dnl check whether to build docs and where to:
dnl
dnl * determine presence of prerequisites (only gtk-doc for now)
dnl * determine destination directory for HTML files
dnl
AC_DEFUN([GP_BUILD_GTK_DOCS],
[
# docdir has to be determined in advance
AC_REQUIRE([GP_CHECK_DOC_DIR])
# ---------------------------------------------------------------------------
# gtk-doc: We use gtk-doc for building our documentation. However, we
# require the user to explicitely request the build.
# ---------------------------------------------------------------------------
try_gtkdoc=false
gtkdoc_msg="no (not requested)"
have_gtkdoc=false
AC_ARG_ENABLE([docs],
[AS_HELP_STRING([--enable-docs],
[Use gtk-doc to build documentation [default=no]])],[
if test x$enableval = xyes; then
try_gtkdoc=true
fi
])
if $try_gtkdoc; then
AC_PATH_PROG([GTKDOC],[gtkdoc-mkdb])
if test -n "${GTKDOC}"; then
have_gtkdoc=true
gtkdoc_msg="yes"
else
gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)"
fi
fi
AM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc])
GP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg])
# ---------------------------------------------------------------------------
# Give the user the possibility to install html documentation in a
# user-defined location.
# ---------------------------------------------------------------------------
AC_ARG_WITH([html-dir],
[AS_HELP_STRING([--with-html-dir=PATH],
[Where to install html docs [default=autodetect]])])
AC_MSG_CHECKING([for html dir])
if test "x${with_html_dir}" = "x" ; then
htmldir="${docdir}/html"
AC_MSG_RESULT([${htmldir} (default)])
else
htmldir="${with_html_dir}"
AC_MSG_RESULT([${htmldir} (from parameter)])
fi
AC_SUBST([htmldir])
apidocdir="${htmldir}/api"
AC_SUBST([apidocdir])
])dnl

60
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-dynamic-libraries.m4

@ -0,0 +1,60 @@
AC_DEFUN([GP_DYNAMIC_LIBRARIES],[dnl
dnl We require either of those
dnl AC_REQUIRE([AC_LIBTTDL_INSTALLABLE])dnl
dnl AC_REQUIRE([AC_LIBLTDL_CONVENIENCE])dnl
AC_REQUIRE([AC_LIBTOOL_DLOPEN])dnl
AC_REQUIRE([AC_PROG_LIBTOOL])dnl
dnl ---------------------------------------------------------------------------
dnl Check for libltdl:
dnl - lt_dlforeachfile has been introduced in libtool-1.4.
dnl - However, there are still systems out there running libtool-1.3.
dnl For those, we will use our shipped libltdl. This has the welcome
dnl side effect that we don't have to distinguish between libltdl 1.3 with
dnl and without the notorious segfault bug.
dnl - FIXME: In case we're using our own version, we have to check whether
dnl -ldl is required?
dnl ---------------------------------------------------------------------------
# $0
ltdl_msg="no (not found or too old)"
have_ltdl=false
LIBS_save="$LIBS"
LIBS="$LIBLTDL"
AC_CHECK_LIB([ltdl], [lt_dlforeachfile],[
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="$LTDLINCL"
AC_CHECK_HEADER([ltdl.h],[
AC_DEFINE([HAVE_LTDL],1,[whether we use libltdl])
ltdl_msg="yes (from system)"
have_ltdl=:
])
CPPFLAGS="$CPPFLAGS_save"
])
LIBS="$LIBS_save"
if "$have_ltdl"; then :; else
AC_MSG_CHECKING([for included libltdl])
if test -d "$srcdir/libltdl"; then
LIBLTDL="\$(top_builddir)/libltdl/libltdlc.la"
LTDLINCL="-I\$(top_srcdir)/libltdl"
have_ltdl=:
ltdl_msg="yes (included)"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([
*** Could not detect or configure libltdl.
])
fi
fi
GP_CONFIG_MSG([libltdl],["${ltdl_msg}"])
])dnl
dnl
dnl ####################################################################
dnl
dnl Please do not remove this:
dnl filetype: 2b993145-3256-47b4-84fd-ec4dcdf4fdf9
dnl I use this to find all the different instances of this file which
dnl are supposed to be synchronized.
dnl
dnl Local Variables:
dnl mode: autoconf
dnl End:

78
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-gettext-hack.m4

@ -0,0 +1,78 @@
dnl
dnl GP_GETTEXT_HACK
dnl
dnl gettext hack, originally designed for libexif, libgphoto2, and Co.
dnl This creates a po/Makevars file with adequate values if the
dnl po/Makevars.template is present.
dnl
dnl Example usage:
dnl GP_GETTEXT_HACK([${PACKAGE_TARNAME}-${LIBFOO_CURRENT}],
dnl [Copyright Holder],
dnl [foo-translation@example.org])
dnl ALL_LINGUAS="de es fr"
dnl AM_GNU_GETTEXT_VERSION([0.14.1])
dnl AM_GNU_GETTEXT([external])
dnl AM_PO_SUBDIRS()
dnl AM_ICONV()
dnl GP_GETTEXT_FLAGS
dnl
dnl You can leave out the GP_GETTEXT_HACK parameters if you want to,
dnl GP_GETTEXT_HACK will try fall back to sensible values in that case:
dnl
AC_DEFUN([GP_GETTEXT_HACK],
[
AC_BEFORE([$0], [AM_GNU_GETTEXT])dnl
AC_BEFORE([$0], [AM_GNU_GETTEXT_VERSION])dnl
m4_if([$1],[],[GETTEXT_PACKAGE="${PACKAGE_TARNAME}"],[GETTEXT_PACKAGE="$1"])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
[The gettext domain we're using])
AC_SUBST([GETTEXT_PACKAGE])
sed_cmds="s|^DOMAIN.*|DOMAIN = ${GETTEXT_PACKAGE}|"
m4_if([$2],[],[],[sed_cmds="${sed_cmds};s|^COPYRIGHT_HOLDER.*|COPYRIGHT_HOLDER = $2|"])
m4_ifval([$3],[
if test -n "$PACKAGE_BUGREPORT"; then
sed_mb="${PACKAGE_BUGREPORT}"
else
AC_MSG_ERROR([
*** Your configure.{ac,in} is wrong.
*** Either define PACKAGE_BUGREPORT (by using the 4-parameter AC INIT syntax)
*** or give [GP_GETTEXT_HACK] the third parameter.
***
])
fi
],[
sed_mb="$3"
])
sed_cmds="${sed_cmds};s|^MSGID_BUGS_ADDRESS.*|MSGID_BUGS_ADDRESS = ${sed_mb}|"
# Not so sure whether this hack is all *that* evil...
AC_MSG_CHECKING([for po/Makevars requiring hack])
if test -f "${srcdir}/po/Makevars.template"; then
sed "$sed_cmds" < "${srcdir}/po/Makevars.template" > "${srcdir}/po/Makevars"
AC_MSG_RESULT([yes, done.])
else
AC_MSG_RESULT([no])
fi
])
AC_DEFUN([GP_GETTEXT_FLAGS],
[
AC_REQUIRE([AM_GNU_GETTEXT])
AC_REQUIRE([GP_CONFIG_INIT])
if test "x${BUILD_INCLUDED_LIBINTL}" = "xyes"; then
AM_CFLAGS="${AM_CFLAGS} -I\$(top_srcdir)/intl"
fi
GP_CONFIG_MSG([Use translations],[${USE_NLS}])
if test "x$USE_NLS" = "xyes" && test "${BUILD_INCLUDED_LIBINTL}"; then
GP_CONFIG_MSG([Use included libintl],[${BUILD_INCLUDED_LIBINTL}])
fi
])
dnl Please do not remove this:
dnl filetype: 71ff3941-a5ae-4677-a369-d7cb01f92c81
dnl I use this to find all the different instances of this file which
dnl are supposed to be synchronized.
dnl Local Variables:
dnl mode: autoconf
dnl End:

29
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-internal-docs.m4

@ -0,0 +1,29 @@
dnl
dnl
dnl
AC_DEFUN([GP_INTERNAL_DOCS],[dnl
# Whether to enable the internal docs build.
#
# This takes quite some time due to the generation of lots of call
# graphs, so it is disabled by default.
set_enable_internal_docs=no
AC_ARG_ENABLE([internal-docs], [dnl
AS_HELP_STRING([--enable-internal-docs],
[Build internal code docs if doxygen available])], [dnl
dnl If either --enable-foo nor --disable-foo were given, execute this.
if test "x$enableval" = xno \
|| test "x$enableval" = xoff \
|| test "x$enableval" = xfalse;
then
set_enable_internal_docs=no
elif test "x$enableval" = xyes \
|| test "x$enableval" = xon \
|| test "x$enableval" = xtrue
then
set_enable_internal_docs=yes
fi
])
AC_MSG_CHECKING([whether to create internal code docs])
AC_MSG_RESULT([${set_enable_internal_docs}])
AM_CONDITIONAL([ENABLE_INTERNAL_DOCS], [test "x${set_enable_internal_docs}" = "xyes"])
])dnl

59
lib/hardware/sensors/gphoto/gphoto2-master/gphoto-m4/gp-libltdl.m4

@ -0,0 +1,59 @@
dnl Written by Hans Ulrich Niedermann
dnl LDFLAGS vs LIBS fix by Dan Nicholson
dnl
dnl We are using our own libltdl checks instead of AC_WITH_LTDL
dnl because we do not want to ship our own copy of libltdl any more.
dnl Not shipping libltdl makes it possible to ditch our own autogen.sh
dnl and relying on standard autoconf's "autoreconf".
dnl
dnl Look for external libltdl, not shipping internal libltdl.
AC_DEFUN([GP_LIB_LTDL],[dnl
AC_ARG_VAR([LTDLINCL],[CFLAGS for compiling with libltdl])
AC_ARG_VAR([LIBLTDL],[LIBS to add for linking against libltdl])
if test "x${LTDLINCL}${LIBLTDL}" = "x"; then
AC_CHECK_HEADER([ltdl.h],
[dnl
AC_CHECK_LIB([ltdl], [lt_dlinit],[dnl
LTDLINCL=""
LIBLTDL="-lltdl"
AC_DEFINE([HAVE_LTDL],[1],[Whether libltdl (of libtool fame) is present])
],[dnl
AC_MSG_ERROR([
$PACKAGE requires the ltdl library, included with libtool
Please make sure that the proper development package is installed
(libltdl-dev, libtool-ltdl-devel, etc.)
])[]dnl
])dnl
])
else
AC_MSG_CHECKING([for libltdl flags])
AC_MSG_RESULT([set explicitly: ${LTDLINCL} ${LIBLTDL}])
fi
AC_SUBST([LTDLINCL])
AC_SUBST([LIBLTDL])
dnl
dnl Make sure we can actually compile and link against libltdl
AC_LANG_PUSH([C])
AC_MSG_CHECKING([that we can compile and link with libltdl])
saved_CPPFLAGS="$CPPFLAGS"
saved_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $LTDLINCL"
LIBS="$LIBS $LIBLTDL"
AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
#include <stdlib.h> /* for NULL */
#include <ltdl.h> /* for lt_* */
],[dnl
int ret = lt_dlforeachfile("/usr/lib:/usr/local/lib", NULL, NULL);
])], [AC_MSG_RESULT([yes])], [dnl
AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot compile and link against libltdl
${PACKAGE_TARNAME} requires libltdl (the libtool dl* library),
but cannot compile and link against it.
Aborting.
])
])
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
AC_LANG_POP
])dnl

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save