indi-beefocus-0.1+20220128183230/0000755000175100017510000000000014175036520014676 5ustar debiandebianindi-beefocus-0.1+20220128183230/unit_tests/0000755000175100017510000000000014174600255017100 5ustar debiandebianindi-beefocus-0.1+20220128183230/unit_tests/test_driver.cpp0000644000175100017510000002476114174600255022150 0ustar debiandebian#include "test_helpers.h" #include #include #include #include "beefocus.h" #include "indistandardproperty.h" #include "lilxml.h" namespace BeeTest { /// /// @brief Advance time on the simulated driver /// /// @param[out] driver - The BeeFocused driver /// @param[in] mSec - The amount of time, in mSec, to move forward. /// void AdvanceTimeForward( BeeFocused::Driver& driver, unsigned int mSec) { // // For simplicity, restrict to 'AdvanceOnTimerHit' intervals. // ASSERT_EQ( 0, mSec % BeeFocused::AdvanceOnTimerHit ); unsigned int timerHits = mSec / BeeFocused::AdvanceOnTimerHit; for ( unsigned int i = 0; i < timerHits; ++i ) { driver.TimerHit(); } } /// /// @brief Test the Tokenizer used to parse input from the Firmware /// TEST( DEVICE, BasicTokenizer) { auto result = BeeFocused::Tokenize( std::string("my dog has fleas")); std::vector golden = {"my", "dog", "has", "fleas" }; ASSERT_EQ( result, golden ); } /// /// @brief Test the Tokenizer used to parse input from the Firmware /// /// Extra spaces case. /// TEST( DEVICE, StringWithExtraSpaces) { auto result = BeeFocused::Tokenize( std::string(" my dog has fleas ")); std::vector golden = {"my", "dog", "has", "fleas" }; ASSERT_EQ( result, golden ); } /// /// @brief Basic connect to device and verify. /// /// Connects to the simulate device and checks output. Used by >1 test /// /// Flow Control: /// /// 1. Do basic initialization /// 2. Set the connection mode to "Simulated" /// 3. Attempt to connect /// 4. Look for connection messages in the output /// void EstablishConnection( BeeFocused::Driver& driver ) { ITH::StdoutCapture outCap; // 1. Do basic initialization driver.setDeviceName("BeeFocusUnitTest"); driver.ISGetProperties( driver.getDeviceName() ); // 2. Set the connection mode to "Simulated" ITH::TurnSwitch( driver, "CONNECTION_MODE", ITH::StateData{{{"SIMULATED_CONNECTION", ISS_ON }}} ); // 3. Attempt to connect ITH::TurnSwitch( driver, INDI::SP::CONNECTION, ITH::StateData{{{"CONNECT", ISS_ON }}} ); // 4. Look for connection messages in the output std::string output = outCap.getOutput(); ASSERT_NE( std::string::npos, output.find("[INFO] Handshake Success")); ASSERT_NE( std::string::npos, output.find("[INFO] BeeFocusUnitTest is online")); ASSERT_NE( std::string::npos, output.find("[INFO] Connection Succeeded")); } /// /// @brief Verify device connects properly. /// /// 1. Establish Connection /// 2. Check Connection Status message /// 3. Disconnect and check connection status. /// TEST( DEVICE, FocuserConnectsProperly ) { // 1. Establish Connection // BeeFocused::Driver driver; EstablishConnection( driver ); // // 2. Check Connection Status message // // The connection status is updated on TimerHit. Move time forward // a bit and check for the proper connection status. // { ITH::StdoutCapture outCap; AdvanceTimeForward( driver, 250 ); ITH::XMLCapture xml( outCap.getOutput() ); ASSERT_EQ( xml.lastState( "CONNECT_STATUS"), "Connected" ); } // 3. Disconnect and check connection status. { ITH::StdoutCapture outCap; ITH::TurnSwitch( driver, INDI::SP::CONNECTION, ITH::StateData{{{"DISCONNECT", ISS_ON }}} ); AdvanceTimeForward( driver, 250 ); ITH::XMLCapture xml( outCap.getOutput() ); ASSERT_EQ( xml.lastState( "CONNECT_STATUS"), "Not Connected" ); } } /// /// @brief Verify that a focuser with an end-stop auto-syncs /// /// Flow Control: /// /// 1. Establish Connection /// 2. Advance time by 4000 ms and verify focuser isn't synced yet /// 3. Advance time by 200 ms and verify focuser is now synced /// TEST( DEVICE, FocuserHomesToEndStop) { // 1. Establish Connection BeeFocused::Driver driver; EstablishConnection( driver ); // 2. Advance time by 4000 ms and verify focuser isn't synced yet { ITH::StdoutCapture outCap; AdvanceTimeForward( driver, 4000 ); ITH::XMLCapture xml( outCap.getOutput() ); ASSERT_EQ( xml.lastState( "HOME_STATUS"), "Not Synced" ); } // 3. Advance time by 200 ms and verify focuser is now synced { ITH::StdoutCapture outCap; AdvanceTimeForward( driver, 250 ); ITH::XMLCapture xml( outCap.getOutput() ); ASSERT_EQ( xml.lastState( "HOME_STATUS"), "Synced" ); } } /// /// @brief Verify Set Absolute Position works & interrupts home /// /// 1. Set an absolute position before we finish homing. /// 2. Verify the focuser reaches the target position given time. /// 3. Try a value past the maximum focuser position (35000) /// TEST( DEVICE, SetABSPos ) { BeeFocused::Driver driver; EstablishConnection( driver ); /// 1. Set an absolute position before we finish homing. { ITH::StdoutCapture outCap; AdvanceTimeForward( driver, 2000 ); ITH::SetNumber( driver, "ABS_FOCUS_POSITION", ITH::NumberData{{{"FOCUS_ABSOLUTE_POSITION", 1000.0 }}} ); AdvanceTimeForward( driver, 2000 ); ITH::XMLCapture xml( outCap.getOutput() ); // should be not synced (home interrupted) and at // position 0 (still re-winding from the home attempt) ASSERT_EQ( xml.lastState( "HOME_STATUS"), "Not Synced" ); ASSERT_EQ( xml.lastState( "ABS_FOCUS_POSITION"), "Busy" ); ASSERT_EQ( xml.lastState( "FOCUS_ABSOLUTE_POSITION"), "0" ); } /// 2. Verify the focuser reaches the target position given time. { ITH::StdoutCapture outCap; AdvanceTimeForward( driver, 5000); std::string myout = outCap.getOutput(); ITH::XMLCapture xml( myout ); ASSERT_EQ( xml.lastState( "FOCUS_ABSOLUTE_POSITION"), "1000" ); ASSERT_EQ( xml.lastState( "ABS_FOCUS_POSITION"), "Ok" ); } // 3. Try a value past the maximum focuser position (35000) { ITH::StdoutCapture outCap; ITH::SetNumber( driver, "ABS_FOCUS_POSITION", ITH::NumberData{{{"FOCUS_ABSOLUTE_POSITION", 50000.0 }}} ); AdvanceTimeForward( driver, 100000); std::string output = outCap.getOutput(); ITH::XMLCapture xml( output ); // Verify warning issued, and that we don't move past 35000. ASSERT_NE( std::string::npos, output.find("[WARNING] Focuser will not move past maximum value of 35000")); ASSERT_EQ( xml.lastState( "FOCUS_ABSOLUTE_POSITION"), "35000" ); ASSERT_EQ( xml.lastState( "ABS_FOCUS_POSITION"), "Ok" ); } } /// /// @brief Verify that abort works /// /// 1. Test Abort while homing at start-up /// 2. Start a move and verify that we're moving /// 3. Issue an abort. Focuser should stop moving. /// 4. Make sure focuser position doesn't change if more time passes. /// TEST( DEVICE, TestAbort ) { BeeFocused::Driver driver; EstablishConnection( driver ); /// 1. Test Abort while homing at start-up { ITH::StdoutCapture outCap; AdvanceTimeForward( driver, 2000 ); ITH::TurnSwitch( driver, "FOCUS_ABORT_MOTION", ITH::StateData{{{"ABORT", ISS_ON }}} ); // Give plenty of time to make sure we aborted. AdvanceTimeForward( driver, 10000 ); ITH::XMLCapture xml( outCap.getOutput() ); // should be not synced (abort interrupted) and at // position 0 (still re-winding from the home attempt) ASSERT_EQ( xml.lastState( "HOME_STATUS"), "Not Synced" ); ASSERT_EQ( xml.lastState( "ABS_FOCUS_POSITION"), "Ok" ); ASSERT_EQ( xml.lastState( "FOCUS_ABSOLUTE_POSITION"), "0" ); } // 2. Start a move and verify that we're moving { ITH::StdoutCapture outCap; ITH::SetNumber( driver, "ABS_FOCUS_POSITION", ITH::NumberData{{{"FOCUS_ABSOLUTE_POSITION", 10000.0 }}} ); AdvanceTimeForward( driver, 3000 ); ITH::XMLCapture xml( outCap.getOutput() ); ASSERT_EQ( xml.lastState( "ABS_FOCUS_POSITION"), "Busy" ); ASSERT_NE( xml.lastState( "FOCUS_ABSOLUTE_POSITION"), "0" ); } // 3. Issue an abort. Focuser should stop moving. { ITH::StdoutCapture outCap; ITH::TurnSwitch( driver, "FOCUS_ABORT_MOTION", ITH::StateData{{{"ABORT", ISS_ON }}} ); // A tiny bit of time to make sure we aborted. AdvanceTimeForward( driver, 750 ); ITH::XMLCapture xml( outCap.getOutput() ); ASSERT_EQ( xml.lastState( "ABS_FOCUS_POSITION"), "Ok" ); ASSERT_NE( xml.lastState( "FOCUS_ABSOLUTE_POSITION"), "0" ); } // 4. Make sure focuser position doesn't change if more time passes. { ITH::StdoutCapture outCap; AdvanceTimeForward( driver, 5000 ); ASSERT_EQ( outCap.getOutput(), "" ); } } /// /// @brief Verify that Syncing works /// /// 1. Set absolute position to 1000 (also interrupts homing) /// 2. Sync to 0 /// 3. Sync to 1234 /// TEST( DEVICE, TestSync ) { BeeFocused::Driver driver; EstablishConnection( driver ); // 1. Set absolute position to 1000 (also interrupts homing) { ITH::StdoutCapture outCap; AdvanceTimeForward( driver, 1000 ); ITH::SetNumber( driver, "ABS_FOCUS_POSITION", ITH::NumberData{{{"FOCUS_ABSOLUTE_POSITION", 1000.0 }}} ); AdvanceTimeForward( driver, 10000 ); ITH::XMLCapture xml( outCap.getOutput() ); // should be not synced (home interrupted) and at // position 1000 ASSERT_EQ( xml.lastState( "HOME_STATUS"), "Not Synced" ); ASSERT_EQ( xml.lastState( "ABS_FOCUS_POSITION"), "Ok" ); ASSERT_EQ( xml.lastState( "FOCUS_ABSOLUTE_POSITION"), "1000" ); } // 2. Sync to 0 { ITH::StdoutCapture outCap; ITH::SetNumber( driver, "FOCUS_SYNC", ITH::NumberData{{{"FOCUS_SYNC_VALUE", 0.0 }}} ); AdvanceTimeForward( driver, 2000 ); ITH::XMLCapture xml( outCap.getOutput() ); ASSERT_EQ( xml.lastState( "HOME_STATUS"), "Synced" ); ASSERT_EQ( xml.lastState( "FOCUS_SYNC_VALUE"), "0" ); ASSERT_EQ( xml.lastState( "FOCUS_ABSOLUTE_POSITION"), "0" ); } // 3. Sync to 1234 { ITH::StdoutCapture outCap; ITH::SetNumber( driver, "FOCUS_SYNC", ITH::NumberData{{{"FOCUS_SYNC_VALUE", 1234 }}} ); AdvanceTimeForward( driver, 2000 ); ITH::XMLCapture xml( outCap.getOutput() ); ASSERT_EQ( xml.lastState( "FOCUS_SYNC_VALUE"), "1234" ); ASSERT_EQ( xml.lastState( "FOCUS_ABSOLUTE_POSITION"), "1234" ); } } /// /// @brief Verify that we get a maximum position from the firmware /// /// 1. Establish Connection /// 2. Advance time & verify that we got the firmware's maximum position /// TEST( DEVICE, FocuserUpdatesMaxPos ) { // 1. Establish Connection BeeFocused::Driver driver; EstablishConnection( driver ); // 2. Advance time & verify that we got the firmwares maximum position { ITH::StdoutCapture outCap; AdvanceTimeForward( driver, 1000 ); ITH::XMLCapture xml( outCap.getOutput() ); ASSERT_EQ( xml.lastState( "FOCUS_MAX_VALUE"), "35000" ); } } } // End BeeTest namespace. indi-beefocus-0.1+20220128183230/unit_tests/test_helpers.h0000644000175100017510000002301314174600255021751 0ustar debiandebian#ifndef __TEST_HELPERS_H__ #define __TEST_HELPERS_H__ #include #include #include "indistandardproperty.h" #include "defaultdevice.h" namespace ITH { /// /// @brief C String Wrapper. /// /// A lot of INDI's interfaces want a Raw C String in the form of a pointer /// to char * (and not const char *). /// /// CStringWrap provides a wrapper for these strings so we can store them /// into other standard template library containers. /// class CStringWrap { public: // Delete unused operators for safety. CStringWrap() = delete; CStringWrap& operator=( const CStringWrap& ) = delete; /// @brief Make a wrapped C String from an std::string CStringWrap( const std::string &name_rhs ) { name = std::unique_ptr( new char[ name_rhs.length() + 1 ] ); strncpy( name.get(), name_rhs.c_str(), name_rhs.length() + 1 ); } /// @brief Make a wrapped C String from another wrapped C String. CStringWrap( const CStringWrap& name_rhs ) { size_t length = strlen( name_rhs.get() ); name = std::unique_ptr( new char[ length + 1 ] ); strncpy( name.get(), name_rhs.get(), length + 1 ); } /// @brief Get the raw C string char* get() { return name.get(); } /// @brief Get a constant C string if the class is constant. const char* get() const { return name.get(); } private: // unique pointer will take care of deallocation and make sure we don't // ever do a double deallocation. std::unique_ptr name; }; /// /// @brief Container for INDI name / data values (where data is templated) /// /// INDI's interfaces often take an array of chars and data. i.e., if I /// want to set a switch value with ISNewSwitch I need an array of /// char ** for the names of the switches and an array of ISState * for /// the values. /// /// This class takes name / value pairs in a C++ 11 convenient and safely /// maps them into the format that INDI calls want. /// /// Templated so it can be used with ISState and double. /// template class NamesContainer { public: using NameDataPair = std::pair< const std::string, const T >; /// Thanos snap unused operators. NamesContainer() = delete; NamesContainer& operator=(const NamesContainer) = delete; /// /// @brief Create the container with name/ data pairs. /// /// Example Input (for ISState ) { { "ABORT", ISS_ON } } /// NamesContainer( const std::vector< NameDataPair > &input ) { for ( const auto &name_state_pair: input ) { names_cstr.push_back( name_state_pair.first ); states.push_back( name_state_pair.second ); } // Aliased pointers == have to be careful. Past this // point we should never change names_cstr without // updating names_cstr_alias (and we don't). for ( auto &c_str: names_cstr ) { names_cstr_alias.push_back(c_str.get()); } } /// /// @brief Copy Constructor /// NamesContainer( const NamesContainer& rhs ) : names_cstr{ rhs.names_cstr }, states{ rhs.states } { // Re-alias the raw pointers so they point to data we own. for ( auto &c_str: names_cstr ) { names_cstr_alias.push_back(c_str.get()); } } /// @brief Get the names in INDI Friendly format. char **getNames() { return names_cstr_alias.data(); } /// @brief Data the data (of Type T) in INDI Friendly format. T* getData() { return states.data(); } /// @brief Get the size so we can pass it to the INDI Interface. size_t getSize() { return names_cstr.size(); } private: // Owns data std::vector< CStringWrap > names_cstr; std::vector< T > states; // Aliases data in names_cstr. std::vector< char* > names_cstr_alias; }; /// @brief INDI/ C++ 11 friendly container of Names and ISStates using StateData = NamesContainer; /// @brief INDI/ C++ 11 friendly container of Names and doubles using NumberData = NamesContainer; /// /// @brief Turn on an INDI switch. /// /// example usage: turn on the Abort button. /// /// ITH::TurnSwitch( driver, "FOCUS_ABORT_MOTION", /// ITH::StateData{{{"ABORT", ISS_ON }}} ); /// void TurnSwitch( INDI::DefaultDevice& driver, const char* switchName, ITH::StateData deltas ) { ASSERT_EQ( true, driver.ISNewSwitch( driver.getDeviceName(), switchName, deltas.getData(), deltas.getNames(), deltas.getSize() )); } /// /// @brief Set a number in the INDI Interface /// /// Example usage: set the Focuser Position to 10000 /// /// ITH::SetNumber( driver, "ABS_FOCUS_POSITION", /// ITH::NumberData{{{"FOCUS_ABSOLUTE_POSITION", 10000.0 }}} ); /// void SetNumber( INDI::DefaultDevice& driver, const char* switchName, ITH::NumberData deltas ) { ASSERT_EQ( true, driver.ISNewNumber( driver.getDeviceName(), switchName, deltas.getData(), deltas.getNames(), deltas.getSize() )); } /// /// @brief Wrapper class for standard out capture. /// /// Wraps the gtest framework's stdout capture. Mostly here to make sure /// that we reset singleton state on the Google testing framework if an /// exception occurs. /// class StdoutCapture { public: StdoutCapture( const StdoutCapture& ) = delete; StdoutCapture& operator=( const StdoutCapture& ) = delete; /// @brief Start capturing stdout. StdoutCapture() : released{ false } { testing::internal::CaptureStdout(); } /// /// @brief Reset singleton state in the gtest framework, if needed. /// /// If somebody's already called getOutput then this does nothing. /// If they haven't it gets the output and sends it to stdout. /// ~StdoutCapture() { if ( !released ) { // If nobody fetched the output then it goes back to stdout. std::cout << getOutput(); } } /// /// @brief Gets captured output from the google test framework /// std::string getOutput() { released = true; return testing::internal::GetCapturedStdout(); } private: bool released; }; /// /// @brief Smartish Pointer wrapper for XMLEle /// /// The unit test framework can use INDI's lilXML library to parse the output /// of stdout. This is a smart wrapper for some of the classes that /// lilXML returns. It's responsible for releasing the resources that we /// get from lilXML (i.e., it owns the data). /// class XMLEleWrapper { public: XMLEleWrapper() = delete; XMLEleWrapper( LilXML *lpArg, XMLEle* rootArg ) : lp{ lpArg }, root{ rootArg} { } /// Do not allow copy operations that would confuse ownership XMLEleWrapper( const XMLEleWrapper& ) = delete; XMLEleWrapper& operator=( const XMLEleWrapper& ) = delete; ~XMLEleWrapper() { delXMLEle( root ); delLilXML( lp ); } // non-ownership transferring get function. XMLEle* get() { return root ; } private: LilXML* lp; XMLEle* root; }; // Allow transfer of XMLEleWrappers, but guarantee uniqueness. using XMLElePtr = std::unique_ptr< XMLEleWrapper >; using XMLKeyValue = std::pair< std::string, std::string >; /// @brief Wrap lilxml for exception safety and general niceness. /// /// Example Usage: /// /// { /// ITH::StdoutCapture outCap; // Start stdout capture /// ... /// Driver testing code goes here /// ... /// // Create xml capture from stdout /// ITH::XMLCapture xml( outCap.getOutput() ); /// // Make sure that ABS_FOCUS_POSITION was set to "Busy" /// ASSERT_EQ( xml.lastState( "ABS_FOCUS_POSITION"), "Busy" ); /// } /// class XMLCapture { public: XMLCapture( void ) = delete; XMLCapture( const std::string& text ) { // // Create a vector of XMLElePtr Elements by parsing text // std::vector rootElements; LilXML *lp = nullptr; char errMsg[ 1024 ]; for ( char c : text ) { if ( lp == nullptr ) { lp = newLilXML(); } XMLEle *root = readXMLEle( lp, c, errMsg ); if ( root ) { rootElements.push_back( XMLElePtr(new XMLEleWrapper( lp, root )) ); lp = nullptr; } } if ( lp ) delLilXML( lp ); // // Convert the root XMLEle Elements to data my test is interested in. // for( auto& ele: rootElements ) { XMLEle* root = ele.get()->get(); XMLEle* ep; { std::string name; std::string status; for ( XMLAtt* at = nextXMLAtt( root, 1 ); at != nullptr; at = nextXMLAtt( root, 0 )) { if ( std::string( nameXMLAtt(at)) == "name" ) { name = std::string( valuXMLAtt( at )); } if ( std::string( nameXMLAtt(at)) == "state" ) { status= std::string( valuXMLAtt( at )); } } if ( name != "" and status != "" ) { xmlData.push_back( XMLKeyValue( name, status )); } } for ( ep = nextXMLEle( root,1 ); ep != nullptr; ep = nextXMLEle( root, 0 )) { std::string value( pcdataXMLEle( ep )); for ( XMLAtt* at = nextXMLAtt( ep, 1 ); at != nullptr; at = nextXMLAtt( ep, 0 )) { if ( std::string( nameXMLAtt(at)) == "name" ) { std::string key( valuXMLAtt( at )); xmlData.push_back( XMLKeyValue( key, value )); } } } } } std::string lastState( const std::string& key ) { std::string rval; for ( const auto& entry : xmlData ) { if ( entry.first == key ) { rval = entry.second; } } return rval; } private: std::vector xmlData; }; } #endif indi-beefocus-0.1+20220128183230/unit_tests/test_helpers.cpp0000644000175100017510000000051614174600255022307 0ustar debiandebian#include // We need to override "me" in the INDI driver main. char *me = nullptr; int main(int argc, char **argv) { // We need to populate "me" with something. me = new char[256]; strcpy( me, "AllTheCoolKidsAreUnitTesting" ); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } indi-beefocus-0.1+20220128183230/firmware/0000755000175100017510000000000014174600255016513 5ustar debiandebianindi-beefocus-0.1+20220128183230/firmware/debug_esp8266.h0000644000175100017510000000043514174600255021151 0ustar debiandebian#ifndef __DEBUG_ESP8266_H__ #define __DEBUG_ESP8266_H__ #include "debug_interface.h" class DebugESP8266: public DebugInterface { public: DebugESP8266(); DebugESP8266( DebugESP8266& other ) = delete; void rawWrite( const char *bytes, std::size_t numByes ) override; }; #endif indi-beefocus-0.1+20220128183230/firmware/basic_types.h0000644000175100017510000000113614174600255021172 0ustar debiandebian#ifndef __BASIC_TYPES_H__ #define __BASIC_TYPES_H__ #include namespace BeeFocus { const int noValue= -1; using IpAddress = std::array; /// /// @brief Add 1 to an enum from an enum class (wee hacky) /// /// @param[in] ENUM - the Enum Type /// @param[in] MAX_VAL - the maximum value in the enum class /// @param[in] e - the enum to increment. /// template< typename ENUM, ENUM MAX_VAL > ENUM& advance(ENUM& e ) { if ( e != MAX_VAL ) { // wee hacky e = static_cast( static_cast(e) + 1 ); } return e; } }; #endif indi-beefocus-0.1+20220128183230/firmware/main.cpp0000644000175100017510000000144414174600255020146 0ustar debiandebian #include #include "focuser_state.h" #include "net_esp8266.h" #include "hardware_esp8266.h" #include "debug_esp8266.h" std::unique_ptr focuser; void loop() { unsigned int pause = focuser->loop(); if ( pause != 0 ) { int ms = pause / 1000; int usRemainder = pause % 1000; delay( ms ); delayMicroseconds( usRemainder ); } } void setup() { std::unique_ptr wifi( new WifiInterfaceEthernet ); std::unique_ptr hardware( new HardwareESP8266 ); std::unique_ptr debug( new DebugESP8266 ); FS::BuildParams params( FS::Build::LOW_POWER_HYPERSTAR_FOCUSER ); focuser = std::unique_ptr( new FS::Focuser( std::move(wifi), std::move(hardware), std::move(debug), params ) ); } indi-beefocus-0.1+20220128183230/firmware/command_parser.h0000644000175100017510000000464414174600255021666 0ustar debiandebian#ifndef __COMMAND_PARSER_H__ #define __COMMAND_PARSER_H__ #include "basic_types.h" #include "hardware_interface.h" #include "debug_interface.h" class NetInterface; namespace CommandParser { int process_int( const std::string& string, size_t pos ); enum class Command { StartOfCommands = 0, ///< Start of the command list Abort = 0, ///< Abort a move Home, ///< Rewind until the home pin is active LHome, ///< Lazy Home. Home if not already synched PStatus, ///< Return Position to Caller MStatus, ///< Return the Mode (i.e., "moving", "homing") SStatus, ///< Is the focuser synced (i.e., homed) ABSPos, ///< Move to an absolute position RELPos, ///< Move relative to the current position Sync, ///< Argument is the new position Firmware, ///< Get the firmware version Caps, ///< Get build specific focuser capabilities NoCommand, ///< No command was specified. EndOfCommands ///< End of the comand list. }; constexpr int NoArg = -1; class CommandPacket { public: CommandPacket(): command{Command::NoCommand}, optionalArg{NoArg} { } CommandPacket( Command c ): command{c}, optionalArg{NoArg} { } CommandPacket( Command c, int o ): command{c}, optionalArg{o} { } bool operator==( const CommandPacket &rhs ) const { return rhs.command == command && rhs.optionalArg == optionalArg; } Command command; int optionalArg; }; /// @brief Get commands from the network interface /// /// @param[in] log - Debug Log stream /// @param[in] netInterface - The network interface that we'll query /// for the command. /// @return New requests from netInterface that need to be acted /// on. /// /// TODO /// - Error handling (has none). /// - Move extra parameters used by the STATUS command. /// const CommandPacket checkForCommands( DebugInterface& log, // Input: Debug Log Strem NetInterface& netInterface // Input: Network Interface ); }; /// @brief Increment operator for Command enum /// inline CommandParser::Command& operator++( CommandParser::Command &c ) { return BeeFocus::advance< CommandParser::Command, CommandParser::Command::EndOfCommands >(c); } #endif indi-beefocus-0.1+20220128183230/firmware/hardware_interface.h0000644000175100017510000000450514174600255022505 0ustar debiandebian#ifndef __HARDWARE_INTERFACE_H__ #define __HARDWARE_INTERFACE_H__ #include #include #include "basic_types.h" struct EnumHash { // @brief Type convert any enum type to a size_t for hashing template std::size_t operator()(T enum_val) const { return static_cast(enum_val); } }; class HWI { public: virtual ~HWI() = default; enum class Pin { START_OF_PINS = 0, STEP = 0, DIR, MOTOR_ENA, HOME, END_OF_PINS }; enum class PinState { START_OF_PIN_STATES = 0, STEP_ACTIVE = 0, STEP_INACTIVE, DIR_FORWARD, DIR_BACKWARD, MOTOR_ON, // 0 on the nema build MOTOR_OFF, // 1 on the nema build HOME_ACTIVE, // 0 on the nema build HOME_INACTIVE, // 1 on the nema build END_OF_PIN_STATES }; // Arduino.h uses #define to redefine OUTPUT and INPUT, so use // M_OUTPUT and M_INPUT here. Thanks Obama. enum class PinIOMode { START_OF_PIN_IO_MODES = 0, M_OUTPUT = 0, M_INPUT = 1, END_OF_IO_MODES }; const static std::unordered_map pinNames; const static std::unordered_map pinStateNames; const static std::unordered_map pinIOModeNames; virtual void DigitalWrite( Pin pin, PinState state ) = 0; virtual void PinMode( Pin pin, PinIOMode mode ) = 0; virtual PinState DigitalRead( Pin pin) = 0; }; // @brief Increment operator for Hardware Interface Pin // // @param[in] pin - The pin to increment. // @return - The next value in the Enum. // inline HWI::Pin& operator++( HWI::Pin &pin ) { return BeeFocus::advance< HWI::Pin, HWI::Pin::END_OF_PINS >( pin ); } // @brief Increment operator for Hardware Interface Pin State // // @param[in] pinState - The pin state to increment. // @return - The next value in the Enum. // inline HWI::PinState& operator++( HWI::PinState &pin ) { return BeeFocus::advance< HWI::PinState, HWI::PinState::END_OF_PIN_STATES >( pin ); } // @brief Increment operator for Hardware Interface Pin IO Mode // // @param[in] pinIoMode - The pin IO Mode to increment. // @return - The next value in the Enum. // inline HWI::PinIOMode& operator++( HWI::PinIOMode &pin ) { return BeeFocus::advance< HWI::PinIOMode, HWI::PinIOMode::END_OF_IO_MODES >( pin ); } #endif indi-beefocus-0.1+20220128183230/firmware/simple_ostream.h0000644000175100017510000000561614174600255021717 0ustar debiandebian#ifndef __SIMPLE_OSTREAM__ #define __SIMPLE_OSTREAM__ #include // for std::size_t #include #include #include #include "basic_types.h" // for BeeFocus::IpAddress. // Like std::enable_if_t, but works in C++ 11. template< bool B, class T = void > using my_enable_if_t = typename std::enable_if::type; // Create a trait for the focuser ostreams, so we don't accidentally // try to use these templates on other ostreams (like std::ostream). template< class T> struct is_beefocus_ostream : std::integral_constant< bool, false > {}; // Specialize the classes that are allowed to use this interface. // TODO - I should move this to the class definition // TODO - Learn more template code. class WifiDebugOstream; class DebugInterface; class NetInterface; class WifiConnectionEthernet; template<> struct is_beefocus_ostream : std::integral_constant< bool, true > {}; template<> struct is_beefocus_ostream : std::integral_constant< bool, true > {}; template<> struct is_beefocus_ostream : std::integral_constant< bool, true > {}; template<> struct is_beefocus_ostream : std::integral_constant< bool, true > {}; /// @brief Output a buffer template ::value>> void rawWrite( T& ostream, const char *bytes, std::size_t numBytes ) { for ( size_t i = 0; i < numBytes; ++i ) { ostream << bytes[i]; } } /// @brief Output a WIFI IP address template ::value>> T& operator<<( T& ostream, const BeeFocus::IpAddress& address ) { ostream << address[0] << "." << address[1] << "." << address[2] << "." << address[3]; return ostream; } /// @brief Output a C style string. template ::value>> T& operator<<( T& ostream, const char* string ) { std::size_t length = strlen( string ); rawWrite( ostream, string, length ); return ostream; } /// @brief Output an unsigned number of a SIMPLE_ISTREAM. template ::value>> T& operator<<( T& ostream, unsigned int i ) { // Handle digits that aren't the lowest digit (if any) if ( i >= 10 ) { ostream << i/10; } // Handle the lowest digit ostream << (char) ('0' + (i % 10)); return ostream; } /// @brief Output an signed number of a SIMPLE_ISTREAM. template::value>> T& operator<<( T& ostream, int i ) { // Handle - if ( i < 0 ) { ostream << "-"; i = -i; } ostream << (unsigned int) i; return ostream; } /// @brief Output an std::string template::value>> T& operator<<( T& ostream, const std::string& string ) { ostream << string.c_str(); return ostream; } #endif indi-beefocus-0.1+20220128183230/firmware/debug_interface.h0000644000175100017510000000075414174600255022000 0ustar debiandebian#ifndef __DEBUG_INTERFACE_H__ #define __DEBUG_INTERFACE_H__ #include "simple_ostream.h" class DebugInterface { public: virtual ~DebugInterface() = default; virtual void rawWrite( const char *bytes, std::size_t numBytes ) = 0; }; inline DebugInterface& operator<<( DebugInterface& stream, char c ) { stream.rawWrite( &c, 1 ); return stream; } inline void rawWrite( DebugInterface& stream, const char *bytes, std::size_t numBytes ) { stream.rawWrite( bytes, numBytes ); } #endif indi-beefocus-0.1+20220128183230/firmware/net_esp8266.h0000644000175100017510000000430014174600255020644 0ustar debiandebian#ifndef __WifiInterfaceEthernet_H__ #define __WifiInterfaceEthernet_H__ #include #include #include "wifi_ostream.h" #include "wifi_secrets.h" #include "debug_interface.h" class WifiOstream; class WifiDebugOstream; class WifiConnectionEthernet: public NetConnection { public: WifiConnectionEthernet() { reset(); } ~WifiConnectionEthernet() { reset(); } void reset( void ) { m_currentIncomingBuffer=0; m_incomingBuffers[0].resize(0); m_incomingBuffers[1].resize(0); if (m_connectedClient) { m_connectedClient.stop(); } } WifiConnectionEthernet& operator<<( char c ) { putChar(c); return *this; } void putChar( char c ) override { if ( m_connectedClient ) { m_connectedClient.write( &c, 1 ); } } void initConnection( WiFiServer &server ); bool getString( WifiDebugOstream &log, std::string& string ) override; operator bool( void ) override { return m_connectedClient; } private: void handleNewIncomingData( WifiDebugOstream& log ); int m_currentIncomingBuffer; std::string m_incomingBuffers[2]; WiFiClient m_connectedClient; }; /// @brief Interface to the client /// /// This class's one job is to provide an interface to the client. /// class WifiInterfaceEthernet: public NetInterface { public: WifiInterfaceEthernet() : m_lastSlotAllocated{0}, m_kickout{0}, m_nextToKick{m_connections.begin()} { reset(); } ~WifiInterfaceEthernet() { reset(); } void reset( void ); void setup( DebugInterface& debugLog ) override; bool getString( WifiDebugOstream &log, std::string& string ) override; WifiInterfaceEthernet& operator<<( char c ) override; private: void handleNewConnections( WifiDebugOstream &log ); // Make a CI Test to lock these defaults in? static constexpr const char* ssid = WifiSecrets::ssid; static constexpr const char* password = WifiSecrets::password; const uint16_t tcp_port{4999}; WiFiServer m_server{tcp_port}; typedef std::array< WifiConnectionEthernet, 4 > ConnectionArray; ConnectionArray m_connections; int m_lastSlotAllocated; int m_kickout; ConnectionArray::iterator m_nextToKick; }; #endif indi-beefocus-0.1+20220128183230/firmware/hardware_esp8266.h0000644000175100017510000000073414174600255021662 0ustar debiandebian#ifndef __HARDWARE_ARDUINO_H__ #define __HARDWARE_ARDUINO_H__ #include "hardware_interface.h" class HardwareESP8266: public HWI { public: void DigitalWrite( Pin pin, PinState state ) override; void PinMode( Pin pin, PinIOMode state ) override; PinState DigitalRead( Pin pin) override; private: static const std::unordered_map pinMap; static const std::unordered_map pinStateMap; }; #endif indi-beefocus-0.1+20220128183230/firmware/LICENSE0000644000175100017510000006363614174600255017536 0ustar debiandebian GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 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. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, 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 library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete 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 distribute a copy of this License along with the Library. 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 Library or any portion of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, 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 Library, 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 Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you 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. If distribution of 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 satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be 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. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library 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. 9. 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 Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library 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 with this License. 11. 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 Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library 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 Library. 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. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library 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. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library 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 Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, 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 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. 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 LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. 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. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! indi-beefocus-0.1+20220128183230/firmware/command_parser.cpp0000644000175100017510000000522014174600255022210 0ustar debiandebian#include "net_interface.h" #include "debug_interface.h" #include "command_parser.h" #include "wifi_debug_ostream.h" #include #include namespace CommandParser { enum class HasArg { Yes, No }; /// @brief The Template for a bee-focuser command /// /// class CommandTemplate { public: const std::string inputCommand; CommandParser::Command outputCommand; const HasArg hasArg; }; const std::vector commandTemplates = { { "abort", Command::Abort, HasArg::No }, { "home", Command::Home, HasArg::No }, { "lazyhome", Command::LHome, HasArg::No }, { "pstatus", Command::PStatus, HasArg::No }, { "mstatus", Command::MStatus, HasArg::No }, { "sstatus", Command::SStatus, HasArg::No }, { "abs_pos", Command::ABSPos, HasArg::Yes }, { "rel_pos", Command::RELPos, HasArg::Yes }, { "sync", Command::Sync, HasArg::Yes }, { "firmware", Command::Firmware, HasArg::No }, { "caps", Command::Caps, HasArg::No }, }; /// @brief Process an integer argument /// /// Read an integer argument from a string in a way that's guaranteed /// not to allocate memory /// /// @param[in] string - The string /// @param[in] pos - The start position in the string. i.e., if pos=5 /// we'll look for the number at string element 5. /// @return - The result. Currently 0 if there's no number. /// int process_int( const std::string& string, size_t pos ) { size_t end = string.length(); if ( pos > end ) return 0; const bool negative = (string[pos] == '-'); if ( negative ) ++pos; int result = 0; for ( size_t iter = pos; iter != end; iter++ ) { char current = string[ iter ]; if ( current >= '0' && current <= '9' ) result = result * 10 + ( current - '0' ); else break; } return negative ? -result : result; } const CommandPacket checkForCommands( DebugInterface& serialLog, NetInterface& wifi ) { CommandPacket result; WifiDebugOstream log( &serialLog, &wifi ); // Read the first line of the request. static std::string command; bool dataReady = wifi.getString( log, command ); if ( !dataReady ) { return result; } std::transform( command.begin(), command.end(), command.begin(), ::tolower); log << "Got: " << command << "\n"; for ( const CommandTemplate& ct : commandTemplates ) { if ( command.find(ct.inputCommand ) == 0 ) { result.command = ct.outputCommand; if ( ct.hasArg == HasArg::Yes ) { result.optionalArg = process_int( command, ct.inputCommand.length()+1 ); } return result; } } return result; } } indi-beefocus-0.1+20220128183230/firmware/focuser_state.cpp0000644000175100017510000003574114174600255022077 0ustar debiandebian #include #include #include #include #include "command_parser.h" #include "wifi_debug_ostream.h" #include "focuser_state.h" using namespace FS; const StateToString FS::stateNames = { { State::ACCEPT_COMMANDS, "ACCEPTING_COMMANDS" }, { State::DO_STEPS, "DO_STEPS" }, { State::STEPPER_INACTIVE_AND_WAIT, "STEPPER_INACTIVE" }, { State::STEPPER_ACTIVE_AND_WAIT, "STEPPER_ACTIVE" }, { State::SET_DIR, "SET_DIR" }, { State::MOVING, "MOVING" }, { State::STOP_AT_HOME, "STOP_AT_HOME" }, { State::SLEEP, "LOW_POWER" }, { State::ERROR_STATE, "ERROR ERROR ERROR" }, }; const CommandToBool FS::doesCommandInterrupt= { { CommandParser::Command::Abort, true }, { CommandParser::Command::Home, true }, { CommandParser::Command::LHome, true }, { CommandParser::Command::PStatus, false }, { CommandParser::Command::MStatus, false }, { CommandParser::Command::SStatus, false }, { CommandParser::Command::ABSPos, true }, { CommandParser::Command::RELPos, true }, { CommandParser::Command::Sync, true }, { CommandParser::Command::Firmware, false }, { CommandParser::Command::Caps, false }, { CommandParser::Command::NoCommand, false }, }; const std::unordered_map Focuser::commandImpl = { { CommandParser::Command::Abort, &Focuser::doAbort }, { CommandParser::Command::Home, &Focuser::doHome }, { CommandParser::Command::LHome, &Focuser::doLHome }, { CommandParser::Command::PStatus, &Focuser::doPStatus }, { CommandParser::Command::MStatus, &Focuser::doMStatus }, { CommandParser::Command::SStatus, &Focuser::doSStatus }, { CommandParser::Command::ABSPos, &Focuser::doABSPos }, { CommandParser::Command::RELPos, &Focuser::doRELPos }, { CommandParser::Command::Sync, &Focuser::doSync}, { CommandParser::Command::Firmware, &Focuser::doFirmware}, { CommandParser::Command::Caps, &Focuser::doCaps}, { CommandParser::Command::NoCommand, &Focuser::doError }, }; const std::unordered_map Focuser::stateImpl = { { State::ACCEPT_COMMANDS, &Focuser::stateAcceptCommands }, { State::DO_STEPS, &Focuser::stateDoingSteps }, { State::STEPPER_INACTIVE_AND_WAIT, &Focuser::stateStepInactiveAndWait }, { State::STEPPER_ACTIVE_AND_WAIT, &Focuser::stateStepActiveAndWait }, { State::SET_DIR, &Focuser::stateSetDir }, { State::MOVING, &Focuser::stateMoving }, { State::STOP_AT_HOME, &Focuser::stateStopAtHome }, { State::SLEEP, &Focuser::stateSleep }, { State::ERROR_STATE, &Focuser::stateError } }; BuildParams::BuildParamMap BuildParams::builds = { { Build::LOW_POWER_HYPERSTAR_FOCUSER, { TimingParams { 100, // Check for new commands every 100ms 50, // Take 50 steps before checking for interrupts 5*60*1000, // Go to sleep after 5 minutes of inactivity 1000, // Check for new input in sleep mode every second 1000 // Take 1 second to power up the focuser motor on awaken }, true, // Focuser can use a home switch to synch 35000 // End of the line for my focuser } }, { Build::UNIT_TEST_BUILD_HYPERSTAR, { TimingParams { 10, // Check for new commands every 10ms 2, // Take 2 steps before checking for interrupts 1000, // Go to sleep after 1 second of inactivity 500, // Check for new input in sleep mode every 500ms 200, // Allow 200ms to power on the motor }, true, // Focuser can use a home switch to synch 35000 // End of the line for my focuser } }, { Build::TRADITIONAL_FOCUSER, { TimingParams { 100, // Check for new commands every 100ms 50, // Take 50 steps before checking for interrupts 10*24*60*1000, // Go to sleep after 10 days of inactivity 1000, // Check for new input in sleep mode every second 1000 // Take 1 second to power up the focuser motor on awaken }, false, // Focuser cannot use a home switch to synch 5000 // Mostly a place holder } }, { Build::UNIT_TEST_TRADITIONAL_FOCUSER, { TimingParams { 10, // Check for new commands every 10ms 2, // Take 2 steps before checking for interrupts 1000, // Go to sleep after 1 second of inactivity 500, // Check for new input in sleep mode every 500ms 200, // Allow 200ms to power on the motor }, false, // Focuser cannot use a home switch to synch 5000 // Mostly a place holder } }, }; Focuser::Focuser( std::unique_ptr netArg, std::unique_ptr hardwareArg, std::unique_ptr debugArg, const BuildParams params ) : buildParams{ params } { focuserPosition = 0; isSynched = false; time = 0; uSecRemainder = 0; timeLastInterruptingCommandOccured = 0; motorState = MotorState::OFF; std::swap( net, netArg ); std::swap( hardware, hardwareArg ); std::swap( debugLog, debugArg ); DebugInterface& dlog = *debugLog; dlog << "Bringing up net interface\n"; // Bring up the interface to the controlling computer net->setup( dlog ); WifiDebugOstream log( debugLog.get(), net.get() ); // // Set the pin modes // hardware->PinMode(HWI::Pin::STEP, HWI::PinIOMode::M_OUTPUT ); hardware->PinMode(HWI::Pin::DIR, HWI::PinIOMode::M_OUTPUT ); hardware->PinMode(HWI::Pin::MOTOR_ENA, HWI::PinIOMode::M_OUTPUT ); hardware->PinMode(HWI::Pin::HOME, HWI::PinIOMode::M_INPUT ); // // Set the output pin defaults and internal state // setMotor( log, MotorState::ON ); dir = Dir::FORWARD; hardware->DigitalWrite( HWI::Pin::DIR, HWI::PinState::DIR_FORWARD); hardware->DigitalWrite( HWI::Pin::STEP, HWI::PinState::STEP_INACTIVE ); log << "Focuser is up\n"; } void Focuser::doAbort( CommandParser::CommandPacket cp ) { (void) cp; // Do nothing - command triggers a state interrupt. } void Focuser::doHome( CommandParser::CommandPacket cp ) { (void) cp; if ( buildParams.focuserHasHome ) { stateStack.push( State::STOP_AT_HOME ); } } void Focuser::doLHome( CommandParser::CommandPacket cp ) { (void) cp; if ( buildParams.focuserHasHome ) { if ( !isSynched ) { stateStack.push( State::STOP_AT_HOME ); } } } void Focuser::doPStatus( CommandParser::CommandPacket cp ) { (void) cp; DebugInterface& log = *debugLog; log << "Processing pstatus request\n"; *net << "Position: " << focuserPosition << "\n"; } void Focuser::doMStatus( CommandParser::CommandPacket cp ) { (void) cp; DebugInterface& log = *debugLog; log << "Processing mstatus request\n"; *net << "State: " << stateNames.at(stateStack.topState()) << " " << stateStack.topArg() << "\n"; } void Focuser::doSStatus( CommandParser::CommandPacket cp ) { (void) cp; DebugInterface& log = *debugLog; log << "Processing sstatus request\n"; *net << "Synched: " << (isSynched ? "YES" : "NO" ) << "\n"; } void Focuser::doFirmware( CommandParser::CommandPacket cp ) { (void) cp; DebugInterface& log = *debugLog; log << "Processing firmware request\n"; *net << "Firmware: 1.0\n"; } void Focuser::doCaps( CommandParser::CommandPacket cp ) { (void) cp; DebugInterface& log = *debugLog; log << "Processing capabilities request\n"; *net << "MaxPos: " << buildParams.maxAbsPos << "\n"; *net << "CanHome: " << (buildParams.focuserHasHome ? "YES\n" : "NO\n" ); } void Focuser::doRELPos( CommandParser::CommandPacket cp ) { cp.optionalArg += focuserPosition; doABSPos( cp ); } void Focuser::doABSPos( CommandParser::CommandPacket cp ) { int new_position = cp.optionalArg; new_position = std::min( new_position, (int) buildParams.maxAbsPos ); new_position = std::max( new_position, (int) 0 ); stateStack.push( State::MOVING, new_position ); if ( new_position < focuserPosition ) { int backtrack = new_position - 500; backtrack = std::max( backtrack, (int) 0 ); stateStack.push( State::MOVING, backtrack ); } } void Focuser::doSync( CommandParser::CommandPacket cp ) { stateStack.push( State::MOVING, cp.optionalArg ); focuserPosition = cp.optionalArg; isSynched = true; } void Focuser::doError( CommandParser::CommandPacket cp ) { (void) cp; stateStack.push( State::ERROR_STATE, __LINE__ ); } void Focuser::processCommand( CommandParser::CommandPacket cp ) { if ( doesCommandInterrupt.at( cp.command )) { timeLastInterruptingCommandOccured = time; } auto function = commandImpl.at( cp.command ); (this->*function)( cp ); } unsigned int Focuser::stateAcceptCommands() { DebugInterface& log = *debugLog; auto cp = CommandParser::checkForCommands( log, *net ); if ( cp.command != CommandParser::Command::NoCommand ) { processCommand( cp ); return 0; } const unsigned int timeSinceLastInterrupt = time - timeLastInterruptingCommandOccured; if ( timeSinceLastInterrupt > buildParams.timingParams.getInactivityToSleep() ) { stateStack.push( State::SLEEP ); return 0; } const int timeBetweenChecks = buildParams.timingParams.getEpochBetweenCommandChecks(); const int mSecToNextEpoch = timeBetweenChecks - ( time % timeBetweenChecks ); return mSecToNextEpoch * 1000; } unsigned int Focuser::stateSetDir() { Dir desiredDir = stateStack.topArg().getDir(); stateStack.pop(); if ( desiredDir != dir ) { dir = desiredDir; if ( dir == Dir::FORWARD ) hardware->DigitalWrite( HWI::Pin::DIR, HWI::PinState::DIR_FORWARD); if ( dir == Dir::REVERSE ) hardware->DigitalWrite( HWI::Pin::DIR, HWI::PinState::DIR_BACKWARD ); // Trigger a 1ms pause so the stepper motor controller sees the // state change before we try to do anything. return 1000; } return 0; } unsigned int Focuser::stateStepInactiveAndWait() { hardware->DigitalWrite( HWI::Pin::STEP, HWI::PinState::STEP_INACTIVE ); stateStack.pop(); return 1000; } unsigned int Focuser::stateStepActiveAndWait() { hardware->DigitalWrite( HWI::Pin::STEP, HWI::PinState::STEP_ACTIVE ); stateStack.pop(); return 1000; } unsigned int Focuser::stateDoingSteps() { if ( stateStack.topArg().getInt() == 0 ) { // We're done at 0 stateStack.pop(); return 0; } stateStack.topArgSet( stateStack.topArg().getInt()-1 ); stateStack.push( State::STEPPER_INACTIVE_AND_WAIT ); stateStack.push( State::STEPPER_ACTIVE_AND_WAIT ); focuserPosition += (dir == Dir::FORWARD) ? 1 : -1; //focuserPosition = focuserPosition >= 0 ? focuserPosition : 0; return 0; } unsigned int Focuser::stateMoving() { WifiDebugOstream log( debugLog.get(), net.get() ); log << "Moving " << focuserPosition << "\n"; if ( stateStack.topArg().getInt() == focuserPosition ) { // We're at the target, exit stateStack.pop(); return 0; } // Check for new commands DebugInterface& debug= *debugLog; auto cp = CommandParser::checkForCommands( debug, *net ); if ( cp.command != CommandParser::Command::NoCommand ) { if ( doesCommandInterrupt.at( cp.command )) { stateStack.reset(); } processCommand( cp ); if ( doesCommandInterrupt.at( cp.command )) { return 0; } } const int steps = stateStack.topArg().getInt() - focuserPosition; const Dir nextDir = steps > 0 ? Dir::FORWARD : Dir::REVERSE; const int absSteps = steps > 0 ? steps : -steps; const int doStepsMax = buildParams.timingParams.getMaxStepsBetweenChecks(); const int clippedSteps = absSteps > doStepsMax ? doStepsMax : absSteps; stateStack.push( State::DO_STEPS, clippedSteps ); stateStack.push( State::SET_DIR, nextDir ); return 0; } unsigned int Focuser::stateStopAtHome() { WifiDebugOstream log( debugLog.get(), net.get() ); assert ( motorState == MotorState::ON ); if ( hardware->DigitalRead( HWI::Pin::HOME ) == HWI::PinState::HOME_ACTIVE ) { log << "Hit home at position " << focuserPosition << "\n"; log << "Resetting position to 0\n"; focuserPosition = 0; isSynched = true; stateStack.pop(); return 0; } const int doStepsMax = buildParams.timingParams.getMaxStepsBetweenChecks(); if ( ((focuserPosition) % doStepsMax) == 0 ) { log << "Homing " << focuserPosition << "\n"; // Check for new commands DebugInterface& debug= *debugLog; auto cp = CommandParser::checkForCommands( debug, *net ); if ( cp.command != CommandParser::Command::NoCommand ) { if ( doesCommandInterrupt.at( cp.command )) { stateStack.reset(); } processCommand( cp ); if ( doesCommandInterrupt.at( cp.command )) { return 0; } } } stateStack.push( State::DO_STEPS, 1 ); stateStack.push( State::SET_DIR, Dir::REVERSE ); return 0; } unsigned int Focuser::stateSleep() { WifiDebugOstream log( debugLog.get(), net.get() ); // Check for new commands DebugInterface& debug= *debugLog; auto cp = CommandParser::checkForCommands( debug, *net ); if ( cp.command != CommandParser::Command::NoCommand ) { if ( doesCommandInterrupt.at( cp.command )) { stateStack.reset(); } processCommand( cp ); if ( doesCommandInterrupt.at( cp.command )) { if ( motorState != MotorState::ON ) { setMotor( log, MotorState::ON ); return buildParams.timingParams.getTimeToPowerStepper() * 1000; } } return 0; // Go until we're out of commands. } if ( motorState != MotorState::OFF ) { setMotor( log, MotorState::OFF ); } const int sleepEpoch = buildParams.timingParams.getEpochForSleepCommandChecks(); const int mSecToNextEpoch = sleepEpoch - ( time % sleepEpoch ); return mSecToNextEpoch * 1000; } unsigned int Focuser::stateError() { WifiDebugOstream log( debugLog.get(), net.get() ); log << "hep hep hep error error error\n"; return 10*1000*1000; // 10 sec pause } unsigned int Focuser::loop() { ptrToMember function = stateImpl.at( stateStack.topState() ); const unsigned uSecToNextCall = (this->*function)(); uSecRemainder += uSecToNextCall; time += uSecRemainder / 1000; uSecRemainder = uSecRemainder % 1000; return uSecToNextCall; } void Focuser::setMotor( WifiDebugOstream& log, MotorState m ) { motorState = m; hardware->DigitalWrite( HWI::Pin::MOTOR_ENA, ( m == MotorState::ON ) ? HWI::PinState::MOTOR_ON : HWI::PinState::MOTOR_OFF ); log << "Motor set " << (( m == MotorState::ON ) ? "on" : "off" ) << "\n"; } indi-beefocus-0.1+20220128183230/firmware/hardware_esp8266.cpp0000644000175100017510000000243614174600255022216 0ustar debiandebian#include #include "hardware_esp8266.h" const std::unordered_map HardwareESP8266::pinMap = { { Pin::STEP, 4 }, { Pin::DIR, 5 }, { Pin::MOTOR_ENA, 14}, { Pin::HOME, 13} }; const std::unordered_map HardwareESP8266::pinStateMap = { { PinState::STEP_ACTIVE, HIGH }, { PinState::STEP_INACTIVE, LOW }, { PinState::DIR_BACKWARD, LOW }, { PinState::DIR_FORWARD, HIGH }, { PinState::MOTOR_OFF, HIGH }, // Active low { PinState::MOTOR_ON, LOW }, // Active low { PinState::HOME_INACTIVE, HIGH }, // Active low { PinState::HOME_ACTIVE, LOW}, // Active low }; void HardwareESP8266::DigitalWrite( Pin pin, PinState state ) { int actualPin = pinMap.at( pin ); int actualState = pinStateMap.at( state ); digitalWrite( actualPin, actualState ); } void HardwareESP8266::PinMode( Pin pin, PinIOMode mode ) { int actualPin = pinMap.at( pin ); pinMode( actualPin, mode == PinIOMode::M_OUTPUT ? OUTPUT : INPUT ); } HWI::PinState HardwareESP8266::DigitalRead( Pin pin) { int actualPin = pinMap.at( pin ); // Tmp Hack. It's always the home pin, which is active low return digitalRead( actualPin ) ? PinState::HOME_INACTIVE : PinState::HOME_ACTIVE; } indi-beefocus-0.1+20220128183230/firmware/debug_esp8266.cpp0000644000175100017510000000033714174600255021505 0ustar debiandebian#include #include "debug_esp8266.h" DebugESP8266::DebugESP8266( void ) { Serial.begin( 115200 ); } void DebugESP8266::rawWrite( const char* bytes, size_t num ) { Serial.write( (uint8 *) bytes, num ); } indi-beefocus-0.1+20220128183230/firmware/wifi_secrets.h0000644000175100017510000000073214174600255021354 0ustar debiandebian#ifndef __WIFI_SECRETS_H__ #define __WIFI_SECRETS_H__ // // This file contains wifi credentials. Separate file because this // information will need to be modified during development, but wifi // details shouldn't be checked into a public repository. // namespace WifiSecrets { // your SSID. Do not check in :) constexpr const char* ssid = "yourssid"; // your Passwoord. Do not check in :) constexpr const char* password = "yourpassword"; } #endif indi-beefocus-0.1+20220128183230/firmware/net_esp8266.cpp0000644000175100017510000000756114174600255021213 0ustar debiandebian#include "net_interface.h" #include "net_esp8266.h" #include "wifi_ostream.h" #include "wifi_debug_ostream.h" void WifiInterfaceEthernet::setup( DebugInterface& log ) { delay(10); log << "Init Wifi\n"; // Connect to WiFi network log << "Connecting to " << ssid << "\n"; // Disable Wifi Persistence. It's not needed and wears the flash memory. // Kudos Erik H. Bakke for pointing this point. WiFi.persistent( false ); WiFi.mode( WIFI_STA ); wifi_set_sleep_type(LIGHT_SLEEP_T); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); log << "."; } log << "\n"; log << "WiFi Connected\n"; // Start the server m_server.begin(); log << "Server started\n"; // Print the IP address BeeFocus::IpAddress adr; auto dsIP = WiFi.localIP(); for ( int i = 0; i < 4; ++ i ) adr[i] = dsIP[i]; log << "Telnet to this address to connect: " << adr << " " << tcp_port << "\n"; } bool WifiInterfaceEthernet::getString( WifiDebugOstream& log, std::string& string ) { handleNewConnections( log ); return std::any_of( m_connections.begin(), m_connections.end(), [&] ( NetConnection& connection ) { return connection.getString( log, string ); }); } void WifiInterfaceEthernet::handleNewConnections( WifiDebugOstream &log ) { if ( m_server.hasClient() ) { log << "New client connecting\n"; ConnectionArray::iterator slot = std::find_if( m_connections.begin(), m_connections.end(), [&] ( NetConnection& connection ) { return !connection; }); if ( slot == m_connections.end() ) { slot = m_nextToKick; m_nextToKick++; m_nextToKick = ( m_nextToKick == m_connections.end()) ? m_connections.begin() : m_nextToKick; } log << "Using slot " << slot - m_connections.begin() << " of " << m_connections.size()-1 << " for the new client\n"; if ( *slot ) { log << "An existing client exists - disconnecting it\n"; } slot->initConnection( m_server ); } } WifiInterfaceEthernet& WifiInterfaceEthernet::operator<<( char c ) { std::for_each( m_connections.begin(), m_connections.end(), [&] ( NetConnection& interface ) { interface << c; }); return *this; } void WifiInterfaceEthernet::reset(void) { std::for_each( m_connections.begin(), m_connections.end(), [] ( NetConnection& interface ) { interface.reset(); }); } void WifiConnectionEthernet::initConnection( WiFiServer &server ) { if ( m_connectedClient ) { (*this) << "# New Client and no free slots - Dropping Your Connection.\n"; m_connectedClient.stop(); } m_connectedClient = server.available(); (*this) << "# Bee Focuser is ready for commands\n"; } bool WifiConnectionEthernet::getString( WifiDebugOstream &log, std::string& string ) { handleNewIncomingData( log ); std::string& incomingBuffer = m_incomingBuffers[ m_currentIncomingBuffer ]; size_t newLine = incomingBuffer.find('\n'); if ( newLine != std::string::npos ) { // log << "Found newline at " << newLine << "\n"; string.replace( 0, newLine, incomingBuffer ); string.resize( newLine ); m_currentIncomingBuffer = 1-m_currentIncomingBuffer; std::string& newIncomingBuffer = m_incomingBuffers[ m_currentIncomingBuffer ]; size_t rest = incomingBuffer.length() - newLine - 1; newIncomingBuffer.replace( 0, rest, incomingBuffer, newLine+1, rest ); newIncomingBuffer.resize( rest ); return true; } return false; } void WifiConnectionEthernet::handleNewIncomingData( WifiDebugOstream& log ) { (void) log; // silence argsused warning std::string& incomingBuffer = m_incomingBuffers[ m_currentIncomingBuffer ]; if ( !m_connectedClient || !m_connectedClient.available()) { return; } while (m_connectedClient.available()) { uint8_t byte; m_connectedClient.read( &byte, 1 ); incomingBuffer += ((char) byte); } } indi-beefocus-0.1+20220128183230/firmware/net_interface.h0000644000175100017510000000161014174600255021470 0ustar debiandebian#ifndef __NetInterface_H__ #define __NetInterface_H__ #include #include "hardware_interface.h" #include "debug_interface.h" class WifiOstream; class WifiDebugOstream; /// @brief Interface to the client /// /// This class's one job is to provide an interface to the client. /// class NetInterface { public: NetInterface() { } virtual ~NetInterface() { } virtual void setup( DebugInterface &debugLog ) = 0; virtual bool getString( WifiDebugOstream &log, std::string& string ) = 0; virtual NetInterface& operator<<( char c ) = 0; private: }; class NetConnection { public: NetConnection& operator<<( char c ) { putChar( c ); return *this; } virtual bool getString( WifiDebugOstream& lot, std::string& string )=0; virtual operator bool( void ) = 0; virtual void reset( void ) = 0; protected: virtual void putChar( char c ) = 0; }; #endif indi-beefocus-0.1+20220128183230/firmware/focuser_state.h0000644000175100017510000002777014174600255021547 0ustar debiandebian#ifndef __FOCUSER_STATE_H__ #define __FOCUSER_STATE_H__ #include #include #include #include #include #include "net_interface.h" #include "hardware_interface.h" #include "command_parser.h" /// /// @brief Focuser Namespace /// /// This is a collection of code that has to do with the focuser's /// state. The code in this namespace /// /// - Initializes the hardware /// - Moves the stepper motor /// - Accepts input from the network /// /// \b Concepts /// /// - Basic Flow: /// Callers run the focuser by repeatly calling Focuser::loop; this /// is simular to the basic Arduino loop. Focuser::loop returns the /// amount of time (in micro-seconds) it would like the caller to wait /// before invoking Focuser::loop again. /// - Net Interface: /// The Net Interface (NetInterface) is where the focuser gets input /// and sends output to. Normally that's the WIFI connection to the /// host computer, but there's a Mock Network Interface that's used /// for testing. /// - Hardware Interface: /// The Hardware Interface (HWI) is how the focuser interacts with /// the actual hardware. Normally this as the ESP8266 itself, but /// there's a Mock Hardware Interface that's used for testing. /// - Debug Interface: /// The Debug Interface (DebugInterface) can be used to send debug /// messages to a host computer. It's a developer only interface. /// - Commands: /// A command is an instruction that comes from the the comes from the /// the Net Interface. i.e., "What is the focuser position", /// "Move the focuser to this position". The list of valid commands /// is declared in CommandParser::Command /// - Invidivual State: /// The Focuser is most similar to a state machine. Focuser::loop /// just runs the handler for the current state. For example, if the /// current state is "moving to a new position" the focuser might /// figure out where it is right now, what direction it has to move, /// and how many steps it needs to take to get to that positon. /// - State Stack: /// The Focuser actually has a stack of states. The stack is useful /// because it's sometimes easier to describe a complex operation /// using simpler operations. i.e., you can move the stepper motor /// one step by running State::STEPPER_ACTIVE_AND_WAIT and then /// State::STEPPER_INACTIVE_AND_WAIT. A move can be done by setting /// a direction using State::SET_DIR and then using State::DO_STEPS /// to take multiple steps. /// namespace FS { /// @brief Focuser's State Enum /// /// @see FS Namespace for high level description. /// enum class State { START_OF_STATES = 0, ///< Start of States ACCEPT_COMMANDS = 0, ///< Accepting commands from the net interface DO_STEPS, ///< Doing n Stepper Motor Steps STEPPER_INACTIVE_AND_WAIT, ///< Set Stepper to Inactive and Pause STEPPER_ACTIVE_AND_WAIT, ///< Set Stepper to Active and Pause SET_DIR, ///< Set the Direction Pin MOVING, ///< Move to an absolute position STOP_AT_HOME, ///< Rewind until the Home input is active SLEEP, ///< Low Power State ERROR_STATE, ///< Error Errror Error END_OF_STATES ///< End of States }; /// @brief What direction is the focuser going? enum class Dir { FORWARD, ///< Go Forward REVERSE ///< Go Backward }; class StateArg { public: enum class Type { NONE, INT, DIR }; StateArg() : type{ Type::NONE} {} StateArg( int i ) : type{Type::INT}, intArg{ i } {} StateArg( Dir d ) : type{Type::DIR}, dirArg{ d } {} Type getType() { return type; } int getInt() { assert( type==Type::INT ); return intArg; } Dir getDir() { assert( type==Type::DIR ); return dirArg; } private: Type type; union { int intArg; Dir dirArg; }; }; class TimingParams { public: TimingParams( int msEpochBetweenCommandChecksRHS = 100, // 100 ms int maxStepsBetweenChecksRHS = 50, unsigned msInactivityToSleepRHS = 5*60*1000, // 5 minutes int msEpochForSleepCommandChecksRHS = 1*1000, // 1 seconds int msToPowerStepperRHS = 1*1000 // 1 second ) : msEpochBetweenCommandChecks{ msEpochBetweenCommandChecksRHS }, maxStepsBetweenChecks{ maxStepsBetweenChecksRHS }, msInactivityToSleep{ msInactivityToSleepRHS }, msEpochForSleepCommandChecks{ msEpochForSleepCommandChecksRHS }, msToPowerStepper{ msToPowerStepperRHS} { } int getEpochBetweenCommandChecks() const { return msEpochBetweenCommandChecks; } int getMaxStepsBetweenChecks() const { return maxStepsBetweenChecks; } unsigned getInactivityToSleep() const { return msInactivityToSleep; } int getEpochForSleepCommandChecks() const { return msEpochForSleepCommandChecks; } int getTimeToPowerStepper() const { return msToPowerStepper; } private: int msEpochBetweenCommandChecks; int maxStepsBetweenChecks; unsigned msInactivityToSleep; int msEpochForSleepCommandChecks; int msToPowerStepper; }; enum class Build { LOW_POWER_HYPERSTAR_FOCUSER, TRADITIONAL_FOCUSER, UNIT_TEST_BUILD_HYPERSTAR, UNIT_TEST_TRADITIONAL_FOCUSER }; class BuildParams { public: using BuildParamMap = const std::unordered_map; BuildParams() = delete; BuildParams( TimingParams timingParamsRHS, bool focuserHasHomeRHS, unsigned int maxAbsPosRHS ) : timingParams{ timingParamsRHS }, focuserHasHome{ focuserHasHomeRHS }, maxAbsPos { maxAbsPosRHS } { } BuildParams( Build buildType ) { *this = builds.at( buildType ); } TimingParams timingParams; bool focuserHasHome; unsigned int maxAbsPos; static BuildParamMap builds; private: }; /// /// @brief Stack of FS:States. /// /// Invariants: /// /// - In normal operation, the stack's bottom is always an ACCEPT_COMMANDS state /// - After construction, the stack can never be empty /// - If a pop operation leaves the stack empty an ERROR_STATE is pushed /// class StateStack { public: StateStack() { push( State::ACCEPT_COMMANDS, StateArg() ); } /// @brief Reset the stack to the newly initialized state. void reset( void ) { while ( stack.size() > 1 ) pop(); } /// @brief Get the top state. State topState( void ) { return stack.back().state; } /// @brief Get the top state's argumment. StateArg topArg( void ) { return stack.back().arg; } /// @brief Set the top state's argumment. void topArgSet( StateArg newVal ) { stack.back().arg = newVal; } /// @brief Pop the top entry on the stack. void pop( void ) { stack.pop_back(); if ( stack.size() > 10 ) { push( State::ERROR_STATE, StateArg(__LINE__) ); } if ( stack.empty() ) { // bug, should never happen. push( State::ERROR_STATE, StateArg(__LINE__) ); } } /// @brief Push a new entry onto the stack void push( State newState, StateArg newArg = StateArg() ) { stack.push_back( { newState , newArg } ); } private: typedef struct { State state; StateArg arg; } CommandPacket; std::vector< CommandPacket > stack; }; class Focuser { public: /// @brief Focuser State Constructor /// /// @param[in] netArg - Interface to the network /// @param[in] hardwareArg - Interface to the Hardware /// @param[in] debugArg - Interface to the debug logger. /// @param[in] params - Hardware Parameters /// Focuser( std::unique_ptr netArg, std::unique_ptr hardwareArg, std::unique_ptr debugArg, const BuildParams params ); /// /// @brief Update the Focuser's State /// /// @return The amount of time the caller should wait (in microsecodns) /// before calling loop again. /// unsigned int loop(); static const std::unordered_map commandImpl; using ptrToMember = unsigned int ( Focuser::*) ( void ); static const std::unordered_map< State, ptrToMember, EnumHash > stateImpl; private: /// @brief Deleted copy constructor Focuser( const Focuser& other ) = delete; /// @brief Deleted default constructor Focuser() = delete; /// @brief Deleted assignment operator Focuser& operator=( const Focuser& ) = delete; StateStack stateStack; void processCommand( CommandParser::CommandPacket cp ); /// @brief Wait for commands from the network interface unsigned int stateAcceptCommands( void ); /// @brief Move to position @arg unsigned int stateMoving( void ); /// @brief Move the stepper @arg steps unsigned int stateDoingSteps( void ); /// @brief If needed, Change the state of the direction pin and pause unsigned int stateSetDir( void ); /// @brief Set the Stepper to active (i.e., start step) and wait unsigned int stateStepActiveAndWait( void ); /// @brief Set the Stepper to inactive (i.e., finish step) and wait unsigned int stateStepInactiveAndWait( void ); /// @brief Rewind the focuser until the home input is active. unsigned int stateStopAtHome( void ); /// @brief Low power mode unsigned int stateSleep( void ); /// @brief If we land in this state, complain a lot. unsigned int stateError( void ); void doAbort( CommandParser::CommandPacket ); void doHome( CommandParser::CommandPacket ); void doLHome( CommandParser::CommandPacket ); void doPStatus( CommandParser::CommandPacket ); void doMStatus( CommandParser::CommandPacket ); void doSStatus( CommandParser::CommandPacket ); void doABSPos( CommandParser::CommandPacket ); void doRELPos( CommandParser::CommandPacket ); void doSync( CommandParser::CommandPacket ); void doFirmware( CommandParser::CommandPacket ); void doCaps( CommandParser::CommandPacket ); void doError( CommandParser::CommandPacket ); std::unique_ptr net; std::unique_ptr hardware; std::unique_ptr debugLog; const BuildParams buildParams; /// @brief What direction are we going? /// /// FORWARD = counting up. /// REVERSE = counting down. /// Dir dir; enum class MotorState { ON, OFF }; /// @brief Is the Stepper Motor On or Off. MotorState motorState; void setMotor( WifiDebugOstream& log, MotorState ); /// @brief What is the focuser's position of record int focuserPosition; /// @brief Is the focuser synched to a "known good" position bool isSynched; /// @brief Focuser uptime in MS unsigned int time; /// @brief For computing time in Focuser::loop unsigned int uSecRemainder; /// @brief Time the last command that could have caused an interrupt happened unsigned int timeLastInterruptingCommandOccured; }; /// @brief Increment operator for State enum /// inline State& operator++( State &s ) { return BeeFocus::advance< State, State::END_OF_STATES>(s); } /// @brief State to std::string Unordered Map using StateToString = std::unordered_map< State, const std::string, EnumHash >; /// @brief Command to bool Unordered Map using CommandToBool = std::unordered_map< CommandParser::Command, bool, EnumHash >; extern const StateToString stateNames; /// /// @brief Does a particular incoming command interrupt the current state /// /// Example 1. A "Status" Command will not interrupt a move sequence /// Example 2. A "Home" Command will interrupt a focuser's move sequence /// extern const CommandToBool doesCommandInterrupt; /// @brief Output StateArg template ::value>> T& operator<<( T& ostream, StateArg sA ) { switch (sA.getType() ) { case StateArg::Type::NONE: ostream << "NoArg"; break; case StateArg::Type::INT: ostream << sA.getInt(); break; default: assert(0); } return ostream; } } #endif indi-beefocus-0.1+20220128183230/firmware/wifi_ostream.h0000644000175100017510000000103214174600255021350 0ustar debiandebian#ifndef __WifiOstream_H__ #define __WifiOstream_H__ #include "simple_ostream.h" class WifiOstream { public: WifiOstream() : m_connectedClient{nullptr} { } ~WifiOstream() { m_connectedClient = nullptr; } WifiOstream& operator<<( char c ) { if ( m_connectedClient ) { *m_connectedClient << c; } return *this; } void setConnectedClientAlias( NetConnection* connectedClient ) { m_connectedClient = connectedClient; } private: NetConnection* m_connectedClient; }; #endif indi-beefocus-0.1+20220128183230/firmware/firmware.ino0000644000175100017510000000000114174600255021025 0ustar debiandebian indi-beefocus-0.1+20220128183230/firmware/wifi_debug_ostream.h0000644000175100017510000000144614174600255022527 0ustar debiandebian#ifndef __WIFI_DEBUG_OSTREAM__ #define __WIFI_DEBUG_OSTREAM__ #include "simple_ostream.h" #include "net_interface.h" #include "debug_interface.h" /// @brief Wifi target debug ostream /// class WifiDebugOstream { public: WifiDebugOstream( DebugInterface* serialDebugArg, NetInterface* wifiDebugArg ) : m_wifiDebug{ wifiDebugArg }, m_serialDebug{ serialDebugArg}, m_lastWasNewline{ true } { } WifiDebugOstream& operator<<( char c ) { *(m_serialDebug) << c; bool isNewLine = ( c == '\n' ); if ( m_lastWasNewline && !isNewLine ) { (*m_wifiDebug) << "# "; } *(m_wifiDebug) << c; m_lastWasNewline = isNewLine; return *this; } private: NetInterface* m_wifiDebug; DebugInterface* m_serialDebug; bool m_lastWasNewline; }; #endif indi-beefocus-0.1+20220128183230/firmware/hardware_interface.cpp0000644000175100017510000000163214174600255023036 0ustar debiandebian#include "hardware_interface.h" const std::unordered_map HWI::pinNames = { { Pin::STEP, "Step" }, { Pin::DIR, "Direction" }, { Pin::MOTOR_ENA, "Motor Enable" }, { Pin::HOME, "Home" }, }; const std::unordered_map HWI::pinStateNames = { { PinState::STEP_ACTIVE, "Step Active" }, { PinState::STEP_INACTIVE, "Step Inactive" }, { PinState::DIR_FORWARD, "Dir Forward" }, { PinState::DIR_BACKWARD, "Dir Backward" }, { PinState::MOTOR_ON, "Motor On" }, { PinState::MOTOR_OFF, "Motor Off" }, { PinState::HOME_ACTIVE, "Home Active" }, { PinState::HOME_INACTIVE, "Home Inactive" }, }; const std::unordered_map HWI::pinIOModeNames = { { PinIOMode::M_INPUT, "Input" }, { PinIOMode::M_OUTPUT, "Output" } }; indi-beefocus-0.1+20220128183230/driver/0000755000175100017510000000000014174600255016172 5ustar debiandebianindi-beefocus-0.1+20220128183230/driver/beesimfirmware.h0000644000175100017510000000564614174600255021357 0ustar debiandebian/******************************************************************************* Based on work Copyright(c) 2018 Andrew Brownbill. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. . 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 Library General Public License for more details. . You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *******************************************************************************/ #pragma once #include "focuser_state.h" // From the firmware. #include "beeconnect.h" /// /// Brief Firmware based simulator for the focuser. /// /// This class takes the Firmware that's loaded into the BeeFocused ESP8266 /// micro-controller make makes a simulator out of it. If you connect using /// a "Simulated" connection this is the code that will be used to simulate /// the focuser. /// /// Because it's the actual firmware, it's useful for "unit testing". /// unit testing is in quotes because it's really an end to end integration /// test, but it's an integration test that runs in 1.5 seconds. /// /// TODO - 1.5 seconds at least an order of magnitude more than I'd expect, /// find out why. /// class BeeSimFirmware { public: // Remove unused interfaces that could be dangerous if used. BeeSimFirmware() = delete; BeeSimFirmware( const BeeSimFirmware& ) = delete; BeeSimFirmware& operator=( const BeeSimFirmware& ) = delete; /// /// @brief Constructor for the Firmware Based BeeFocused Simulator /// /// @param[in] toFirmware /// A "pipe"/ queue of characters that represent data going to the /// simulated focuser. /// @param[out] toFirmware /// A "pipe"/ queue of characters that represent data coming from the /// simulated focuser. /// BeeSimFirmware( BeeFocusedCon::QueueOfChar* toFirmware, BeeFocusedCon::QueueOfChar* fromFirmware ); /// /// @brief Advance Time on the simulator /// /// Move the simulator forward by msAmountOfTime (which is in ms). Gets /// input and writes output to the Queues passed into the Constructor. /// void advanceTime( unsigned int msAmountOfTime ); private: /// @brief Current simulated time in ms. unsigned long long time; /// @brief The Simulated Focuser firmware class std::unique_ptr simulatedFocuser; /// @brief When's the next time when we can call the loop function on the /// simulatedFocuser class (in microseconds). unsigned long long simulatedFocuserNextUpdate; }; indi-beefocus-0.1+20220128183230/driver/beeconnect.cpp0000644000175100017510000001304214174600255021003 0ustar debiandebian/******************************************************************************* Copyright(c) 2018 Andrew Brownbill. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. . 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 Library General Public License for more details. . You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *******************************************************************************/ #include "indifocuser.h" #include "indicom.h" #include "unistd.h" #include #include #include #include #include #include "beeconnect.h" namespace BeeFocusedCon { using TTYErrorToString= std::unordered_map< const int, const std::string, EnumHash >; static const TTYErrorToString errorReason = { { TTY_OK, "TTY_OK (no error)" }, { TTY_READ_ERROR, "TTY_READ_ERROR" }, { TTY_WRITE_ERROR, "TTY_WRITE_ERROR" }, { TTY_SELECT_ERROR, "TTY_SELECT_ERROR" }, { TTY_TIME_OUT, "TTY_TIME_OUT" }, { TTY_PORT_FAILURE, "TTY_PORT_FAILURE" }, { TTY_PARAM_ERROR, "TTY_PARAM_ERROR }" }, { TTY_ERRNO, "TTY_ERRNO" }, { TTY_OVERFLOW, "TTY_OVERFLOW" } }; static std::string GetIndiErrorReason( int errorID ) { return errorReason.find( errorID ) == errorReason.end() ? std::string("Unknown Error Code ") + std::to_string( errorID ) : errorReason.at( errorID ); } bool TCP::DataReady( void ) { if ( Failed() ) { return false; } int status = tty_timeout( fd, 0 ); if ( status != TTY_OK && status != TTY_TIME_OUT ) { Fail("Error on DataReady (" + GetIndiErrorReason( status ) +")"); return false; } return status == TTY_OK; } Interface& TCP::operator<<( char c ) { if ( Failed() ) { return *this; } // tty_write will output data until it succeeds or fails. int nbytes_written = 0; int status = tty_write( fd, &c, 1, &nbytes_written ); if ( status != TTY_OK ) { Fail("Error on Write (" + GetIndiErrorReason( status ) +")"); } else if ( nbytes_written != 1 ) { // Should never happen. Fail("tty_write wrote 0 bytes, expected 1"); } return *this; } Interface& TCP::operator>>(char &c ) { c = 0; if ( Failed() ) { return *this; } int nbytes_read = 0; int status = tty_read( fd, &c, 1, GetTimeout(), &nbytes_read ); if ( status != TTY_OK ) { Fail( "Error on Read (" + GetIndiErrorReason( status ) +")" ); } else if ( nbytes_read == 0 ) { // Should never happen. Fail( "Error on Read - Expected 1 byte, got 0" ); } return *this; } int TCP::GetTimeout( void ) { return 10; } //================================================================ Interface& Sim::operator<<( char c ) { toFirmware.push(c); return *this; } Interface& Sim::operator>>( char &c ) { // Handle an empty input by erroring out... // This doesn't match reality - in reality we'd block until the other // end of the connection wrote something, timing out. I could mock // that by implementing the connection as a pipe and running both // ends of the connection in their own thread, or some other kind of // magic. But I want to use this for integration testing, and I'm // worried that adding concurrency to the test would reduce the chances // of reproducing any issue that came up. if ( fromFirmware.empty() ) { Fail( "Read called when mock queue was empty" ); } c = fromFirmware.front(); fromFirmware.pop(); return *this; } bool Sim::DataReady() { return !fromFirmware.empty(); } //================================================================ static std::string GetStringRaw( Interface& con ) { std::string rval; for ( ;; ) { char c; con >> c; if ( con.Failed()) { return std::string(); } if ( c == '\n' ) { break; } rval.push_back(c); } return rval; } std::string GetString( Interface& con ) { std::string rval; rval = GetStringRaw( con ); return (con.Failed() || rval.find("#")) == 0 ? std::string() : rval; } Interface& operator<<( Interface& ostream, const char* string ) { std::size_t length = strlen( string ); for ( std::size_t i = 0; i < length; ++i ) { ostream << string[i]; } return ostream; } Interface& operator<<( Interface& ostream, unsigned int i ) { // Handle digits that aren't the lowest digit (if any) if ( i >= 10 ) { ostream << i/10; } // Handle the lowest digit ostream << (char) ('0' + (i % 10)); return ostream; } Interface& operator<<( Interface& ostream, int i ) { if ( i < 0 ) { ostream << "-"; i = -i; } ostream << (unsigned int) i; return ostream; } } //================================================================ namespace Connection { Sim::Sim(INDI::DefaultDevice *dev ) : Interface(dev, CONNECTION_CUSTOM) { } bool Sim::Connect() { bool rc = Handshake(); if ( rc ) { LOGF_INFO("%s is online.", getDeviceName()); } else { LOG_DEBUG("Handshake failed."); } return rc; } bool Sim::Disconnect() { return false; } void Sim::Activated() { } void Sim::Deactivated() { } } indi-beefocus-0.1+20220128183230/driver/beefocus.h0000644000175100017510000001775014174600255020150 0ustar debiandebian/******************************************************************************* Based on work Copyright(c) 2012 Jasem Mutlaq. All rights reserved. Modifications Copyright(c) 2018 Andrew Brownbill. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. . 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 Library General Public License for more details. . You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *******************************************************************************/ #pragma once #include "beesimfirmware.h" #include "indifocuser.h" #include "indicom.h" #include "unistd.h" #include "focuser_state.h" // From the firmware. #include #include #include #include #include #include "beeconnect.h" namespace BeeFocused { /// /// @brief Simple Hash Function Template for C++ 11 Enum Classes /// struct EnumHash { // @brief Type convert any enum type to a size_t for hashing template std::size_t operator()(T enum_val) const { return static_cast(enum_val); } }; /// /// @brief What's the Focuser Hardware doing right now? /// enum class Mode { /// @brief Not connected yet! UNCONNECTED, /// @brief Idle and accepting new commands ACCEPT_COMMANDS, /// @brief Moving to a new positive MOVING, /// @brief Looking for the "home" end stop so it can sync (if supported) HOMING, /// @brief Idle and accepting new commands (low power mode) LOW_POWER, /// @brief Error Error Error! Hopefully we never see this. ERROR, }; /// @brief Map Focuser Mode to a user readable messages using ModeToString = std::unordered_map< const Mode, const std::string, EnumHash >; /// @brief Map Focuser Mode to a user readable string. extern const ModeToString stateFriendlyName; /// @brief Map Firmware SStatus String to the Focuser Mode. using StringToMode = std::unordered_map< const std::string, const Mode, std::hash >; /// @brief Map Firmware SStatus String to the Focuser Mode. extern const StringToMode focuserSStatusToMode; /// @brief How much time should we wait between Timer Hits? constexpr unsigned int AdvanceOnTimerHit=250; /// /// @brief A very basic optional value template /// /// In the spirit of boost::optional, but more basic /// template class Optional { public: /// @brief Default Constructor - value not set. Optional( ) : isValueSet{ false }, value{ T() } { } /// @brief Make an optional from a value Optional( const T& valueRHS ) : isValueSet{ true }, value{ valueRHS } { } /// @brief Get the optional's value. /// @return The value. Asserts if the value doesn't exist. T operator*() const { assert( isValueSet ); return value; } /// @brief Does the optional have a value? /// @return true if a value exists. explicit operator bool() const { return isValueSet; } private: bool isValueSet; T value; }; /// /// @brief Class that reads & records input from the Focuser /// class HardwareState { public: /// /// @brief Read new status from the Connection /// /// @param[in] connection - The interface to the connection. /// This may be a TCP/IP connection to the actual hardware /// or an interface to the Simulated Focuser. /// /// - Checks the connection for input /// - Records whatever it finds in this class. /// HardwareState( BeeFocusedCon::Interface* connection ); /// /// @brief Create an "Unconnected" hardware state. /// /// For when there's no value connection. /// HardwareState() { mode = Mode::UNCONNECTED; } /// @brief What mode (if any) did the focuser send? /// @return The focuser's mode Optional getMode() const { return mode; } /// @brief What sync status (if any) did the focuser send? /// @return True if the focuser is Synced, false otherwise Optional getIsSynced() const { return isSynced; } /// @brief What position status (if any) did the focuser send? /// @return The Current Position Optional getPosition() const { return currentPos; } /// @brief What is the focuser absolute maximum position? /// @return The Current Position Optional getMaxAbsPos() const { return maxAbsPos; } private: Optional mode; Optional isSynced; Optional currentPos; Optional maxAbsPos; }; /// /// @brief The INDI BeeFocus Driver Class /// class Driver: public INDI::Focuser { public: Driver(); virtual ~Driver() = default; // INDI device interface starts here const char *getDefaultName() override; bool initProperties() override; void ISGetProperties(const char *dev) override; bool AbortFocuser() override; bool SyncFocuser( uint32_t ticks ) override; bool updateProperties() override; bool Connect() override; bool Handshake() override; bool Disconnect() override; bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override; bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override; IPState MoveAbsFocuser(uint32_t targetTicks) override; IPState MoveRelFocuser(FocusDirection dir, uint32_t targetTicks) override; void TimerHit() override; private: /// /// @brief Given new information from the focuser, update status. /// /// @param[in] stateChanges - Information from the focuser. /// /// Takes information from the focuser, in the form of stateChanges, /// and updates the INDI status fields. /// void UpdateStatusInfo( const HardwareState& stateChanges ); /// /// @brief Get connection status in displayable form /// /// @return If Connection exists, gets Connection's status. If /// Connection doesn't exist returns "Not Connected" /// std::string getConStatus() const { return Connection ? Connection->GetStatus() : std::string("Not Connected"); } /// @brief Status of the Connection IText CStatusInfoT[1] {}; /// @brief Status of the Connection ITextVectorProperty CStatusInfoTP; /// @brief Status of the Focuser IText FStatusInfoT[2] {}; /// @brief Status of the Focuser ITextVectorProperty FStatusInfoTP; /// @brief Should we ignore the next status update packet? Wee hacky. bool ignoreNextStatusUpdate; /// @brief Timer ticks since the Focuser started. int timerTicks; /// @brief Abstract interface to the focuser (simulated or real) std::unique_ptr Connection; ////////////////////////////////////////////////////////////////// // // Simulated BeeFocus Focuser starts here. Used for testing // ////////////////////////////////////////////////////////////////// /// @brief The connection to the focuser. std::unique_ptr simConnection; /// @brief Handshake callback for the simulated focuser's connection bool mockCallHandshake( void ); /// @brief Simulated focuser. Simulates using the real hardware Firmware. std::unique_ptr simFirmware; /// @brief Outgoing data "pipe" to the focuser BeeFocusedCon::QueueOfChar toFirmware; /// @brief Incoming data "pipe" from the focuser BeeFocusedCon::QueueOfChar fromFirmware; }; /// /// @brief Break a string into Tokens /// /// @param[in] text - Input String. /// @return Tokenized Output /// /// See unit testing for usage examples. /// std::vector Tokenize( const std::string& text ); }; indi-beefocus-0.1+20220128183230/driver/beefocus.cpp0000644000175100017510000004023214174600255020472 0ustar debiandebian/******************************************************************************* Based on a driver Copyright(c) 2012 Jasem Mutlaq. All rights reserved. Copyright(c) 2018 Andrew Brownbill. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. . 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 Library General Public License for more details. . You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *******************************************************************************/ /// /// @brief Bee Focuser driver (Open Source IOT based focuser) /// /// The bee focuser is an Open Source Internet of Things focuser. /// The physical focusing hardware is based around an ESP8266 /// Internet of things board - these are small commodity boards /// that can either produce their own WiFi hot spot or connect to /// an existing WiFi hot spot. /// /// The focuser only works over WiFi. When wireless works reliably /// on a telescope, not having to deal with cables is really nice. /// #include "beefocus.h" #include "beeconnect.h" #include #include #include #include #include #include "connectionplugins/connectiontcp.h" ////////////////////////////////////////////////////////////////////// // // Declare the Driver's Singleton // ////////////////////////////////////////////////////////////////////// BeeFocused::Driver* getDriverSingleton() { static std::unique_ptr beeFocused(new BeeFocused::Driver()); return beeFocused.get(); } ////////////////////////////////////////////////////////////////////// // // Driver executable entry points // ////////////////////////////////////////////////////////////////////// void ISPoll(void *p); ////////////////////////////////////////////////////////////////////// // // Driver Class // ////////////////////////////////////////////////////////////////////// namespace BeeFocused { /// /// @brief Driver Constructor /// Driver::Driver() { simFirmware.reset( new BeeSimFirmware( &toFirmware, &fromFirmware )); FI::SetCapability( FOCUSER_CAN_ABS_MOVE | FOCUSER_CAN_REL_MOVE | FOCUSER_CAN_ABORT | FOCUSER_CAN_SYNC ); setSupportedConnections( CONNECTION_TCP ); timerTicks = 0; ignoreNextStatusUpdate = false; // // Create custom connection interface for the simulator and unit testing. // simConnection.reset( new Connection::Sim( this ) ); simConnection->registerHandshake([&]() { return mockCallHandshake(); }); } // // Establish a connection with the host using the INDI // TCP connection plugin. If the socket is established // TCP::Connect() will call Handshake() (below). // bool Driver::Connect() { LOGF_INFO("%s", "Attempting to connect" ); // For a TCP connection, calling Connect triggers TCP::Connect, // which establishes the connection and creates the FD. // Focuser::Handshake gets the FD from the TCP Connection and records // it. if (!INDI::Focuser::Connect()) { LOGF_ERROR("%s", "Connection Failed"); return false; } LOGF_INFO("%s", "Connection Succeeded"); return true; } // // See if we can get a valid response from the focuser // // 1. Create a connection object // 2. Sanity Check the Connection // 3. Reset Focuser Mode (todo - is this the right place) // 4. Send requests for state down the network // 5. Wait for responses // a) Check for input // b) Handle Lost Connection // c) Handle Received Handshake // 6. Handle Timeout // bool Driver::Handshake() { Connection::Interface* indiCon = getActiveConnection(); // 1. Actually create the connection object. // See Driver::Connect() for why we do this here. if ( indiCon->type() == Connection::Interface::CONNECTION_TCP ) { // 1a. Handle actual focuser over TCP/IP Connection.reset( new BeeFocusedCon::TCP( PortFD )); } else { // 1b. Handle Focuser Simulator Connection.reset( new BeeFocusedCon::Sim( toFirmware, fromFirmware ) ); } // 2. Sanity Check the Connection if ( Connection->Failed() ) { LOG_ERROR("Failed HandShake - Connection Failed"); return false; } // 3. Send requests for state down the network *Connection << "\n"; *Connection << "pstatus\n"; *Connection << "sstatus\n"; *Connection << "mstatus\n"; // 4. Wait for responses constexpr int timeBetweenChecks = 10; // in ms constexpr int timeOut = 3000; // in ms for ( int mtime= 0; mtime< timeOut ; mtime += timeBetweenChecks ) { // 4a) Check for input HardwareState input( Connection.get() ); // 4b) Handle Lost Connection if ( Connection->Failed() ) { LOG_ERROR("Failed HandShake - Connection went down."); return false; } Optional mode = input.getMode(); if ( mode && *mode != Mode::UNCONNECTED ) { LOG_INFO("Handshake Success"); LOG_INFO("Sending Home"); *Connection << "lazyhome\n"; *Connection << "caps\n"; *Connection << "pstatus\n"; *Connection << "sstatus\n"; *Connection << "mstatus\n"; return true; } usleep( timeBetweenChecks * 1000 ); simFirmware->advanceTime( timeBetweenChecks ); } // 5. Handle Timeout LOG_ERROR("Failed HandShake - Timeout"); return false; } // // 1. Set our state to "disconnected" // 2. Let everybody else clean up // bool Driver::Disconnect() { // 1. Set our state to "disconnected" Connection.reset( nullptr ); // 2. Let everybody else clean up INDI::Focuser::Disconnect(); return true; } const char *Driver::getDefaultName() { return (const char *)"Bee Focuser"; } // // Called at driver executable initialization via the // ISGetProperties(const char *dev) // // Pass through to the Focuser's ISGetProperties // void Driver::ISGetProperties(const char *dev) { if (dev != nullptr && strcmp(dev, getDeviceName()) != 0) return; INDI::Focuser::ISGetProperties(dev); } // // Create properties that will show up on the INDI UI // // Note - Called from DefaultDevice::ISGetProperties. // bool Driver::initProperties() { // // Set default properties for Focusers, based on the caps we set // when we initialized FI::SetCapability in the constructor. // INDI::Focuser::initProperties(); // // Register a custom connection for the Focuser simulator. Run after // INDI::Focuser::initProperties, which registers the TCP/IP interface, // so the TCP/IP interface is the default. // registerConnection( simConnection.get() ); // // Connection Status. // IUFillText( &CStatusInfoT[0], "CONNECT_STATUS", "Connection Status", getConStatus().c_str()); IUFillTextVector( &CStatusInfoTP, CStatusInfoT, 1, getDeviceName(), "CSTATUS", "Connection Status", MAIN_CONTROL_TAB, IP_RO, 0, IPS_OK ); IUFillText( &FStatusInfoT[0], "FOCUSER_STATUS", "Focuser Status", " " ); IUFillText( &FStatusInfoT[1], "HOME_STATUS", "Focuser Homed", " " ); IUFillTextVector( &FStatusInfoTP, FStatusInfoT, 2, getDeviceName(), "FSTATUS", "Focuser Status", MAIN_CONTROL_TAB, IP_RO, 0, IPS_OK ); // // Default settings. New settings will be grabbed once we connect // FocusAbsPosN[0].min = 0; FocusAbsPosN[0].max = 50000; FocusAbsPosN[0].value = 28200; FocusAbsPosN[0].step = 1; // // TODO - is port 4999 reasonable // tcpConnection->setDefaultPort(4999); // Sets the desired polling period in the DefaultDevice getCurrentPollingPeriod() setDefaultPollingPeriod(AdvanceOnTimerHit); return true; } bool Driver::AbortFocuser() { if ( !isConnected() || Connection->Failed() ) return false; *Connection << "ABORT\n"; if ( !Connection->Failed() ) { FocusAbsPosNP.s = IPS_IDLE; return true; } LOG_ERROR("Network Error while aborting"); return false; } bool Driver::SyncFocuser( uint32_t ticks ) { if ( !isConnected() || Connection->Failed() ) return false; *Connection << "SYNC=" << ticks << "\n"; ignoreNextStatusUpdate=true; if ( !Connection->Failed() ) { return true; } LOG_ERROR("Network Error while syncing"); return false; } void Driver::TimerHit() { simFirmware->advanceTime( getCurrentPollingPeriod() ); timerTicks++; if ( !isConnected()) { HardwareState nullState; UpdateStatusInfo( nullState ); SetTimer(getCurrentPollingPeriod()); return; } if ( Connection->Failed() ) { setConnected( false, IPS_ALERT ); HardwareState nullState; UpdateStatusInfo( nullState ); updateProperties(); return; } HardwareState hwState( Connection.get() ); // Send out a new status request if we get a status request back or // every 8 ticks if ( ( timerTicks % 8 ) == 0 || hwState.getIsSynced() ) { *Connection << "SSTATUS\n"; } if ( ( timerTicks % 8 ) == 0 || hwState.getMode() ) { *Connection << "MSTATUS\n"; } if ( ( timerTicks % 8 ) == 0 || hwState.getPosition() ) { *Connection << "PSTATUS\n"; } if ( !ignoreNextStatusUpdate ) { UpdateStatusInfo( hwState ); } ignoreNextStatusUpdate=false; SetTimer( getCurrentPollingPeriod() ); } void Driver::UpdateStatusInfo( const HardwareState& hwState ) { Optional mode = hwState.getMode(); if ( mode ) { std::string oldMode( FStatusInfoT[0].text ); std::string currentMode( stateFriendlyName.at( *mode ).c_str()); if ( oldMode != currentMode ) { IUSaveText( &(FStatusInfoT[0]), currentMode.c_str() ); IDSetText(&FStatusInfoTP, nullptr ); } IPState newPosState = currentMode == "Moving" ? IPS_BUSY : IPS_OK; if ( newPosState != FocusAbsPosNP.s ) { FocusAbsPosNP.s = newPosState; IDSetNumber(&FocusAbsPosNP, nullptr ); } if ( newPosState != FocusRelPosNP.s ) { FocusRelPosNP.s = newPosState; IDSetNumber(&FocusRelPosNP, nullptr ); } } std::string oldConStatus = CStatusInfoT[0].text; std::string curConStatus = getConStatus(); if ( oldConStatus != curConStatus ) { IUSaveText( &(CStatusInfoT[0]), curConStatus.c_str() ); IDSetText(&CStatusInfoTP, nullptr ); } Optional isSynced = hwState.getIsSynced(); if ( isSynced ) { std::string currentHomed = *isSynced ? "Synced" : "Not Synced"; std::string oldHomed( FStatusInfoT[1].text ); if ( oldHomed != currentHomed ) { IUSaveText( &(FStatusInfoT[1]), currentHomed.c_str() ); IDSetText(&FStatusInfoTP, nullptr ); } } Optional position = hwState.getPosition(); if ( position ) { if ( *position != FocusAbsPosN[0].value ) { FocusAbsPosN[0].value = *position; IDSetNumber(&FocusAbsPosNP, nullptr ); } } Optional maxAbsPos = hwState.getMaxAbsPos(); if ( maxAbsPos ) { if ( *maxAbsPos != FocusMaxPosN[0].value ) { FocusMaxPosN[0].value = *maxAbsPos; IDSetNumber(&FocusMaxPosNP, nullptr ); } } } /************************************************************************************ * ************************************************************************************/ bool Driver::updateProperties() { defineProperty( &CStatusInfoTP ); INDI::Focuser::updateProperties(); if (isConnected()) { defineProperty( &FStatusInfoTP ); } else { deleteProperty( FStatusInfoTP.name ); } return true; } /************************************************************************************ * ************************************************************************************/ bool Driver::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { return INDI::Focuser::ISNewSwitch(dev, name, states, names, n); } /************************************************************************************ * ************************************************************************************/ bool Driver::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) { // Let INDI::Focuser handle any other number properties return INDI::Focuser::ISNewNumber(dev, name, values, names, n); } /************************************************************************************ * ************************************************************************************/ IPState Driver::MoveAbsFocuser(uint32_t targetTicks) { if ( Connection->Failed() ) { // The Timer will handle connection shutdown. LOGF_INFO("%s", "Failed Update Focus - connection failed"); return IPS_ALERT; } if ( targetTicks > FocusMaxPosN[0].value ) { targetTicks = FocusMaxPosN[0].value; LOGF_WARN("Focuser will not move past maximum value of %d", (unsigned int ) FocusMaxPosN[0].value ); } // targetTicks is unsigned, we can't go below 0. LOGF_INFO("Setting ABS Focus to %d", targetTicks ); *Connection << "ABS_POS=" << targetTicks << "\n"; ignoreNextStatusUpdate = true; return IPS_BUSY; } IPState Driver::MoveRelFocuser(FocusDirection dir, uint32_t uticks) { if ( Connection->Failed() ) { // The Timer will handle connection shutdown. LOGF_INFO("%s", "Failed Update Focus - connection failed"); return IPS_ALERT; } // Firmware will handle out of bounds int ticks = (int) uticks; ticks = ( dir == FOCUS_INWARD ) ? -ticks : ticks; LOGF_INFO("Changing position by %d", ticks ); *Connection << "REL_POS=" << ticks << "\n"; return IPS_BUSY; } bool Driver::mockCallHandshake() { return Handshake(); } /////////////////////////////////////////////////////////////// // // Some random utilities // /////////////////////////////////////////////////////////////// const StringToMode focuserSStatusToMode = { { "ACCEPTING_COMMANDS", Mode::ACCEPT_COMMANDS }, { "MOVING", Mode::MOVING }, { "STOP_AT_HOME", Mode::HOMING }, { "LOW_POWER", Mode::LOW_POWER }, }; const ModeToString stateFriendlyName = { { Mode::UNCONNECTED, " " }, { Mode::ACCEPT_COMMANDS, "Ready" }, { Mode::MOVING, "Moving" }, { Mode::HOMING, "Searching for Home Position" }, { Mode::LOW_POWER, "Ready (Low Power Mode)" }, }; HardwareState::HardwareState( BeeFocusedCon::Interface* connection ) { while ( connection->DataReady()) { std::string input = GetString( *connection ); std::vector tokens = Tokenize( input ); if (tokens.size() >= 2 ) { std::string& verb = tokens[0]; std::string& noun = tokens[1]; if ( verb == "State:" ) { bool found=focuserSStatusToMode.find( noun ) != focuserSStatusToMode.end(); mode = !found ? Mode::ERROR : focuserSStatusToMode.at( noun ); } if ( verb == "Position:" ) { int pos = std::stoi( noun ); currentPos = pos > 0 ? pos : 0; } if ( verb == "Synched:" ) { isSynced = ( noun == "YES" ) ? true : false; } if ( verb == "MaxPos:" ) { maxAbsPos = std::stoi( noun ); } } } } std::vector Tokenize( const std::string& s) { std::vector< std::string > tokens; std::regex token_regex("(\\S+)"); auto begin = std::sregex_iterator( s.begin(), s.end(), token_regex ); for ( auto i = begin; i != std::sregex_iterator(); ++i ) { tokens.push_back( i->str() ); } return tokens; } } indi-beefocus-0.1+20220128183230/driver/beesimfirmware.cpp0000644000175100017510000000556214174600255021707 0ustar debiandebian#include "beesimfirmware.h" class MockFirmwareHardware: public HWI { public: MockFirmwareHardware() : count{ 0 } { } void DigitalWrite( HWI::Pin pin, HWI::PinState state ) override { // -Wunused-parameter - dumbest warning ever. (void)pin; (void)state; } void PinMode( HWI::Pin pin, HWI::PinIOMode mode ) override { // -Wunused-parameter - dumbest warning ever. (void)pin; (void)mode; } HWI::PinState DigitalRead( Pin pin ) override { assert( pin == HWI::Pin::HOME ); count += 1; return count < 2000 ? HWI::PinState::HOME_INACTIVE : HWI::PinState::HOME_ACTIVE; } private: int count; }; class MockFirmwareWifi: public NetInterface { public: MockFirmwareWifi( BeeFocusedCon::QueueOfChar* toFirmwareRHS, BeeFocusedCon::QueueOfChar* fromFirmwareRHS ) : toFirmware( toFirmwareRHS ), fromFirmware( fromFirmwareRHS ) { } void setup( DebugInterface& debugLog ) override { (void)debugLog; } bool getString( WifiDebugOstream& log, std::string& returnString ) override { (void)log; while ( !toFirmware->empty()) { char top = toFirmware->front(); toFirmware->pop(); if ( top == '\n' ) { returnString = outputString; outputString = ""; return true; } outputString += top; } return false; } NetInterface& operator<<( char c ) override { fromFirmware->push(c); return *this; } private: BeeFocusedCon::QueueOfChar* toFirmware; BeeFocusedCon::QueueOfChar* fromFirmware; std::string outputString; }; class MockFirmwareDebug: public DebugInterface { public: void rawWrite( const char* bytes, std::size_t numBytes ) override { // Silence -Wunused-parameter (void)bytes; (void)numBytes; } }; // // Bring up the simulated focuser. This is actually the ESP8266 // firmware sitting on the end of an emulated WiFi connection // BeeSimFirmware::BeeSimFirmware( BeeFocusedCon::QueueOfChar* toFirmware, BeeFocusedCon::QueueOfChar* fromFirmware ) : time{ 0 }, simulatedFocuserNextUpdate{ 0 } { std::unique_ptr mockFirmwareDebug( new MockFirmwareDebug ); std::unique_ptr mockFirmwareHardware( new MockFirmwareHardware); std::unique_ptr mockFirmwareWifi( new MockFirmwareWifi( toFirmware, fromFirmware ) ); FS::BuildParams params( FS::Build::LOW_POWER_HYPERSTAR_FOCUSER ); simulatedFocuser.reset( new FS::Focuser( std::move( mockFirmwareWifi ), std::move( mockFirmwareHardware ), std::move( mockFirmwareDebug ), params )); simulatedFocuserNextUpdate = 0; } void BeeSimFirmware::advanceTime( unsigned int amount ) { time += amount; if ( simulatedFocuser ) { while ( simulatedFocuserNextUpdate / 1000 <= time ) { simulatedFocuserNextUpdate+=simulatedFocuser->loop(); } } } indi-beefocus-0.1+20220128183230/driver/beeconnect.h0000644000175100017510000001354314174600255020456 0ustar debiandebian/// /// @brief Connection Interface and Helper Functions. /// /// File Jobs: /// /// - Provide an interface to the focuser /// - Convenience utilities for communicating with the focuser. /// /******************************************************************************* Copyright(c) 2018 Andrew Brownbill. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. . 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 Library General Public License for more details. . You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *******************************************************************************/ #pragma once #include "indifocuser.h" #include "indicom.h" #include "unistd.h" #include #include #include #include #include #include #include "connectionplugins/connectioninterface.h" namespace BeeFocusedCon { /// /// @brief Simple Hash Function Template for C++ 11 Enum Classes /// struct EnumHash { // @brief Type convert any enum type to a size_t for hashing template std::size_t operator()(T enum_val) const { return static_cast(enum_val); } }; /// /// @brief A Queue of Characters. /// /// Used by the driver to talk to a simulated focuser. /// using QueueOfChar = std::queue; /// /// @brief An Interface to a basic IO stream. /// /// A basic interface to a stream of characters (like a TCP/IP connection) /// /// Class Jobs: /// /// - Provide an interface to the focuser that works on both the real /// focuser hardware and a simulated version of the focuser. The later is /// used for testing. /// - Simplify Error handling and reporting. /// class Interface { public: Interface() : isFailed { false }, conStatus { "Connected" } { } virtual ~Interface() = default; /// @brief Has the connection errored out? bool Failed( void ) const { return isFailed; } /// @brief Put the connection into a failed state void Fail( std::string reason ) { isFailed = true; conStatus = reason; } /// @brief User friendly connection status. virtual std::string GetStatus( void ) const { return conStatus; } /// @brief Output a character to the connection. virtual Interface& operator<<( char c ) = 0; /// @brief Input a character from the connection. virtual Interface& operator>>( char &c ) = 0; /// @brief Are there characters ready to be read? virtual bool DataReady() = 0; protected: bool isFailed; std::string conStatus; private: }; /// /// @brief A TCP/IP connection to the Focuser. /// /// Class Jobs: /// /// - Implements the interface to the focuser hardware. /// - Error handling and reporting. /// /// Actual connection setup is done by INDI. Communicates using INDI's /// tty_* functions. /// class TCP: public Interface { public: /// @brief The one true constructor TCP( int fd_arg ) : fd{ fd_arg } { } // delete unused constructors for safety TCP() = delete; TCP( const TCP& ) = delete; TCP& operator=( const TCP& ) = delete; /// @brief Output a character to the connection. Interface& operator<<( char c ) override; /// @brief Input a character from the connection. Interface& operator>>( char &c ) override; /// @brief Are there characters ready to be read? bool DataReady(void) override; private: int GetTimeout(); int fd; }; /// /// @brief INDI Implementation of a simulated connection. /// /// - Implements the interface to the simulated focuser /// - Error handling and reporting. /// /// Communicates with the simulated focuser using shared Queues of /// Characters (QueueOfChar), which are passed in. /// class Sim: public Interface { public: /// @brief The one true constructor Sim( QueueOfChar& toFirmwareRHS, QueueOfChar& fromFirmwareRHS ) : toFirmware{ toFirmwareRHS } , fromFirmware{ fromFirmwareRHS } { } // delete unused constructors for safety Sim() = delete; Sim( const Sim& ) = delete; Sim& operator=( const Sim& ) = delete; /// @brief Output a character to the connection. Interface& operator<<( char c ) override; /// @brief Input a character from the connection. Interface& operator>>( char &c ) override; /// @brief Are there characters ready to be read? bool DataReady(void) override; private: std::queue& toFirmware; std::queue& fromFirmware; std::string outputString; }; /// /// @brief Blocking call to get a string from a connection /// /// @param[in] The connection /// @return The string /// /// If the connection fails an empty string is returned. /// std::string GetString( Interface& con ); /// /// @brief Stream operator for a C style string. /// Interface& operator<<( Interface& ostream, const char* string ); /// /// @brief Stream operator for an unsigned number /// Interface& operator<<( Interface& ostream, unsigned int i ); /// /// @brief Stream operator for a signed number /// Interface& operator<<( Interface& ostream, int i ); } // End BeeFocusedCon Namespace. // // Connection is a core INDI library namespace. // namespace Connection { /// /// @brief Sim interface for unit testing /// class Sim: public Interface { public: Sim(INDI::DefaultDevice *dev ); bool Connect() override; bool Disconnect() override; void Activated() override; void Deactivated() override; std::string name() override { return "SIMULATED_CONNECTION"; } std::string label() override { return "Simulated"; } }; } indi-beefocus-0.1+20220128183230/cmake_modules/0000755000175100017510000000000014174600255017507 5ustar debiandebianindi-beefocus-0.1+20220128183230/cmake_modules/FindGPSD.cmake0000644000175100017510000000103614174600255022047 0ustar debiandebian# - Find GPSD # Find the native GPSD includes and library FIND_PATH(GPSD_INCLUDE_DIR libgpsmm.h gps.h) SET(GPSD_NAMES ${GPSD_NAMES} gps) FIND_LIBRARY(GPSD_LIBRARY NAMES ${GPSD_NAMES} ) # handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GPSD DEFAULT_MSG GPSD_LIBRARY GPSD_INCLUDE_DIR) IF(GPSD_FOUND) SET(GPSD_LIBRARIES ${GPSD_LIBRARY}) message(STATUS "Found libgps: ${GPSD_LIBRARIES}") ENDIF(GPSD_FOUND) indi-beefocus-0.1+20220128183230/cmake_modules/FindFTDI1.cmake0000644000175100017510000000267214174600255022130 0ustar debiandebian# - Try to find FTDI1 # Once done this will define # # FTDI1_FOUND - system has FTDI # FTDI1_INCLUDE_DIR - the FTDI include directory # FTDI1_LIBRARIES - Link these to use FTDI # # N.B. You must include the file as following: # #include # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) # in cache already set(FTDI1_FOUND TRUE) message(STATUS "Found libftdi1: ${FTDI1_LIBRARIES}") else (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) find_path(FTDI1_INCLUDE_DIR ftdi.h PATH_SUFFIXES libftdi1 ${_obIncDir} ${GNUWIN32_DIR}/include /usr/local/include ) find_library(FTDI1_LIBRARIES NAMES ftdi1 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) set(FTDI1_FOUND TRUE) else (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) set(FTDI1_FOUND FALSE) endif(FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) if (FTDI1_FOUND) if (NOT FTDI1_FIND_QUIETLY) message(STATUS "Found FTDI1: ${FTDI1_LIBRARIES}") endif (NOT FTDI1_FIND_QUIETLY) else (FTDI1_FOUND) if (FTDI1_FIND_REQUIRED) message(FATAL_ERROR "FTDI not found. Please install libftdi1-dev") endif (FTDI1_FIND_REQUIRED) endif (FTDI1_FOUND) mark_as_advanced(FTDI1_INCLUDE_DIR FTDI1_LIBRARIES) endif (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindOpenAL.cmake0000644000175100017510000000660414174600255022436 0ustar debiandebian# Locate OpenAL # This module defines # OPENAL_LIBRARY # OPENAL_FOUND, if false, do not try to link to OpenAL # OPENAL_INCLUDE_DIR, where to find the headers # # $OPENALDIR is an environment variable that would # correspond to the ./configure --prefix=$OPENALDIR # used in building OpenAL. # # Created by Eric Wing. This was influenced by the FindSDL.cmake module. # This makes the presumption that you are include al.h like # #include "al.h" # and not # #include # The reason for this is that the latter is not entirely portable. # Windows/Creative Labs does not by default put their headers in AL/ and # OS X uses the convention . # # For Windows, Creative Labs seems to have added a registry key for their # OpenAL 1.1 installer. I have added that key to the list of search paths, # however, the key looks like it could be a little fragile depending on # if they decide to change the 1.00.0000 number for bug fix releases. # Also, they seem to have laid down groundwork for multiple library platforms # which puts the library in an extra subdirectory. Currently there is only # Win32 and I have hardcoded that here. This may need to be adjusted as # platforms are introduced. # The OpenAL 1.0 installer doesn't seem to have a useful key I can use. # I do not know if the Nvidia OpenAL SDK has a registry key. # # For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger). # To support the framework, I originally wrote special framework detection # code in this module which I have now removed with CMake's introduction # of native support for frameworks. # In addition, OpenAL is open source, and it is possible to compile on Panther. # Furthermore, due to bugs in the initial OpenAL release, and the # transition to OpenAL 1.1, it is common to need to override the built-in # framework. # Per my request, CMake should search for frameworks first in # the following order: # ~/Library/Frameworks/OpenAL.framework/Headers # /Library/Frameworks/OpenAL.framework/Headers # /System/Library/Frameworks/OpenAL.framework/Headers # # On OS X, this will prefer the Framework version (if found) over others. # People will have to manually change the cache values of # OPENAL_LIBRARY to override this selection or set the CMake environment # CMAKE_INCLUDE_PATH to modify the search paths. FIND_PATH(OPENAL_INCLUDE_DIR al.h PATHS $ENV{OPENALDIR} NO_DEFAULT_PATH PATH_SUFFIXES include/AL include/OpenAL include ) FIND_PATH(OPENAL_INCLUDE_DIR al.h PATHS ~/Library/Frameworks /Library/Frameworks /usr/local /usr /sw # Fink /opt/local # DarwinPorts /opt/csw # Blastwave /opt [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] PATH_SUFFIXES include/AL include/OpenAL include ) FIND_LIBRARY(OPENAL_LIBRARY NAMES OpenAL al openal OpenAL32 PATHS $ENV{OPENALDIR} NO_DEFAULT_PATH PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 ) FIND_LIBRARY(OPENAL_LIBRARY NAMES OpenAL al openal OpenAL32 PATHS ~/Library/Frameworks /Library/Frameworks /usr/local /usr /sw /opt/local /opt/csw /opt [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 ) SET(OPENAL_FOUND "NO") IF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) SET(OPENAL_FOUND "YES") ENDIF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) indi-beefocus-0.1+20220128183230/cmake_modules/FindFFTW3.cmake0000644000175100017510000000257314174600255022152 0ustar debiandebian# - Try to find FFTW3 # Once done this will define # # FFTW3_FOUND - system has FFTW3 # FFTW3_INCLUDE_DIR - the FFTW3 include directory # FFTW3_LIBRARIES - Link these to use FFTW3 # FFTW3_VERSION_STRING - Human readable version number of fftw3 # FFTW3_VERSION_MAJOR - Major version number of fftw3 # FFTW3_VERSION_MINOR - Minor version number of fftw3 # Copyright (c) 2017, Ilia Platone, # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FFTW3_LIBRARIES) # in cache already set(FFTW3_FOUND TRUE) message(STATUS "Found FFTW3: ${FFTW3_LIBRARIES}") else (FFTW3_LIBRARIES) find_library(FFTW3_LIBRARIES NAMES fftw3 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(FFTW3_LIBRARIES) set(FFTW3_FOUND TRUE) else (FFTW3_LIBRARIES) set(FFTW3_FOUND FALSE) endif(FFTW3_LIBRARIES) if (FFTW3_FOUND) if (NOT FFTW3_FIND_QUIETLY) message(STATUS "Found FFTW3: ${FFTW3_LIBRARIES}") endif (NOT FFTW3_FIND_QUIETLY) else (FFTW3_FOUND) if (FFTW3_FIND_REQUIRED) message(FATAL_ERROR "FFTW3 not found. Please install libfftw3-dev") endif (FFTW3_FIND_REQUIRED) endif (FFTW3_FOUND) mark_as_advanced(FFTW3_LIBRARIES) endif (FFTW3_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindMALLINCAM.cmake0000644000175100017510000000301314174600255022604 0ustar debiandebian# - Try to find MALLINCAM Camera Library # Once done this will define # # MALLINCAM_FOUND - system has Levenhuk # MALLINCAM_INCLUDE_DIR - the Levenhuk include directory # MALLINCAM_LIBRARIES - Link these to use Levenhuk # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) # in cache already set(MALLINCAM_FOUND TRUE) message(STATUS "Found libnncam: ${MALLINCAM_LIBRARIES}") else (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) find_path(MALLINCAM_INCLUDE_DIR mallincam.h PATH_SUFFIXES libmallincam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(MALLINCAM_LIBRARIES NAMES mallincam PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) set(MALLINCAM_FOUND TRUE) else (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) set(MALLINCAM_FOUND FALSE) endif(MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) if (MALLINCAM_FOUND) if (NOT MALLINCAM_FIND_QUIETLY) message(STATUS "Found MALLINCAM: ${MALLINCAM_LIBRARIES}") endif (NOT MALLINCAM_FIND_QUIETLY) else (MALLINCAM_FOUND) if (MALLINCAM_FIND_REQUIRED) message(FATAL_ERROR "MALLINCAM not found. Please install MALLINCAM Library http://www.indilib.org") endif (MALLINCAM_FIND_REQUIRED) endif (MALLINCAM_FOUND) mark_as_advanced(MALLINCAM_INCLUDE_DIR MALLINCAM_LIBRARIES) endif (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindNova.cmake0000644000175100017510000000304614174600255022220 0ustar debiandebian# - Try to find NOVA # Once done this will define # # NOVA_FOUND - system has NOVA # NOVA_INCLUDE_DIR - the NOVA include directory # NOVA_LIBRARIES - Link these to use NOVA # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) # in cache already set(NOVA_FOUND TRUE) message(STATUS "Found libnova: ${NOVA_LIBRARIES}") else (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) find_path(NOVA_INCLUDE_DIR libnova.h PATH_SUFFIXES libnova ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(NOVA_LIBRARIES NAMES nova libnova libnovad PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) set(CMAKE_REQUIRED_INCLUDES ${NOVA_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${NOVA_LIBRARIES}) if(NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) set(NOVA_FOUND TRUE) else (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) set(NOVA_FOUND FALSE) endif(NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) if (NOVA_FOUND) if (NOT Nova_FIND_QUIETLY) message(STATUS "Found NOVA: ${NOVA_LIBRARIES}") endif (NOT Nova_FIND_QUIETLY) else (NOVA_FOUND) if (Nova_FIND_REQUIRED) message(FATAL_ERROR "libnova not found. Please install libnova development package.") endif (Nova_FIND_REQUIRED) endif (NOVA_FOUND) mark_as_advanced(NOVA_INCLUDE_DIR NOVA_LIBRARIES) endif (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindVorbis.cmake0000644000175100017510000000204414174600255022556 0ustar debiandebian# - Find vorbis # Find the native vorbis includes and libraries # # VORBIS_INCLUDE_DIR - where to find vorbis.h, etc. # VORBIS_LIBRARIES - List of libraries when using vorbis(file). # VORBIS_FOUND - True if vorbis found. if(VORBIS_INCLUDE_DIR) # Already in cache, be silent set(VORBIS_FIND_QUIETLY TRUE) endif(VORBIS_INCLUDE_DIR) find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) find_library(OGG_LIBRARY NAMES ogg) find_library(VORBIS_LIBRARY NAMES vorbis) find_library(VORBISFILE_LIBRARY NAMES vorbisfile) # Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND to TRUE if # all listed variables are TRUE. include(FindPackageHandleStandardArgs) find_package_handle_standard_args(VORBIS DEFAULT_MSG VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBIS_LIBRARY) if(VORBIS_FOUND) set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY}) else(VORBIS_FOUND) set(VORBIS_LIBRARIES) endif(VORBIS_FOUND) mark_as_advanced(VORBIS_INCLUDE_DIR) mark_as_advanced(OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY) indi-beefocus-0.1+20220128183230/cmake_modules/FindJPEG.cmake0000644000175100017510000000166314174600255022045 0ustar debiandebian# - Find JPEG # Find the native JPEG includes and library # This module defines # JPEG_INCLUDE_DIR, where to find jpeglib.h, etc. # JPEG_LIBRARIES, the libraries needed to use JPEG. # JPEG_FOUND, If false, do not try to use JPEG. # also defined, but not for general use are # JPEG_LIBRARY, where to find the JPEG library. FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h) SET(JPEG_NAMES ${JPEG_NAMES} jpeg) FIND_LIBRARY(JPEG_LIBRARY NAMES ${JPEG_NAMES} ) # handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR) IF(JPEG_FOUND) SET(JPEG_LIBRARIES ${JPEG_LIBRARY}) ENDIF(JPEG_FOUND) # Deprecated declarations. SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} ) GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH) MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR ) indi-beefocus-0.1+20220128183230/cmake_modules/FindCFITSIO.cmake0000644000175100017510000000434614174600255022421 0ustar debiandebian# - Try to find CFITSIO # Once done this will define # # CFITSIO_FOUND - system has CFITSIO # CFITSIO_INCLUDE_DIR - the CFITSIO include directory # CFITSIO_LIBRARIES - Link these to use CFITSIO # CFITSIO_VERSION_STRING - Human readable version number of cfitsio # CFITSIO_VERSION_MAJOR - Major version number of cfitsio # CFITSIO_VERSION_MINOR - Minor version number of cfitsio # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) # in cache already set(CFITSIO_FOUND TRUE) message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}") else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) # JM: Packages from different distributions have different suffixes find_path(CFITSIO_INCLUDE_DIR fitsio.h PATH_SUFFIXES libcfitsio3 libcfitsio0 cfitsio ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(CFITSIO_LIBRARIES NAMES cfitsio PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) set(CFITSIO_FOUND TRUE) else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) set(CFITSIO_FOUND FALSE) endif(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) if (CFITSIO_FOUND) # Find the version of the cfitsio header file(STRINGS ${CFITSIO_INCLUDE_DIR}/fitsio.h CFITSIO_VERSION_STRING LIMIT_COUNT 1 REGEX "CFITSIO_VERSION") STRING(REGEX REPLACE "[^0-9.]" "" CFITSIO_VERSION_STRING ${CFITSIO_VERSION_STRING}) STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\1" CFITSIO_VERSION_MAJOR ${CFITSIO_VERSION_STRING}) STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\2" CFITSIO_VERSION_MINOR ${CFITSIO_VERSION_STRING}) if (NOT CFITSIO_FIND_QUIETLY) message(STATUS "Found CFITSIO ${CFITSIO_VERSION_STRING}: ${CFITSIO_LIBRARIES}") endif (NOT CFITSIO_FIND_QUIETLY) else (CFITSIO_FOUND) if (CFITSIO_FIND_REQUIRED) message(STATUS "CFITSIO not found.") endif (CFITSIO_FIND_REQUIRED) endif (CFITSIO_FOUND) mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES) endif (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindUSB1.cmake0000644000175100017510000000562314174600255022032 0ustar debiandebian# - Try to find libusb-1.0 # Once done this will define # # USB1_FOUND - system has libusb-1.0 # USB1_INCLUDE_DIRS - the libusb-1.0 include directories # USB1_LIBRARIES - Link these to use libusb-1.0 # USB1_DEFINITIONS - Compiler switches required for using libusb-1.0 # # USB1_HAS_LIBUSB_ERROR_NAME - defined when libusb-1.0 has libusb_error_name() #============================================================================= # Copyright (c) 2017 Pino Toscano # # 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 copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. #============================================================================= find_package(PkgConfig) pkg_check_modules(PC_LIBUSB1 QUIET libusb-1.0) find_path(USB1_INCLUDE_DIR NAMES libusb.h HINTS ${PC_LIBUSB1_INCLUDE_DIRS} PATH_SUFFIXES libusb-1.0 ) find_library(USB1_LIBRARY NAMES ${PC_LIBUSB1_LIBRARIES} usb-1.0 HINTS ${PC_LIBUSB1_LIBRARY_DIRS} ) set(USB1_INCLUDE_DIRS ${USB1_INCLUDE_DIR}) set(USB1_LIBRARIES ${USB1_LIBRARY}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(USB1 FOUND_VAR USB1_FOUND REQUIRED_VARS USB1_LIBRARY USB1_INCLUDE_DIR VERSION_VAR PC_LIBUSB1_VERSION ) mark_as_advanced(USB1_INCLUDE_DIRS USB1_LIBRARIES) if(USB1_FOUND) include(CheckCXXSourceCompiles) include(CMakePushCheckState) cmake_push_check_state(RESET) set(CMAKE_REQUIRED_INCLUDES ${USB1_INCLUDE_DIRS}) set(CMAKE_REQUIRED_LIBRARIES ${USB1_LIBRARIES}) check_cxx_source_compiles("#include int main() { libusb_error_name(0); return 0; }" USB1_HAS_LIBUSB_ERROR_NAME) cmake_pop_check_state() endif() indi-beefocus-0.1+20220128183230/cmake_modules/FindGMock.cmake0000644000175100017510000001162314174600255022315 0ustar debiandebian#.rst: # FindGMock # --------- # # Locate the Google C++ Mocking Framework. # # Defines the following variables: # # :: # # GMOCK_FOUND - Found the Google Mocking framework # GMOCK_INCLUDE_DIRS - Include directories # # # # Also defines the library variables below as normal variables. These # contain debug/optimized keywords when a debugging library is found. # # :: # # GMOCK_LIBRARIES - libgmock # # # # Accepts the following variables as input: # # :: # # GMOCK_ROOT - (as a CMake or environment variable) # The root directory of the gmock install prefix # # # # :: # # GMOCK_MSVC_SEARCH - If compiling with MSVC, this variable can be set to # "MD" or "MT" to enable searching a GMock build tree # (defaults: "MD") # # # # Example Usage: # # :: # # find_package(GMock REQUIRED) # include_directories(${GMOCK_INCLUDE_DIRS}) # # # # :: # # add_executable(foo foo.cc) # target_link_libraries(foo ${GMOCK_LIBRARIES}) # # # # :: # # add_test(AllMocksInFoo foo) # # # # # # If you would like each Google test to show up in CMock as a test you # may use the following macro. NOTE: It will slow down your tests by # running an executable for each test and test fixture. You will also # have to rerun CMake after adding or removing tests or test fixtures. # # GMOCK_ADD_MOCKS(executable extra_args ARGN) # # :: # # executable = The path to the test executable # extra_args = Pass a list of extra arguments to be passed to # executable enclosed in quotes (or "" for none) # ARGN = A list of source files to search for tests & test # fixtures. # # # # :: # # Example: # set(FooMockArgs --foo 1 --bar 2) # add_executable(FooMock FooUnitMock.cc) # GMOCK_ADD_MOCKS(FooMock "${FooMockArgs}" FooUnitMock.cc) #============================================================================= # Copyright 2009 Kitware, Inc. # Copyright 2009 Philip Lowman # Copyright 2009 Daniel Blezek # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # # Thanks to Daniel Blezek for the GMOCK_ADD_MOCKS code function(GMOCK_ADD_MOCKS executable extra_args) if(NOT ARGN) message(FATAL_ERROR "Missing ARGN: Read the documentation for GMOCK_ADD_MOCKS") endif() foreach(source ${ARGN}) file(READ "${source}" contents) string(REGEX MATCHALL "MOCK_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) foreach(hit ${found_tests}) string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) add_test(${test_name} ${executable} --gmock_filter=${test_name} ${extra_args}) endforeach() endforeach() endfunction() function(_gmock_append_debugs _endvar _library) if(${_library} AND ${_library}_DEBUG) set(_output optimized ${${_library}} debug ${${_library}_DEBUG}) else() set(_output ${${_library}}) endif() set(${_endvar} ${_output} PARENT_SCOPE) endfunction() function(_gmock_find_library _name) find_library(${_name} NAMES ${ARGN} HINTS ENV GMOCK_ROOT ${GMOCK_ROOT} PATH_SUFFIXES ${_gmock_libpath_suffixes} ) mark_as_advanced(${_name}) endfunction() # if(NOT DEFINED GMOCK_MSVC_SEARCH) set(GMOCK_MSVC_SEARCH MD) endif() set(_gmock_libpath_suffixes lib) if(MSVC) if(GMOCK_MSVC_SEARCH STREQUAL "MD") list(APPEND _gmock_libpath_suffixes msvc/gmock-md/Debug msvc/gmock-md/Release) elseif(GMOCK_MSVC_SEARCH STREQUAL "MT") list(APPEND _gmock_libpath_suffixes msvc/gmock/Debug msvc/gmock/Release) endif() endif() find_path(GMOCK_INCLUDE_DIR gmock/gmock.h HINTS $ENV{GMOCK_ROOT}/include ${GMOCK_ROOT}/include ) mark_as_advanced(GMOCK_INCLUDE_DIR) if(MSVC AND GMOCK_MSVC_SEARCH STREQUAL "MD") # The provided /MD project files for Google Mock add -md suffixes to the # library names. _gmock_find_library(GMOCK_LIBRARY gmock-md gmock) _gmock_find_library(GMOCK_LIBRARY_DEBUG gmock-mdd gmockd) else() _gmock_find_library(GMOCK_LIBRARY gmock) _gmock_find_library(GMOCK_LIBRARY_DEBUG gmockd) endif() FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMock DEFAULT_MSG GMOCK_LIBRARY GMOCK_INCLUDE_DIR) if(GMOCK_FOUND) set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR}) _gmock_append_debugs(GMOCK_LIBRARIES GMOCK_LIBRARY) endif() indi-beefocus-0.1+20220128183230/cmake_modules/FindPackageMessage.cmake0000644000175100017510000000375514174600255024164 0ustar debiandebian#.rst: # FindPackageMessage # ------------------ # # # # FIND_PACKAGE_MESSAGE( "message for user" "find result details") # # This macro is intended to be used in FindXXX.cmake modules files. It # will print a message once for each unique find result. This is useful # for telling the user where a package was found. The first argument # specifies the name (XXX) of the package. The second argument # specifies the message to display. The third argument lists details # about the find result so that if they change the message will be # displayed again. The macro also obeys the QUIET argument to the # find_package command. # # Example: # # :: # # if(X11_FOUND) # FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" # "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") # else() # ... # endif() #============================================================================= # Copyright 2008-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) function(FIND_PACKAGE_MESSAGE pkg msg details) # Avoid printing a message repeatedly for the same find result. if(NOT ${pkg}_FIND_QUIETLY) string(REPLACE "\n" "" details "${details}") set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") # The message has not yet been printed. message(STATUS "${msg}") # Save the find details in the cache to avoid printing the same # message again. set("${DETAILS_VAR}" "${details}" CACHE INTERNAL "Details about finding ${pkg}") endif() endif() endfunction() indi-beefocus-0.1+20220128183230/cmake_modules/FindFTDI.cmake0000644000175100017510000000267114174600255022046 0ustar debiandebian# - Try to find FTDI # This finds libFTDI that is compatible with old libusb v 0.1 # For newer libusb > 1.0, use FindFTDI1.cmake # Once done this will define # # FTDI_FOUND - system has FTDI # FTDI_INCLUDE_DIR - the FTDI include directory # FTDI_LIBRARIES - Link these to use FTDI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) # in cache already set(FTDI_FOUND TRUE) message(STATUS "Found libftdi: ${FTDI_LIBRARIES}") else (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) find_path(FTDI_INCLUDE_DIR ftdi.h PATH_SUFFIXES libftdi1 ${_obIncDir} ${GNUWIN32_DIR}/include /usr/local/include ) find_library(FTDI_LIBRARIES NAMES ftdi ftdi1 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) set(FTDI_FOUND TRUE) else (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) set(FTDI_FOUND FALSE) endif(FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) if (FTDI_FOUND) if (NOT FTDI_FIND_QUIETLY) message(STATUS "Found FTDI: ${FTDI_LIBRARIES}") endif (NOT FTDI_FIND_QUIETLY) else (FTDI_FOUND) if (FTDI_FIND_REQUIRED) message(FATAL_ERROR "FTDI not found. Please install libftdi-dev") endif (FTDI_FIND_REQUIRED) endif (FTDI_FOUND) mark_as_advanced(FTDI_INCLUDE_DIR FTDI_LIBRARIES) endif (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindMODBUS.cmake0000644000175100017510000000320114174600255022277 0ustar debiandebian# - Try to find libmodbus # Once done this will define # # MODBUS_FOUND - system has MODBUS # MODBUS_INCLUDE_DIR - the MODBUS include directory # MODBUS_LIBRARIES - Link these to use MODBUS # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) # in cache already set(MODBUS_FOUND TRUE) message(STATUS "Found libmodbus: ${MODBUS_LIBRARIES}") else (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) find_path(MODBUS_INCLUDE_DIR modbus.h PATH_SUFFIXES modbus ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(MODBUS_LIBRARIES NAMES modbus PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) set(CMAKE_REQUIRED_INCLUDES ${MODBUS_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${MODBUS_LIBRARIES}) if(MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) set(MODBUS_FOUND TRUE) else (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) set(MODBUS_FOUND FALSE) endif(MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) if (MODBUS_FOUND) if (NOT MODBUS_FIND_QUIETLY) message(STATUS "Found libmodbus: ${MODBUS_LIBRARIES}") endif (NOT MODBUS_FIND_QUIETLY) else (MODBUS_FOUND) if (MODBUS_FIND_REQUIRED) message(FATAL_ERROR "libmodbus not found. Please install libmodbus-devel. https://launchpad.net/libmodbus/") endif (MODBUS_FIND_REQUIRED) endif (MODBUS_FOUND) mark_as_advanced(MODBUS_INCLUDE_DIR MODBUS_LIBRARIES) endif (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindSTARSHOOTG.cmake0000644000175100017510000000307014174600255023007 0ustar debiandebian# - Try to find Starshoot Camera Library # Once done this will define # # STARSHOOTG_FOUND - system has Starshoot # STARSHOOTG_INCLUDE_DIR - the Starshoot include directory # STARSHOOTG_LIBRARIES - Link these to use Starshoot # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) # in cache already set(STARSHOOTG_FOUND TRUE) message(STATUS "Found libstarshootg: ${STARSHOOTG_LIBRARIES}") else (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) find_path(STARSHOOTG_INCLUDE_DIR starshootg.h PATH_SUFFIXES libstarshootg ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(STARSHOOTG_LIBRARIES NAMES starshootg PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) set(STARSHOOTG_FOUND TRUE) else (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) set(STARSHOOTG_FOUND FALSE) endif(STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) if (STARSHOOTG_FOUND) if (NOT STARSHOOTG_FIND_QUIETLY) message(STATUS "Found StarshootG: ${STARSHOOTG_LIBRARIES}") endif (NOT STARSHOOTG_FIND_QUIETLY) else (STARSHOOTG_FOUND) if (STARSHOOTG_FIND_REQUIRED) message(FATAL_ERROR "StarshootG not found. Please install StarshootG Library http://www.indilib.org") endif (STARSHOOTG_FIND_REQUIRED) endif (STARSHOOTG_FOUND) mark_as_advanced(STARSHOOTG_INCLUDE_DIR STARSHOOTG_LIBRARIES) endif (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/InstallImported.cmake0000644000175100017510000000661114174600255023627 0ustar debiandebian function (install_imported) cmake_parse_arguments (ARG "" "DESTINATION" "TARGETS" ${ARGN}) if (NOT DEFINED ARG_DESTINATION) message (FATAL_ERROR "DESTINATION not defined") endif () foreach (target ${ARG_TARGETS}) get_target_property (location ${target} LOCATION) get_target_property (version ${target} VERSION) get_target_property (soversion ${target} SOVERSION) get_target_property (output_name ${target} OUTPUT_NAME) get_target_property (suffix ${target} SUFFIX) get_target_property (type ${target} TYPE) if (NOT ${type} STREQUAL "SHARED_LIBRARY") message (FATAL_ERROR "install_imported: ${type} not supported") endif () if (${location} STREQUAL "${target}-NOTFOUND") return () endif () if (NOT ${version} STREQUAL "version-NOTFOUND") set (version ".${version}") else () set (version "") endif () if (NOT ${soversion} STREQUAL "soversion-NOTFOUND") set (soversion ".${soversion}") else () set (soversion "") endif () if (${output_name} STREQUAL "output_name-NOTFOUND") set (output_name ${target}) endif () set (name_noversion "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${CMAKE_SHARED_LIBRARY_SUFFIX}") if (APPLE) set (name_version "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${version}${CMAKE_SHARED_LIBRARY_SUFFIX}") set (name_soversion "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${soversion}${CMAKE_SHARED_LIBRARY_SUFFIX}") else () set (name_version "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${CMAKE_SHARED_LIBRARY_SUFFIX}${version}") set (name_soversion "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${CMAKE_SHARED_LIBRARY_SUFFIX}${soversion}") endif () if (NOT IS_ABSOLUTE ${location}) set (location ${CMAKE_CURRENT_SOURCE_DIR}/${location}) endif () if (NOT ${name_noversion} STREQUAL ${name_soversion}) add_custom_command ( OUTPUT ${name_noversion} COMMAND ${CMAKE_COMMAND} -E create_symlink ${name_soversion} ${name_noversion} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} MAIN_DEPENDENCY ${name_soversion} ) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${name_noversion} DESTINATION ${ARG_DESTINATION}) endif () if (NOT ${name_soversion} STREQUAL ${name_version}) add_custom_command ( OUTPUT ${name_soversion} COMMAND ${CMAKE_COMMAND} -E create_symlink ${name_version} ${name_soversion} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} MAIN_DEPENDENCY ${name_version} ) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${name_soversion} DESTINATION ${ARG_DESTINATION}) endif () add_custom_command ( OUTPUT ${name_version} COMMAND ${CMAKE_COMMAND} -E copy "${location}" "${CMAKE_CURRENT_BINARY_DIR}/${name_version}" MAIN_DEPENDENCY ${location} ) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${name_version} DESTINATION ${ARG_DESTINATION}) add_custom_target( imported_${output_name} ALL DEPENDS ${name_version} ${name_noversion} ${name_soversion} ) endforeach () endfunction () indi-beefocus-0.1+20220128183230/cmake_modules/FindAHPXC.cmake0000644000175100017510000000273214174600255022161 0ustar debiandebian# - Try to find AHPXC Universal Library # Once done this will define # # AHPXC_FOUND - system has AHPXC # AHPXC_INCLUDE_DIR - the AHPXC include directory # AHPXC_LIBRARIES - Link these to use AHPXC # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) # in cache already set(AHPXC_FOUND TRUE) message(STATUS "Found libahp_xc: ${AHPXC_LIBRARIES}") else (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) find_path(AHPXC_INCLUDE_DIR ahp_xc.h PATH_SUFFIXES ahp ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(AHPXC_LIBRARIES NAMES ahp_xc PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) set(AHPXC_FOUND TRUE) else (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) set(AHPXC_FOUND FALSE) endif(AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) if (AHPXC_FOUND) if (NOT AHPXC_FIND_QUIETLY) message(STATUS "Found AHP XC: ${AHPXC_LIBRARIES}") endif (NOT AHPXC_FIND_QUIETLY) else (AHPXC_FOUND) if (AHPXC_FIND_REQUIRED) message(FATAL_ERROR "AHP XC not found. Please install libahp_xc http://www.indilib.org") endif (AHPXC_FIND_REQUIRED) endif (AHPXC_FOUND) mark_as_advanced(AHPXC_INCLUDE_DIR AHPXC_LIBRARIES) endif (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindFLI.cmake0000644000175100017510000000264514174600255021733 0ustar debiandebian# - Try to find Finger Lakes Instruments Library # Once done this will define # # FLI_FOUND - system has FLI # FLI_INCLUDE_DIR - the FLI include directory # FLI_LIBRARIES - Link these to use FLI # Copyright (c) 2008, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FLI_INCLUDE_DIR AND FLI_LIBRARIES) # in cache already set(FLI_FOUND TRUE) message(STATUS "Found libfli: ${FLI_LIBRARIES}") else (FLI_INCLUDE_DIR AND FLI_LIBRARIES) find_path(FLI_INCLUDE_DIR libfli.h PATH_SUFFIXES fli ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(FLI_LIBRARIES NAMES fli PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(FLI_INCLUDE_DIR AND FLI_LIBRARIES) set(FLI_FOUND TRUE) else (FLI_INCLUDE_DIR AND FLI_LIBRARIES) set(FLI_FOUND FALSE) endif(FLI_INCLUDE_DIR AND FLI_LIBRARIES) if (FLI_FOUND) if (NOT FLI_FIND_QUIETLY) message(STATUS "Found FLI: ${FLI_LIBRARIES}") endif (NOT FLI_FIND_QUIETLY) else (FLI_FOUND) if (FLI_FIND_REQUIRED) message(FATAL_ERROR "FLI not found. Please install libfli-dev. http://www.indilib.org") endif (FLI_FIND_REQUIRED) endif (FLI_FOUND) mark_as_advanced(FLI_INCLUDE_DIR FLI_LIBRARIES) endif (FLI_INCLUDE_DIR AND FLI_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindASI.cmake0000644000175100017510000000356514174600255021737 0ustar debiandebian# - Try to find ASI Library # Once done this will define # # ASI_FOUND - system has ASI # ASI_INCLUDE_DIR - the ASI include directory # ASI_LIBRARIES - Link these to use ASI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (ASI_INCLUDE_DIR AND ASI_LIBRARIES) # in cache already set(ASI_FOUND TRUE) message(STATUS "Found libasi: ${ASI_LIBRARIES}") else (ASI_INCLUDE_DIR AND ASI_LIBRARIES) find_path(ASI_INCLUDE_DIR ASICamera2.h PATH_SUFFIXES libasi ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(ASICAM_LIBRARIES NAMES ASICamera2 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(ASIEFW_LIBRARIES NAMES EFWFilter PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(ASIST4_LIBRARIES NAMES USB2ST4Conv PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(ASIEAF_LIBRARIES NAMES EAFFocuser PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if (ASICAM_LIBRARIES AND ASIEFW_LIBRARIES AND ASIST4_LIBRARIES AND ASIEAF_LIBRARIES) set(ASI_LIBRARIES ${ASICAM_LIBRARIES} ${ASIEFW_LIBRARIES} ${ASIST4_LIBRARIES} ${ASIEAF_LIBRARIES}) endif (ASICAM_LIBRARIES AND ASIEFW_LIBRARIES AND ASIST4_LIBRARIES AND ASIEAF_LIBRARIES) if(ASI_INCLUDE_DIR AND ASI_LIBRARIES) set(ASI_FOUND TRUE) else (ASI_INCLUDE_DIR AND ASI_LIBRARIES) set(ASI_FOUND FALSE) endif(ASI_INCLUDE_DIR AND ASI_LIBRARIES) if (ASI_FOUND) if (NOT ASI_FIND_QUIETLY) message(STATUS "Found ASI: ${ASI_LIBRARIES}") endif (NOT ASI_FIND_QUIETLY) else (ASI_FOUND) if (ASI_FIND_REQUIRED) message(FATAL_ERROR "ASI not found. Please install libasi http://www.indilib.org") endif (ASI_FIND_REQUIRED) endif (ASI_FOUND) mark_as_advanced(ASI_INCLUDE_DIR ASI_LIBRARIES) endif (ASI_INCLUDE_DIR AND ASI_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindINDI.cmake0000644000175100017510000003457414174600255022052 0ustar debiandebian# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # This module can find INDI Library # # Requirements: # - CMake >= 2.8.3 (for new version of find_package_handle_standard_args) # # The following variables will be defined for your use: # - INDI_FOUND : were all of your specified components found (include dependencies)? # - INDI_WEBSOCKET : was INDI compiled with websocket support? # - INDI_INCLUDE_DIR : INDI include directory # - INDI_DATA_DIR : INDI include directory # - INDI_LIBRARIES : INDI libraries # - INDI_DRIVER_LIBRARIES : Same as above maintained for backward compatibility # - INDI_VERSION : complete version of INDI (x.y.z) # - INDI_MAJOR_VERSION : major version of INDI # - INDI_MINOR_VERSION : minor version of INDI # - INDI_RELEASE_VERSION : release version of INDI # - INDI__FOUND : were found? (FALSE for non specified component if it is not a dependency) # # For windows or non standard installation, define INDI_ROOT variable to point to the root installation of INDI. Two ways: # - run cmake with -DINDI_ROOT= # - define an environment variable with the same name before running cmake # With cmake-gui, before pressing "Configure": # 1) Press "Add Entry" button # 2) Add a new entry defined as: # - Name: INDI_ROOT # - Type: choose PATH in the selection list # - Press "..." button and select the root installation of INDI # # Example Usage: # # 1. Copy this file in the root of your project source directory # 2. Then, tell CMake to search this non-standard module in your project directory by adding to your CMakeLists.txt: # set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) # 3. Finally call find_package() once, here are some examples to pick from # # Require INDI 1.4 or later # find_package(INDI 1.4 REQUIRED) # # if(INDI_FOUND) # include_directories(${INDI_INCLUDE_DIR}) # add_executable(myapp myapp.cpp) # target_link_libraries(myapp ${INDI_LIBRARIES}) # endif(INDI_FOUND) # # # Using Components: # # You can search for specific components. Currently, the following components are available # * driver: to build INDI hardware drivers. # * align: to build drivers that use INDI Alignment Subsystem. # * client: to build pure C++ INDI clients. # * clientqt5: to build Qt5-based INDI clients. # * lx200: To build LX200-based 3rd party drivers (you must link with driver above as well). # # By default, if you do not specify any components, driver and align components are searched. # # Example: # # To use INDI Qt5 Client library only in your application: # # find_package(INDI COMPONENTS clientqt5 REQUIRED) # # if(INDI_FOUND) # include_directories(${INDI_INCLUDE_DIR}) # add_executable(myapp myapp.cpp) # target_link_libraries(myapp ${INDI_LIBRARIES}) # endif(INDI_FOUND) # # To use INDI driver + lx200 component in your application: # # find_package(INDI COMPONENTS driver lx200 REQUIRED) # # if(INDI_FOUND) # include_directories(${INDI_INCLUDE_DIR}) # add_executable(myapp myapp.cpp) # target_link_libraries(myapp ${INDI_LIBRARIES}) # endif(INDI_FOUND) # # Notice we still use ${INDI_LIBRARIES} which now should contain both driver & lx200 libraries. #============================================================================================== # Copyright (c) 2011-2013, julp # Copyright (c) 2017-2019 Jasem Mutlaq # # Distributed under the OSI-approved BSD License # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTINDILAR PURPOSE. #============================================================================= find_package(PkgConfig QUIET) ########## Private ########## if(NOT DEFINED INDI_PUBLIC_VAR_NS) set(INDI_PUBLIC_VAR_NS "INDI") # Prefix for all INDI relative public variables endif(NOT DEFINED INDI_PUBLIC_VAR_NS) if(NOT DEFINED INDI_PRIVATE_VAR_NS) set(INDI_PRIVATE_VAR_NS "_${INDI_PUBLIC_VAR_NS}") # Prefix for all INDI relative internal variables endif(NOT DEFINED INDI_PRIVATE_VAR_NS) if(NOT DEFINED PC_INDI_PRIVATE_VAR_NS) set(PC_INDI_PRIVATE_VAR_NS "_PC${INDI_PRIVATE_VAR_NS}") # Prefix for all pkg-config relative internal variables endif(NOT DEFINED PC_INDI_PRIVATE_VAR_NS) function(indidebug _VARNAME) if(${INDI_PUBLIC_VAR_NS}_DEBUG) if(DEFINED ${INDI_PUBLIC_VAR_NS}_${_VARNAME}) message("${INDI_PUBLIC_VAR_NS}_${_VARNAME} = ${${INDI_PUBLIC_VAR_NS}_${_VARNAME}}") else(DEFINED ${INDI_PUBLIC_VAR_NS}_${_VARNAME}) message("${INDI_PUBLIC_VAR_NS}_${_VARNAME} = ") endif(DEFINED ${INDI_PUBLIC_VAR_NS}_${_VARNAME}) endif(${INDI_PUBLIC_VAR_NS}_DEBUG) endfunction(indidebug) set(${INDI_PRIVATE_VAR_NS}_ROOT "") if(DEFINED ENV{INDI_ROOT}) set(${INDI_PRIVATE_VAR_NS}_ROOT "$ENV{INDI_ROOT}") endif(DEFINED ENV{INDI_ROOT}) if (DEFINED INDI_ROOT) set(${INDI_PRIVATE_VAR_NS}_ROOT "${INDI_ROOT}") endif(DEFINED INDI_ROOT) set(${INDI_PRIVATE_VAR_NS}_BIN_SUFFIXES ) set(${INDI_PRIVATE_VAR_NS}_LIB_SUFFIXES ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) list(APPEND ${INDI_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin64") list(APPEND ${INDI_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib64") endif(CMAKE_SIZEOF_VOID_P EQUAL 8) list(APPEND ${INDI_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin") list(APPEND ${INDI_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib") set(${INDI_PRIVATE_VAR_NS}_COMPONENTS ) # ... macro(INDI_declare_component _NAME) list(APPEND ${INDI_PRIVATE_VAR_NS}_COMPONENTS ${_NAME}) set("${INDI_PRIVATE_VAR_NS}_COMPONENTS_${_NAME}" ${ARGN}) endmacro(INDI_declare_component) INDI_declare_component(driver indidriver) INDI_declare_component(align indiAlignmentDriver) INDI_declare_component(client indiclient) INDI_declare_component(clientqt5 indiclientqt5) INDI_declare_component(lx200 indilx200) ########## Public ########## set(${INDI_PUBLIC_VAR_NS}_FOUND TRUE) set(${INDI_PUBLIC_VAR_NS}_LIBRARIES ) set(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR ) foreach(${INDI_PRIVATE_VAR_NS}_COMPONENT ${${INDI_PRIVATE_VAR_NS}_COMPONENTS}) string(TOUPPER "${${INDI_PRIVATE_VAR_NS}_COMPONENT}" ${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT) set("${INDI_PUBLIC_VAR_NS}_${${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE) # may be done in the INDI_declare_component macro endforeach(${INDI_PRIVATE_VAR_NS}_COMPONENT) # Check components if(NOT ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS) # driver and posix client by default set(${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS driver align) else(NOT ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS) #list(APPEND ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS uc) list(REMOVE_DUPLICATES ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS) foreach(${INDI_PRIVATE_VAR_NS}_COMPONENT ${${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS}) if(NOT DEFINED ${INDI_PRIVATE_VAR_NS}_COMPONENTS_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) message(FATAL_ERROR "Unknown INDI component: ${${INDI_PRIVATE_VAR_NS}_COMPONENT}") endif(NOT DEFINED ${INDI_PRIVATE_VAR_NS}_COMPONENTS_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) endforeach(${INDI_PRIVATE_VAR_NS}_COMPONENT) endif(NOT ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS) # Includes find_path( ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR indidevapi.h PATH_SUFFIXES libindi include/libindi ${PC_INDI_INCLUDE_DIR} ${_obIncDir} ${GNUWIN32_DIR}/include HINTS ${${INDI_PRIVATE_VAR_NS}_ROOT} DOC "Include directory for INDI" ) find_path( WEBSOCKET_HEADER indiwsserver.h PATH_SUFFIXES libindi ${PC_INDI_INCLUDE_DIR} ${_obIncDir} ${GNUWIN32_DIR}/include ) if (WEBSOCKET_HEADER) SET(INDI_WEBSOCKET TRUE) else() SET(INDI_WEBSOCKET FALSE) endif() find_path(${INDI_PUBLIC_VAR_NS}_DATA_DIR drivers.xml PATH_SUFFIXES share/indi DOC "Data directory for INDI" ) if(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR) if(EXISTS "${${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR}/indiversion.h") # INDI >= 1.4 file(READ "${${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR}/indiversion.h" ${INDI_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS) else() message(FATAL_ERROR "INDI version header not found") endif() if(${INDI_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*INDI_VERSION ([0-9]+).([0-9]+).([0-9]+)") set(${INDI_PUBLIC_VAR_NS}_MAJOR_VERSION "${CMAKE_MATCH_1}") set(${INDI_PUBLIC_VAR_NS}_MINOR_VERSION "${CMAKE_MATCH_2}") set(${INDI_PUBLIC_VAR_NS}_RELEASE_VERSION "${CMAKE_MATCH_3}") else() message(FATAL_ERROR "failed to detect INDI version") endif() set(${INDI_PUBLIC_VAR_NS}_VERSION "${${INDI_PUBLIC_VAR_NS}_MAJOR_VERSION}.${${INDI_PUBLIC_VAR_NS}_MINOR_VERSION}.${${INDI_PUBLIC_VAR_NS}_RELEASE_VERSION}") # Check libraries foreach(${INDI_PRIVATE_VAR_NS}_COMPONENT ${${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS}) set(${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES ) set(${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES ) foreach(${INDI_PRIVATE_VAR_NS}_BASE_NAME ${${INDI_PRIVATE_VAR_NS}_COMPONENTS_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}) list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}") list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}d") list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}${INDI_MAJOR_VERSION}${INDI_MINOR_VERSION}") list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}${INDI_MAJOR_VERSION}${INDI_MINOR_VERSION}d") endforeach(${INDI_PRIVATE_VAR_NS}_BASE_NAME) find_library( ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} NAMES ${${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES} HINTS ${${INDI_PRIVATE_VAR_NS}_ROOT} PATH_SUFFIXES ${_INDI_LIB_SUFFIXES} DOC "Release libraries for INDI" ) find_library( ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT} NAMES ${${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES} HINTS ${${INDI_PRIVATE_VAR_NS}_ROOT} PATH_SUFFIXES ${_INDI_LIB_SUFFIXES} DOC "Debug libraries for INDI" ) string(TOUPPER "${${INDI_PRIVATE_VAR_NS}_COMPONENT}" ${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT) if(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # both not found set("${INDI_PUBLIC_VAR_NS}_${${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE) set("${INDI_PUBLIC_VAR_NS}_FOUND" FALSE) else(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # one or both found set("${INDI_PUBLIC_VAR_NS}_${${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" TRUE) if(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # release not found => we are in debug set(${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT} "${${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}") elseif(NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # debug not found => we are in release set(${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT} "${${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}") else() # both found set( ${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT} optimized ${${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}} debug ${${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}} ) endif() list(APPEND ${INDI_PUBLIC_VAR_NS}_LIBRARIES ${${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}) endif(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) endforeach(${INDI_PRIVATE_VAR_NS}_COMPONENT) # Check find_package arguments include(FindPackageHandleStandardArgs) if(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) find_package_handle_standard_args( ${INDI_PUBLIC_VAR_NS} REQUIRED_VARS ${INDI_PUBLIC_VAR_NS}_LIBRARIES ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR VERSION_VAR ${INDI_PUBLIC_VAR_NS}_VERSION ) else(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) find_package_handle_standard_args(${INDI_PUBLIC_VAR_NS} "INDI not found" ${INDI_PUBLIC_VAR_NS}_LIBRARIES ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR) endif(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) else(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR) set("${INDI_PUBLIC_VAR_NS}_FOUND" FALSE) if(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) message(FATAL_ERROR "Could not find INDI include directory") endif(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) endif(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR) mark_as_advanced( ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR ${INDI_PUBLIC_VAR_NS}_LIBRARIES INDI_WEBSOCKET ) # IN (args) indidebug("FIND_COMPONENTS") indidebug("FIND_REQUIRED") indidebug("FIND_QUIETLY") indidebug("FIND_VERSION") # OUT # Found indidebug("FOUND") indidebug("SERVER_FOUND") indidebug("DRIVERS_FOUND") indidebug("CLIENT_FOUND") indidebug("QT5CLIENT_FOUND") indidebug("LX200_FOUND") # Linking indidebug("INCLUDE_DIR") indidebug("DATA_DIR") indidebug("LIBRARIES") # Backward compatibility set(${INDI_PUBLIC_VAR_NS}_DRIVER_LIBRARIES ${${INDI_PUBLIC_VAR_NS}_LIBRARIES}) indidebug("DRIVER_LIBRARIES") # Version indidebug("MAJOR_VERSION") indidebug("MINOR_VERSION") indidebug("RELEASE_VERSION") indidebug("VERSION") indi-beefocus-0.1+20220128183230/cmake_modules/CMakeCommon.cmake0000644000175100017510000001366714174600255022657 0ustar debiandebian include(CheckCCompilerFlag) #IF (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") #SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") #ENDIF () # C++14 Support if (NOT ANDROID) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif(NOT ANDROID) # Position Independent Code set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Ccache support IF (ANDROID OR UNIX OR APPLE) FIND_PROGRAM(CCACHE_FOUND ccache) SET(CCACHE_SUPPORT OFF CACHE BOOL "Enable ccache support") IF ((CCACHE_FOUND OR ANDROID) AND CCACHE_SUPPORT MATCHES ON) SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) ENDIF () ENDIF () # Add security (hardening flags) IF (UNIX OR APPLE OR ANDROID) # Older compilers are predefining _FORTIFY_SOURCE, so defining it causes a # warning, which is then considered an error. Second issue is that for # these compilers, _FORTIFY_SOURCE must be used while optimizing, else # causes a warning, which also results in an error. And finally, CMake is # not using optimization when testing for libraries, hence breaking the build. CHECK_C_COMPILER_FLAG("-Werror -D_FORTIFY_SOURCE=2" COMPATIBLE_FORTIFY_SOURCE) IF (${COMPATIBLE_FORTIFY_SOURCE}) SET(SEC_COMP_FLAGS "-D_FORTIFY_SOURCE=2") ENDIF () SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -fstack-protector-all -fPIE") # Make sure to add optimization flag. Some systems require this for _FORTIFY_SOURCE. IF (NOT CMAKE_BUILD_TYPE MATCHES "MinSizeRel" AND NOT CMAKE_BUILD_TYPE MATCHES "Release" AND NOT CMAKE_BUILD_TYPE MATCHES "Debug") SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -O1") ENDIF () IF (NOT ANDROID AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT APPLE AND NOT CYGWIN) SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -Wa,--noexecstack") ENDIF () SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SEC_COMP_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SEC_COMP_FLAGS}") SET(SEC_LINK_FLAGS "") IF (NOT APPLE AND NOT CYGWIN) SET(SEC_LINK_FLAGS "${SEC_LINK_FLAGS} -Wl,-z,nodump -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now") ENDIF () IF (NOT ANDROID AND NOT APPLE) SET(SEC_LINK_FLAGS "${SEC_LINK_FLAGS} -pie") ENDIF () SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SEC_LINK_FLAGS}") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SEC_LINK_FLAGS}") ENDIF () # Warning, debug and linker flags SET(FIX_WARNINGS OFF CACHE BOOL "Enable strict compilation mode to turn compiler warnings to errors") IF (UNIX OR APPLE) SET(COMP_FLAGS "") SET(LINKER_FLAGS "") # Verbose warnings and turns all to errors SET(COMP_FLAGS "${COMP_FLAGS} -Wall -Wextra") IF (FIX_WARNINGS) SET(COMP_FLAGS "${COMP_FLAGS} -Werror") ENDIF () # Omit problematic warnings IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-unused-but-set-variable") ENDIF () IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.9.9) SET(COMP_FLAGS "${COMP_FLAGS} -Wno-format-truncation") ENDIF () IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-nonnull -Wno-deprecated-declarations") ENDIF () # Minimal debug info with Clang IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") SET(COMP_FLAGS "${COMP_FLAGS} -gline-tables-only") ELSE () SET(COMP_FLAGS "${COMP_FLAGS} -g") ENDIF () # Note: The following flags are problematic on older systems with gcc 4.8 IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9.9)) IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-unused-command-line-argument") ENDIF () FIND_PROGRAM(LDGOLD_FOUND ld.gold) SET(LDGOLD_SUPPORT OFF CACHE BOOL "Enable ld.gold support") # Optional ld.gold is 2x faster than normal ld IF (LDGOLD_FOUND AND LDGOLD_SUPPORT MATCHES ON AND NOT APPLE AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES arm) SET(LINKER_FLAGS "${LINKER_FLAGS} -fuse-ld=gold") # Use Identical Code Folding SET(COMP_FLAGS "${COMP_FLAGS} -ffunction-sections") SET(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--icf=safe") # Compress the debug sections # Note: Before valgrind 3.12.0, patch should be applied for valgrind (https://bugs.kde.org/show_bug.cgi?id=303877) IF (NOT APPLE AND NOT ANDROID AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES arm AND NOT CMAKE_CXX_CLANG_TIDY) SET(COMP_FLAGS "${COMP_FLAGS} -Wa,--compress-debug-sections") SET(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--compress-debug-sections=zlib") ENDIF () ENDIF () ENDIF () # Apply the flags SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMP_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMP_FLAGS}") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}") ENDIF () # Sanitizer support SET(CLANG_SANITIZERS OFF CACHE BOOL "Clang's sanitizer support") IF (CLANG_SANITIZERS AND ((UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR (APPLE AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") ENDIF () # Unity Build support include(UnityBuild) indi-beefocus-0.1+20220128183230/cmake_modules/FindINOVASDK.cmake0000644000175100017510000000275314174600255022537 0ustar debiandebian# - Try to find INOVASDK Universal Library # Once done this will define # # INOVASDK_FOUND - system has INOVASDK # INOVASDK_INCLUDE_DIR - the INOVASDK include directory # INOVASDK_LIBRARIES - Link these to use INOVASDK # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) # in cache already set(INOVASDK_FOUND TRUE) message(STATUS "Found libinovasdk: ${INOVASDK_LIBRARIES}") else (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) find_path(INOVASDK_INCLUDE_DIR inovasdk.h PATH_SUFFIXES inovasdk ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(INOVASDK_LIBRARIES NAMES inovasdk PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) set(INOVASDK_FOUND TRUE) else (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) set(INOVASDK_FOUND FALSE) endif(INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) if (INOVASDK_FOUND) if (NOT INOVASDK_FIND_QUIETLY) message(STATUS "Found INOVASDK: ${INOVASDK_LIBRARIES}") endif (NOT INOVASDK_FIND_QUIETLY) else (INOVASDK_FOUND) if (INOVASDK_FIND_REQUIRED) message(FATAL_ERROR "INOVASDK not found. Please install INOVASDK Library http://www.indilib.org") endif (INOVASDK_FIND_REQUIRED) endif (INOVASDK_FOUND) mark_as_advanced(INOVASDK_INCLUDE_DIR INOVASDK_LIBRARIES) endif (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindQHY.cmake0000644000175100017510000000242614174600255021757 0ustar debiandebian# - Try to find QHY Library # Once done this will define # # QHY_FOUND - system has QHY # QHY_INCLUDE_DIR - the QHY include directory # QHY_LIBRARIES - Link these to use QHY # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (QHY_INCLUDE_DIR AND QHY_LIBRARIES) # in cache already set(QHY_FOUND TRUE) message(STATUS "Found libqhyccd: ${QHY_LIBRARIES}") else (QHY_INCLUDE_DIR AND QHY_LIBRARIES) find_path(QHY_INCLUDE_DIR qhyccd.h PATH_SUFFIXES libqhy ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(QHY_LIBRARIES NAMES qhyccd PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(QHY_INCLUDE_DIR AND QHY_LIBRARIES) set(QHY_FOUND TRUE) else (QHY_INCLUDE_DIR AND QHY_LIBRARIES) set(QHY_FOUND FALSE) endif(QHY_INCLUDE_DIR AND QHY_LIBRARIES) if (QHY_FOUND) if (NOT QHY_FIND_QUIETLY) message(STATUS "Found QHY: ${QHY_LIBRARIES}") endif (NOT QHY_FIND_QUIETLY) else (QHY_FOUND) if (QHY_FIND_REQUIRED) message(FATAL_ERROR "QHY not found. Please install libqhy http://www.indilib.org") endif (QHY_FIND_REQUIRED) endif (QHY_FOUND) mark_as_advanced(QHY_INCLUDE_DIR QHY_LIBRARIES) endif (QHY_INCLUDE_DIR AND QHY_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindPENTAX.cmake0000644000175100017510000000553014174600255022314 0ustar debiandebian# - Try to find PENTAX Universal Libraries # Once done this will define # # PENTAX_FOUND - system has PENTAX # PENTAX_INCLUDE_DIR - the PENTAX include directory # PENTAX_LIBRARIES - Link these to use PENTAX # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) # in cache already set(PENTAX_FOUND TRUE) message(STATUS "Found PENTAX libraries: ${PENTAX_LIBRARIES}") else (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) find_path(PKTRIGGERCORD_INCLUDE_DIR libpktriggercord.h PATH_SUFFIXES libpktriggercord ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(PKTRIGGERCORD_LIBRARIES NAMES pktriggercord PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib PATH_SUFFIXES indipentax ) #if not armv8, then look for ricoh library; otherwise only use pktriggercord library if(NOT (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^aarch64")) find_path(RICOH_INCLUDE_DIR ricoh_camera_sdk.hpp PATH_SUFFIXES libpentax libricohcamerasdk ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(RICOH_LIBRARIES NAMES RicohCameraSDKCpp PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(RICOHMTP_LIBRARIES NAMES libmtpricoh.so.9.3.0 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if (RICOH_INCLUDE_DIR AND PKTRIGGERCORD_INCLUDE_DIR) set(PENTAX_INCLUDE_DIR ${RICOH_INCLUDE_DIR} ${PKTRIGGERCORD_INCLUDE_DIR}) endif (RICOH_INCLUDE_DIR AND PKTRIGGERCORD_INCLUDE_DIR) if (RICOH_LIBRARIES AND RICOHMTP_LIBRARIES AND PKTRIGGERCORD_LIBRARIES) set(PENTAX_LIBRARIES ${RICOH_LIBRARIES} ${RICOHMTP_LIBRARIES} ${PKTRIGGERCORD_LIBRARIES}) endif (RICOH_LIBRARIES AND RICOHMTP_LIBRARIES AND PKTRIGGERCORD_LIBRARIES) else() if (PKTRIGGERCORD_INCLUDE_DIR) set(PENTAX_INCLUDE_DIR ${PKTRIGGERCORD_INCLUDE_DIR}) endif (PKTRIGGERCORD_INCLUDE_DIR) if (PKTRIGGERCORD_LIBRARIES) set(PENTAX_LIBRARIES ${PKTRIGGERCORD_LIBRARIES}) endif (PKTRIGGERCORD_LIBRARIES) endif() if(PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) set(PENTAX_FOUND TRUE) else (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) set(PENTAX_FOUND FALSE) endif(PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) if (PENTAX_FOUND) if (NOT PENTAX_FIND_QUIETLY) message(STATUS "Found PENTAX libraries: ${PENTAX_LIBRARIES}") endif (NOT PENTAX_FIND_QUIETLY) else (PENTAX_FOUND) if (PENTAX_FIND_REQUIRED) message(FATAL_ERROR "One or both of libricohcamersdk and libpktriggercord are not found. Please install them. See http://www.indilib.org.") endif (PENTAX_FIND_REQUIRED) endif (PENTAX_FOUND) mark_as_advanced(PENTAX_INCLUDE_DIR PENTAX_LIBRARIES) endif (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindGLIB2.cmake0000644000175100017510000001327114174600255022115 0ustar debiandebian# - Try to find GLib2 # Once done this will define # # GLIB2_FOUND - system has GLib2 # GLIB2_INCLUDE_DIRS - the GLib2 include directory # GLIB2_LIBRARIES - Link these to use GLib2 # # HAVE_GLIB_GREGEX_H glib has gregex.h header and # supports g_regex_match_simple # # Copyright (c) 2006 Andreas Schneider # Copyright (c) 2006 Philippe Bernery # Copyright (c) 2007 Daniel Gollub # Copyright (c) 2007 Alban Browaeys # Copyright (c) 2008 Michael Bell # Copyright (c) 2008 Bjoern Ricks # # Redistribution and use is allowed according to the terms of the New # BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) # in cache already SET(GLIB2_FOUND TRUE) ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) INCLUDE(FindPkgConfig) ## Glib IF ( GLIB2_FIND_REQUIRED ) SET( _pkgconfig_REQUIRED "REQUIRED" ) ELSE ( GLIB2_FIND_REQUIRED ) SET( _pkgconfig_REQUIRED "" ) ENDIF ( GLIB2_FIND_REQUIRED ) IF ( GLIB2_MIN_VERSION ) PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} ) ELSE ( GLIB2_MIN_VERSION ) PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 ) ENDIF ( GLIB2_MIN_VERSION ) IF ( PKG_CONFIG_FOUND ) IF ( GLIB2_FOUND ) SET ( GLIB2_CORE_FOUND TRUE ) ELSE ( GLIB2_FOUND ) SET ( GLIB2_CORE_FOUND FALSE ) ENDIF ( GLIB2_FOUND ) ENDIF ( PKG_CONFIG_FOUND ) # Look for glib2 include dir and libraries w/o pkgconfig IF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) FIND_PATH( _glibconfig_include_DIR NAMES glibconfig.h PATHS /opt/gnome/lib64 /opt/gnome/lib /opt/lib/ /opt/local/lib /sw/lib/ /usr/lib64 /usr/lib /usr/local/include ${CMAKE_LIBRARY_PATH} PATH_SUFFIXES glib-2.0/include ) FIND_PATH( _glib2_include_DIR NAMES glib.h PATHS /opt/gnome/include /opt/local/include /sw/include /usr/include /usr/local/include PATH_SUFFIXES glib-2.0 ) #MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}") FIND_LIBRARY( _glib2_link_DIR NAMES glib-2.0 glib PATHS /opt/gnome/lib /opt/local/lib /sw/lib /usr/lib /usr/local/lib ) IF ( _glib2_include_DIR AND _glib2_link_DIR ) SET ( _glib2_FOUND TRUE ) ENDIF ( _glib2_include_DIR AND _glib2_link_DIR ) IF ( _glib2_FOUND ) SET ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} ) SET ( GLIB2_LIBRARIES ${_glib2_link_DIR} ) SET ( GLIB2_CORE_FOUND TRUE ) ELSE ( _glib2_FOUND ) SET ( GLIB2_CORE_FOUND FALSE ) ENDIF ( _glib2_FOUND ) # Handle dependencies # libintl IF ( NOT LIBINTL_FOUND ) FIND_PATH(LIBINTL_INCLUDE_DIR NAMES libintl.h PATHS /opt/gnome/include /opt/local/include /sw/include /usr/include /usr/local/include ) FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl PATHS /opt/gnome/lib /opt/local/lib /sw/lib /usr/local/lib /usr/lib ) IF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) SET (LIBINTL_FOUND TRUE) ENDIF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) ENDIF ( NOT LIBINTL_FOUND ) # libiconv IF ( NOT LIBICONV_FOUND ) FIND_PATH(LIBICONV_INCLUDE_DIR NAMES iconv.h PATHS /opt/gnome/include /opt/local/include /opt/local/include /sw/include /sw/include /usr/local/include /usr/include PATH_SUFFIXES glib-2.0 ) FIND_LIBRARY(LIBICONV_LIBRARY NAMES iconv PATHS /opt/gnome/lib /opt/local/lib /sw/lib /usr/lib /usr/local/lib ) IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) SET (LIBICONV_FOUND TRUE) ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) ENDIF ( NOT LIBICONV_FOUND ) IF (LIBINTL_FOUND) SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY}) SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR}) ENDIF (LIBINTL_FOUND) IF (LIBICONV_FOUND) SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY}) SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR}) ENDIF (LIBICONV_FOUND) ENDIF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) ## IF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) SET (GLIB2_FOUND TRUE) ENDIF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) IF (GLIB2_FOUND) IF (NOT GLIB2_FIND_QUIETLY) MESSAGE (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}") ENDIF (NOT GLIB2_FIND_QUIETLY) ELSE (GLIB2_FOUND) IF (GLIB2_FIND_REQUIRED) MESSAGE (SEND_ERROR "Could not find GLib2") ENDIF (GLIB2_FIND_REQUIRED) ENDIF (GLIB2_FOUND) # show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view MARK_AS_ADVANCED(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES) MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY) MARK_AS_ADVANCED(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY) ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS) IF ( GLIB2_FOUND ) # Check if system has a newer version of glib # which supports g_regex_match_simple INCLUDE( CheckIncludeFiles ) SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} ) CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H ) # Reset CMAKE_REQUIRED_INCLUDES SET( CMAKE_REQUIRED_INCLUDES "" ) ENDIF( GLIB2_FOUND ) indi-beefocus-0.1+20220128183230/cmake_modules/FindATIK.cmake0000644000175100017510000000254014174600255022043 0ustar debiandebian# - Try to find Atik Camera Library # Once done this will define # # ATIK_FOUND - system has ATIK # ATIK_INCLUDE_DIR - the ATIK include directory # ATIK_LIBRARIES - Link these to use ATIK # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) # in cache already set(ATIK_FOUND TRUE) message(STATUS "Found libatik: ${ATIK_LIBRARIES}") else (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) find_path(ATIK_INCLUDE_DIR AtikCameras.h PATH_SUFFIXES libatik ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(ATIK_LIBRARIES NAMES atikcameras PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) set(ATIK_FOUND TRUE) else (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) set(ATIK_FOUND FALSE) endif(ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) if (ATIK_FOUND) if (NOT ATIK_FIND_QUIETLY) message(STATUS "Found Atik Library: ${ATIK_LIBRARIES}") endif (NOT ATIK_FIND_QUIETLY) else (ATIK_FOUND) if (ATIK_FIND_REQUIRED) message(FATAL_ERROR "Atik Library not found. Please install Atik Library http://www.indilib.org") endif (ATIK_FIND_REQUIRED) endif (ATIK_FOUND) mark_as_advanced(ATIK_INCLUDE_DIR ATIK_LIBRARIES) endif (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindALUT.cmake0000644000175100017510000000504214174600255022060 0ustar debiandebian# - Locate ALUT # This module defines # ALUT_LIBRARY # ALUT_FOUND, if false, do not try to link to OpenAL # ALUT_INCLUDE_DIR, where to find the headers # # $OPENALDIR is an environment variable that would # correspond to the ./configure --prefix=$OPENALDIR # used in building OpenAL. # # Created by Bryan Donlan, based on the FindOpenAL.cmake module by Eric Wang. FIND_PATH(ALUT_INCLUDE_DIR alut.h $ENV{OPENALDIR}/include ~/Library/Frameworks/OpenAL.framework/Headers /Library/Frameworks/OpenAL.framework/Headers /System/Library/Frameworks/OpenAL.framework/Headers # Tiger /usr/local/include/AL /usr/local/include/OpenAL /usr/local/include /usr/include/AL /usr/include/OpenAL /usr/include /sw/include/AL # Fink /sw/include/OpenAL /sw/include /opt/local/include/AL # DarwinPorts /opt/local/include/OpenAL /opt/local/include /opt/csw/include/AL # Blastwave /opt/csw/include/OpenAL /opt/csw/include /opt/include/AL /opt/include/OpenAL /opt/include ) # I'm not sure if I should do a special casing for Apple. It is # unlikely that other Unix systems will find the framework path. # But if they do ([Next|Open|GNU]Step?), # do they want the -framework option also? IF(${ALUT_INCLUDE_DIR} MATCHES ".framework") STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR}) IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" ) # String is in default search path, don't need to use -F SET (ALUT_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX") ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" ) # String is not /Library/Frameworks, need to use -F SET(ALUT_LIBRARY "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX") ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" ) # Clear the temp variable so nobody can see it SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework") FIND_LIBRARY(ALUT_LIBRARY NAMES alut PATHS $ENV{OPENALDIR}/lib $ENV{OPENALDIR}/libs /usr/local/lib /usr/lib /sw/lib /opt/local/lib /opt/csw/lib /opt/lib ) ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework") SET(ALUT_FOUND "NO") IF(ALUT_LIBRARY) SET(ALUT_FOUND "YES") ENDIF(ALUT_LIBRARY) indi-beefocus-0.1+20220128183230/cmake_modules/FindD2XX.cmake0000644000175100017510000000262014174600255022037 0ustar debiandebian# - Try to find D2XX # Once done this will define # # D2XX_FOUND - system has FTDI # D2XX_INCLUDE_DIR - the FTDI include directory # D2XX_LIBRARIES - Link these to use FTDI # # N.B. You must include the file as following: # #include # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) # in cache already set(D2XX_FOUND TRUE) message(STATUS "Found libfd2xx: ${D2XX_LIBRARIES}") else (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) find_path(D2XX_INCLUDE_DIR ftd2xx.h #PATH_SUFFIXES libD2XX ${_obIncDir} ${GNUWIN32_DIR}/include /usr/local/include ) find_library(D2XX_LIBRARIES NAMES ftd2xx PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) set(D2XX_FOUND TRUE) else (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) set(D2XX_FOUND FALSE) endif(D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) if (D2XX_FOUND) if (NOT D2XX_FIND_QUIETLY) message(STATUS "Found D2XX: ${D2XX_LIBRARIES}") endif (NOT D2XX_FIND_QUIETLY) else (D2XX_FOUND) if (D2XX_FIND_REQUIRED) message(FATAL_ERROR "D2XX not found. Please install libd2xx") endif (D2XX_FIND_REQUIRED) endif (D2XX_FOUND) mark_as_advanced(D2XX_INCLUDE_DIR D2XX_LIBRARIES) endif (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindARAVIS.cmake0000644000175100017510000000272314174600255022303 0ustar debiandebian# - Find the native sqlite3 includes and library # # This module defines # ARV_INCLUDE_DIR, where to find libgphoto2 header files # ARV_LIBRARIES, the libraries to link against to use libgphoto2 # ARV_FOUND, If false, do not try to use libgphoto2. # ARV_VERSION_STRING, e.g. 2.4.14 # ARV_VERSION_MAJOR, e.g. 2 # ARV_VERSION_MINOR, e.g. 4 # ARV_VERSION_PATCH, e.g. 14 # # also defined, but not for general use are # ARV_LIBRARY, where to find the sqlite3 library. #============================================================================= # Copyright 2010 henrik andersson #============================================================================= SET(ARV_FIND_REQUIRED ${Arv_FIND_REQUIRED}) find_path(ARV_INCLUDE_DIR aravis-0.8/arv.h) mark_as_advanced(ARV_INCLUDE_DIR) set(ARV_NAMES ${ARV_NAMES} aravis-0.8) find_library(ARV_LIBRARY NAMES ${ARV_NAMES} ) mark_as_advanced(ARV_LIBRARY) set(ARV_VERSION_MAJOR "0") set(ARV_VERSION_MINOR "8") set(ARV_VERSION_STRING "${ARV_VERSION_MAJOR}.${ARV_VERSION_MINOR}") # handle the QUIETLY and REQUIRED arguments and set ARV_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ARV DEFAULT_MSG ARV_LIBRARY ARV_INCLUDE_DIR) IF(ARV_FOUND) #SET(Arv_LIBRARIES ${ARV_LIBRARY}) SET(Arv_LIBRARIES "aravis-0.8") SET(Arv_INCLUDE_DIRS "${ARV_INCLUDE_DIR}/aravis-0.8") MESSAGE (STATUS "Found aravis: ${Arv_LIBRARIES} ${Arv_INCLUDE_DIRS}") ENDIF(ARV_FOUND) indi-beefocus-0.1+20220128183230/cmake_modules/FindFISHCAMP.cmake0000644000175100017510000000322514174600255022506 0ustar debiandebian# - Try to find FISHCAMP CCD # Once done this will define # # FISHCAMP_FOUND - system has FISHCAMP # FISHCAMP_LIBRARIES - Link these to use FISHCAMP # FISHCAMP_INCLUDE_DIR - Fishcamp include directory # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) # in cache already set(FISHCAMP_FOUND TRUE) message(STATUS "Found FISHCAMP: ${FISHCAMP_LIBRARIES}") else (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) find_library(FISHCAMP_LIBRARIES NAMES fishcamp PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_path(FISHCAMP_INCLUDE_DIR fishcamp.h PATH_SUFFIXES libfishcamp ${_obIncDir} ${GNUWIN32_DIR}/include ) set(CMAKE_REQUIRED_LIBRARIES ${FISHCAMP_LIBRARIES}) if(FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) set(FISHCAMP_FOUND TRUE) else (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) set(FISHCAMP_FOUND FALSE) endif(FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) if (FISHCAMP_FOUND) if (NOT FISHCAMP_FIND_QUIETLY) message(STATUS "Found FISHCAMP: ${FISHCAMP_LIBRARIES}") endif (NOT FISHCAMP_FIND_QUIETLY) else (FISHCAMP_FOUND) if (FISHCAMP_FIND_REQUIRED) message(FATAL_ERROR "FISHCAMP not found. Please install FISHCAMP library. http://www.indilib.org") endif (FISHCAMP_FIND_REQUIRED) endif (FISHCAMP_FOUND) mark_as_advanced(FISHCAMP_LIBRARIES FISHCAMP_INCLUDE_DIR) endif (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) indi-beefocus-0.1+20220128183230/cmake_modules/FindDC1394.cmake0000644000175100017510000000264314174600255022126 0ustar debiandebian# - Try to find dc1394 library (version 2) and include files # Once done this will define # # DC1394_FOUND - system has DC1394 # DC1394_INCLUDE_DIR - the DC1394 include directory # DC1394_LIBRARIES - Link these to use DC1394 # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) # in cache already set(DC1394_FOUND TRUE) message(STATUS "Found libdc1394: ${DC1394_LIBRARIES}") else (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) find_path(DC1394_INCLUDE_DIR control.h PATH_SUFFIXES dc1394 ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(DC1394_LIBRARIES NAMES dc1394 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) set(DC1394_FOUND TRUE) else (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) set(DC1394_FOUND FALSE) endif(DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) if (DC1394_FOUND) if (NOT DC1394_FIND_QUIETLY) message(STATUS "Found DC1394: ${DC1394_LIBRARIES}") endif (NOT DC1394_FIND_QUIETLY) else (DC1394_FOUND) if (DC1394_FIND_REQUIRED) message(FATAL_ERROR "DC1394 not found. Please install libdc1394 development package.") endif (DC1394_FIND_REQUIRED) endif (DC1394_FOUND) mark_as_advanced(DC1394_INCLUDE_DIR DC1394_LIBRARIES) endif (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindTIFFXX.cmake0000644000175100017510000000176314174600255022331 0ustar debiandebian# - Try to find TIFFXX Library # Once done this will define # # TIFXX_LIBRARY - Link these to use TIFFXX # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (TIFFXX_LIBRARY) # in cache already set(TIFFXX_FOUND TRUE) message(STATUS "Found libtiffxx: ${TIFFXX_LIBRARY}") else (TIFFXX_LIBRARY) find_library(TIFFXX_LIBRARY NAMES tiffxx PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(TIFFXX_LIBRARY) set(TIFFXX_FOUND TRUE) else (TIFFXX_LIBRARY) set(TIFFXX_FOUND FALSE) endif(TIFFXX_LIBRARY) if (TIFFXX_FOUND) if (NOT TIFFXX_FIND_QUIETLY) message(STATUS "Found tiffxx: ${TIFFXX_LIBRARY}") endif (NOT TIFFXX_FIND_QUIETLY) else (TIFFXX_FOUND) if (TIFFXX_FIND_REQUIRED) message(FATAL_ERROR "tiffxx is not found. Please install it first.") endif (TIFFXX_FIND_REQUIRED) endif (TIFFXX_FOUND) mark_as_advanced(TIFFXX_LIBRARY) endif (TIFFXX_LIBRARY) indi-beefocus-0.1+20220128183230/cmake_modules/FindGSL.cmake0000644000175100017510000002224114174600255021740 0ustar debiandebian#.rst: # FindGSL # -------- # # Find the native GSL includes and libraries. # # The GNU Scientific Library (GSL) is a numerical library for C and C++ # programmers. It is free software under the GNU General Public # License. # # Imported Targets # ^^^^^^^^^^^^^^^^ # # If GSL is found, this module defines the following :prop_tgt:`IMPORTED` # targets:: # # GSL::gsl - The main GSL library. # GSL::gslcblas - The CBLAS support library used by GSL. # # Result Variables # ^^^^^^^^^^^^^^^^ # # This module will set the following variables in your project:: # # GSL_FOUND - True if GSL found on the local system # GSL_INCLUDE_DIRS - Location of GSL header files. # GSL_LIBRARIES - The GSL libraries. # GSL_VERSION - The version of the discovered GSL install. # # Hints # ^^^^^ # # Set ``GSL_ROOT_DIR`` to a directory that contains a GSL installation. # # This script expects to find libraries at ``$GSL_ROOT_DIR/lib`` and the GSL # headers at ``$GSL_ROOT_DIR/include/gsl``. The library directory may # optionally provide Release and Debug folders. For Unix-like systems, this # script will use ``$GSL_ROOT_DIR/bin/gsl-config`` (if found) to aid in the # discovery GSL. # # Cache Variables # ^^^^^^^^^^^^^^^ # # This module may set the following variables depending on platform and type # of GSL installation discovered. These variables may optionally be set to # help this module find the correct files:: # # GSL_CLBAS_LIBRARY - Location of the GSL CBLAS library. # GSL_CBLAS_LIBRARY_DEBUG - Location of the debug GSL CBLAS library (if any). # GSL_CONFIG_EXECUTABLE - Location of the ``gsl-config`` script (if any). # GSL_LIBRARY - Location of the GSL library. # GSL_LIBRARY_DEBUG - Location of the debug GSL library (if any). # #============================================================================= # Copyright 2014 Kelly Thompson # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Include these modules to handle the QUIETLY and REQUIRED arguments. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) #============================================================================= # If the user has provided ``GSL_ROOT_DIR``, use it! Choose items found # at this location over system locations. if( EXISTS "$ENV{GSL_ROOT_DIR}" ) file( TO_CMAKE_PATH "$ENV{GSL_ROOT_DIR}" GSL_ROOT_DIR ) set( GSL_ROOT_DIR "${GSL_ROOT_DIR}" CACHE PATH "Prefix for GSL installation." ) endif() if( NOT EXISTS "${GSL_ROOT_DIR}" ) set( GSL_USE_PKGCONFIG ON ) endif() #============================================================================= # As a first try, use the PkgConfig module. This will work on many # *NIX systems. See :module:`findpkgconfig` # This will return ``GSL_INCLUDEDIR`` and ``GSL_LIBDIR`` used below. if( GSL_USE_PKGCONFIG ) find_package(PkgConfig) pkg_check_modules( GSL QUIET gsl ) if( EXISTS "${GSL_INCLUDEDIR}" ) get_filename_component( GSL_ROOT_DIR "${GSL_INCLUDEDIR}" DIRECTORY CACHE) endif() endif() #============================================================================= # Set GSL_INCLUDE_DIRS and GSL_LIBRARIES. If we skipped the PkgConfig step, try # to find the libraries at $GSL_ROOT_DIR (if provided) or in standard system # locations. These find_library and find_path calls will prefer custom # locations over standard locations (HINTS). If the requested file is not found # at the HINTS location, standard system locations will be still be searched # (/usr/lib64 (Redhat), lib/i386-linux-gnu (Debian)). find_path( GSL_INCLUDE_DIR NAMES gsl/gsl_sf.h HINTS ${GSL_ROOT_DIR}/include ${GSL_INCLUDEDIR} ) find_library( GSL_LIBRARY NAMES gsl HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR} PATH_SUFFIXES Release Debug ) find_library( GSL_CBLAS_LIBRARY NAMES gslcblas cblas HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR} PATH_SUFFIXES Release Debug ) # Do we also have debug versions? find_library( GSL_LIBRARY_DEBUG NAMES gsl HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR} PATH_SUFFIXES Debug ) find_library( GSL_CBLAS_LIBRARY_DEBUG NAMES gslcblas cblas HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR} PATH_SUFFIXES Debug ) set( GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} ) set( GSL_LIBRARIES ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} ) # If we didn't use PkgConfig, try to find the version via gsl-config or by # reading gsl_version.h. if( NOT GSL_VERSION ) # 1. If gsl-config exists, query for the version. find_program( GSL_CONFIG_EXECUTABLE NAMES gsl-config HINTS "${GSL_ROOT_DIR}/bin" ) if( EXISTS "${GSL_CONFIG_EXECUTABLE}" ) execute_process( COMMAND "${GSL_CONFIG_EXECUTABLE}" --version OUTPUT_VARIABLE GSL_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() # 2. If gsl-config is not available, try looking in gsl/gsl_version.h if( NOT GSL_VERSION AND EXISTS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" ) file( STRINGS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" gsl_version_h_contents REGEX "define GSL_VERSION" ) string( REGEX REPLACE ".*([0-9].[0-9][0-9]).*" "\\1" GSL_VERSION ${gsl_version_h_contents} ) endif() # might also try scraping the directory name for a regex match "gsl-X.X" endif() #============================================================================= # handle the QUIETLY and REQUIRED arguments and set GSL_FOUND to TRUE if all # listed variables are TRUE find_package_handle_standard_args( GSL FOUND_VAR GSL_FOUND REQUIRED_VARS GSL_INCLUDE_DIR GSL_LIBRARY GSL_CBLAS_LIBRARY VERSION_VAR GSL_VERSION ) mark_as_advanced( GSL_ROOT_DIR GSL_VERSION GSL_LIBRARY GSL_INCLUDE_DIR GSL_CBLAS_LIBRARY GSL_LIBRARY_DEBUG GSL_CBLAS_LIBRARY_DEBUG GSL_USE_PKGCONFIG GSL_CONFIG ) #============================================================================= # Register imported libraries: # 1. If we can find a Windows .dll file (or if we can find both Debug and # Release libraries), we will set appropriate target properties for these. # 2. However, for most systems, we will only register the import location and # include directory. # Look for dlls, or Release and Debug libraries. if(WIN32) string( REPLACE ".lib" ".dll" GSL_LIBRARY_DLL "${GSL_LIBRARY}" ) string( REPLACE ".lib" ".dll" GSL_CBLAS_LIBRARY_DLL "${GSL_CBLAS_LIBRARY}" ) string( REPLACE ".lib" ".dll" GSL_LIBRARY_DEBUG_DLL "${GSL_LIBRARY_DEBUG}" ) string( REPLACE ".lib" ".dll" GSL_CBLAS_LIBRARY_DEBUG_DLL "${GSL_CBLAS_LIBRARY_DEBUG}" ) endif() if( GSL_FOUND AND NOT TARGET GSL::gsl ) if( EXISTS "${GSL_LIBRARY_DLL}" AND EXISTS "${GSL_CBLAS_LIBRARY_DLL}") # Windows systems with dll libraries. add_library( GSL::gsl SHARED IMPORTED ) add_library( GSL::gslcblas SHARED IMPORTED ) # Windows with dlls, but only Release libraries. set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_RELEASE "${GSL_CBLAS_LIBRARY_DLL}" IMPORTED_IMPLIB "${GSL_CBLAS_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}" IMPORTED_CONFIGURATIONS Release IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION_RELEASE "${GSL_LIBRARY_DLL}" IMPORTED_IMPLIB "${GSL_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}" IMPORTED_CONFIGURATIONS Release IMPORTED_LINK_INTERFACE_LANGUAGES "C" INTERFACE_LINK_LIBRARIES GSL::gslcblas ) # If we have both Debug and Release libraries if( EXISTS "${GSL_LIBRARY_DEBUG_DLL}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG_DLL}") set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG_DLL}" IMPORTED_IMPLIB_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" ) set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG_DLL}" IMPORTED_IMPLIB_DEBUG "${GSL_LIBRARY_DEBUG}" ) endif() else() # For all other environments (ones without dll libraries), create # the imported library targets. add_library( GSL::gsl UNKNOWN IMPORTED ) add_library( GSL::gslcblas UNKNOWN IMPORTED ) set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION "${GSL_CBLAS_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION "${GSL_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" INTERFACE_LINK_LIBRARIES GSL::gslcblas ) endif() endif() indi-beefocus-0.1+20220128183230/cmake_modules/FindMICAM.cmake0000644000175100017510000000256714174600255022152 0ustar debiandebian# - Try to find Moravian Instruments Camera Library # Once done this will define # # MICAM_FOUND - system has MI # MICAM_INCLUDE_DIR - the MI include directory # MICAM_LIBRARIES - Link these to use MI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) # in cache already set(MICAM_FOUND TRUE) message(STATUS "Found libmicam: ${MICAM_LIBRARIES}") else (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) find_path(MICAM_INCLUDE_DIR gxccd.h PATH_SUFFIXES libmicam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(MICAM_LIBRARIES NAMES gxccd PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) set(MICAM_FOUND TRUE) else (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) set(MICAM_FOUND FALSE) endif(MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) if (MICAM_FOUND) if (NOT MICAM_FIND_QUIETLY) message(STATUS "Found MI Library: ${MICAM_LIBRARIES}") endif (NOT MICAM_FIND_QUIETLY) else (MICAM_FOUND) if (MICAM_FIND_REQUIRED) message(FATAL_ERROR "MI Library not found. Please install MI Library http://www.indilib.org") endif (MICAM_FIND_REQUIRED) endif (MICAM_FOUND) mark_as_advanced(MICAM_INCLUDE_DIR MICAM_LIBRARIES) endif (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindPackageHandleStandardArgs.cmake0000644000175100017510000003565714174600255026277 0ustar debiandebian#[=======================================================================[.rst: FindPackageHandleStandardArgs ----------------------------- This module provides a function intended to be used in :ref:`Find Modules` implementing :command:`find_package()` calls. It handles the ``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. It also sets the ``_FOUND`` variable. The package is considered found if all variables listed contain valid results, e.g. valid filepaths. .. command:: find_package_handle_standard_args There are two signatures:: find_package_handle_standard_args( (DEFAULT_MSG|) ... ) find_package_handle_standard_args( [FOUND_VAR ] [REQUIRED_VARS ...] [VERSION_VAR ] [HANDLE_COMPONENTS] [CONFIG_MODE] [FAIL_MESSAGE ] ) The ``_FOUND`` variable will be set to ``TRUE`` if all the variables ``...`` are valid and any optional constraints are satisfied, and ``FALSE`` otherwise. A success or failure message may be displayed based on the results and on whether the ``REQUIRED`` and/or ``QUIET`` option was given to the :command:`find_package` call. The options are: ``(DEFAULT_MSG|)`` In the simple signature this specifies the failure message. Use ``DEFAULT_MSG`` to ask for a default message to be computed (recommended). Not valid in the full signature. ``FOUND_VAR `` Obsolete. Specifies either ``_FOUND`` or ``_FOUND`` as the result variable. This exists only for compatibility with older versions of CMake and is now ignored. Result variables of both names are always set for compatibility. ``REQUIRED_VARS ...`` Specify the variables which are required for this package. These may be named in the generated failure message asking the user to set the missing variable values. Therefore these should typically be cache entries such as ``FOO_LIBRARY`` and not output variables like ``FOO_LIBRARIES``. ``VERSION_VAR `` Specify the name of a variable that holds the version of the package that has been found. This version will be checked against the (potentially) specified required version given to the :command:`find_package` call, including its ``EXACT`` option. The default messages include information about the required version and the version which has been actually found, both if the version is ok or not. ``HANDLE_COMPONENTS`` Enable handling of package components. In this case, the command will report which components have been found and which are missing, and the ``_FOUND`` variable will be set to ``FALSE`` if any of the required components (i.e. not the ones listed after the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are missing. ``CONFIG_MODE`` Specify that the calling find module is a wrapper around a call to ``find_package( NO_MODULE)``. This implies a ``VERSION_VAR`` value of ``_VERSION``. The command will automatically check whether the package configuration file was found. ``FAIL_MESSAGE `` Specify a custom failure message instead of using the default generated message. Not recommended. Example for the simple signature: .. code-block:: cmake find_package_handle_standard_args(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) The ``LibXml2`` package is considered to be found if both ``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found and ``REQUIRED`` was used, it fails with a :command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was used or not. If it is found, success will be reported, including the content of the first ````. On repeated CMake runs, the same message will not be printed again. Example for the full signature: .. code-block:: cmake find_package_handle_standard_args(LibArchive REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR VERSION_VAR LibArchive_VERSION) In this case, the ``LibArchive`` package is considered to be found if both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. Also the version of ``LibArchive`` will be checked by using the version contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, the default messages will be printed. Another example for the full signature: .. code-block:: cmake find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) find_package_handle_standard_args(Automoc4 CONFIG_MODE) In this case, a ``FindAutmoc4.cmake`` module wraps a call to ``find_package(Automoc4 NO_MODULE)`` and adds an additional search directory for ``automoc4``. Then the call to ``find_package_handle_standard_args`` produces a proper success/failure message. #]=======================================================================] #============================================================================= # Copyright 2007-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) # internal helper macro macro(_FPHSA_FAILURE_MESSAGE _msg) if (${_NAME}_FIND_REQUIRED) message(FATAL_ERROR "${_msg}") else () if (NOT ${_NAME}_FIND_QUIETLY) message(STATUS "${_msg}") endif () endif () endmacro() # internal helper macro to generate the failure message when used in CONFIG_MODE: macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: if(${_NAME}_CONFIG) _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") else() # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. # List them all in the error message: if(${_NAME}_CONSIDERED_CONFIGS) set(configsText "") list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) math(EXPR configsCount "${configsCount} - 1") foreach(currentConfigIndex RANGE ${configsCount}) list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) set(configsText "${configsText} ${filename} (version ${version})\n") endforeach() if (${_NAME}_NOT_FOUND_MESSAGE) set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") endif() _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") else() # Simple case: No Config-file was found at all: _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") endif() endif() endmacro() function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) # set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in # new extended or in the "old" mode: set(options CONFIG_MODE HANDLE_COMPONENTS) set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) set(multiValueArgs REQUIRED_VARS) set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) if(${INDEX} EQUAL -1) set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) set(FPHSA_REQUIRED_VARS ${ARGN}) set(FPHSA_VERSION_VAR) else() CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) if(FPHSA_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") endif() if(NOT FPHSA_FAIL_MESSAGE) set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") endif() endif() # now that we collected all arguments, process them if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") endif() # In config-mode, we rely on the variable _CONFIG, which is set by find_package() # when it successfully found the config-file, including version checking: if(FPHSA_CONFIG_MODE) list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) set(FPHSA_VERSION_VAR ${_NAME}_VERSION) endif() if(NOT FPHSA_REQUIRED_VARS) message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") endif() list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) string(TOUPPER ${_NAME} _NAME_UPPER) string(TOLOWER ${_NAME} _NAME_LOWER) if(FPHSA_FOUND_VAR) if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") set(_FOUND_VAR ${FPHSA_FOUND_VAR}) else() message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") endif() else() set(_FOUND_VAR ${_NAME_UPPER}_FOUND) endif() # collect all variables which were not found, so they can be printed, so the # user knows better what went wrong (#6375) set(MISSING_VARS "") set(DETAILS "") # check if all passed variables are valid set(FPHSA_FOUND_${_NAME} TRUE) foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) if(NOT ${_CURRENT_VAR}) set(FPHSA_FOUND_${_NAME} FALSE) set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") else() set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") endif() endforeach() if(FPHSA_FOUND_${_NAME}) set(${_NAME}_FOUND TRUE) set(${_NAME_UPPER}_FOUND TRUE) else() set(${_NAME}_FOUND FALSE) set(${_NAME_UPPER}_FOUND FALSE) endif() # component handling unset(FOUND_COMPONENTS_MSG) unset(MISSING_COMPONENTS_MSG) if(FPHSA_HANDLE_COMPONENTS) foreach(comp ${${_NAME}_FIND_COMPONENTS}) if(${_NAME}_${comp}_FOUND) if(NOT DEFINED FOUND_COMPONENTS_MSG) set(FOUND_COMPONENTS_MSG "found components: ") endif() set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}") else() if(NOT DEFINED MISSING_COMPONENTS_MSG) set(MISSING_COMPONENTS_MSG "missing components: ") endif() set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") if(${_NAME}_FIND_REQUIRED_${comp}) set(${_NAME}_FOUND FALSE) set(MISSING_VARS "${MISSING_VARS} ${comp}") endif() endif() endforeach() set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]") endif() # version handling: set(VERSION_MSG "") set(VERSION_OK TRUE) set(VERSION ${${FPHSA_VERSION_VAR}}) # check with DEFINED here as the requested or found version may be "0" if (DEFINED ${_NAME}_FIND_VERSION) if(DEFINED ${FPHSA_VERSION_VAR}) if(${_NAME}_FIND_VERSION_EXACT) # exact version required # count the dots in the version string string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${VERSION}") # add one dot because there is one dot more than there are components string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT # is at most 4 here. Therefore a simple lookup table is used. if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) set(_VERSION_REGEX "[^.]*") elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) set(_VERSION_REGEX "[^.]*\\.[^.]*") elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") else () set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") endif () string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${VERSION}") unset(_VERSION_REGEX) if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") set(VERSION_OK FALSE) else () set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") endif () unset(_VERSION_HEAD) else () if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL VERSION) set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") set(VERSION_OK FALSE) else () set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") endif () endif () unset(_VERSION_DOTS) else() # minimum version specified: if (${_NAME}_FIND_VERSION VERSION_GREATER VERSION) set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") set(VERSION_OK FALSE) else () set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") endif () endif() else() # if the package was not found, but a version was given, add that to the output: if(${_NAME}_FIND_VERSION_EXACT) set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") else() set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") endif() endif() else () if(VERSION) set(VERSION_MSG "(found version \"${VERSION}\")") endif() endif () if(VERSION_OK) set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") else() set(${_NAME}_FOUND FALSE) endif() # print the result: if (${_NAME}_FOUND) FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") else () if(FPHSA_CONFIG_MODE) _FPHSA_HANDLE_FAILURE_CONFIG_MODE() else() if(NOT VERSION_OK) _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") else() _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") endif() endif() endif () set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) endfunction() indi-beefocus-0.1+20220128183230/cmake_modules/FindOggTheora.cmake0000644000175100017510000000247214174600255023176 0ustar debiandebian# # Find the native Ogg/Theora includes and libraries # # This module defines # OGGTHEORA_INCLUDE_DIR, where to find ogg/ogg.h and theora/theora.h # OGGTHEORA_LIBRARIES, the libraries to link against to use Ogg/Theora. # OGGTHEORA_FOUND, If false, do not try to use Ogg/Theora. FIND_PATH(OGGTHEORA_ogg_INCLUDE_DIR ogg/ogg.h) FIND_PATH(OGGTHEORA_theora_INCLUDE_DIR theora/theora.h) FIND_LIBRARY(OGGTHEORA_ogg_LIBRARY ogg) FIND_LIBRARY(OGGTHEORA_theoraenc_LIBRARY theoraenc) FIND_LIBRARY(OGGTHEORA_theoradec_LIBRARY theoradec) SET(OGGTHEORA_INCLUDE_DIRS ${OGGTHEORA_ogg_INCLUDE_DIR} ${OGGTHEORA_theora_INCLUDE_DIR} ) #HACK multiple directories SET(OGGTHEORA_INCLUDE_DIR ${OGGTHEORA_INCLUDE_DIRS}) SET(OGGTHEORA_LIBRARIES ${OGGTHEORA_theoraenc_LIBRARY} ${OGGTHEORA_theoradec_LIBRARY} ${OGGTHEORA_ogg_LIBRARY} ) #HACK multiple libraries SET(OGGTHEORA_LIBRARY ${OGGTHEORA_LIBRARIES}) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGGTHEORA "Could NOT find the ogg and theora libraries" OGGTHEORA_ogg_LIBRARY OGGTHEORA_theoraenc_LIBRARY OGGTHEORA_theoradec_LIBRARY OGGTHEORA_ogg_INCLUDE_DIR OGGTHEORA_theora_INCLUDE_DIR ) MARK_AS_ADVANCED(OGGTHEORA_ogg_INCLUDE_DIR OGGTHEORA_theora_INCLUDE_DIR OGGTHEORA_ogg_LIBRARY OGGTHEORA_theoraenc_LIBRARY OGGTHEORA_theoradec_LIBRARY ) indi-beefocus-0.1+20220128183230/cmake_modules/FindMEADE.cmake0000644000175100017510000000247714174600255022137 0ustar debiandebian# - Try to find Meade DSI Library. # Once done this will define # # MEADEDSI_FOUND - system has Meade DSI # MEADEDSI_LIBRARIES - Link these to use Meade DSI # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (MEADEDSI_LIBRARIES) # in cache already set(MEADEDSI_FOUND TRUE) message(STATUS "Found MEADEDSI: ${MEADEDSI_LIBRARIES}") else (MEADEDSI_LIBRARIES) find_library(MEADEDSI_LIBRARIES NAMES dsi PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) set(CMAKE_REQUIRED_LIBRARIES ${MEADEDSI_LIBRARIES}) if(MEADEDSI_LIBRARIES) set(MEADEDSI_FOUND TRUE) else (MEADEDSI_LIBRARIES) set(MEADEDSI_FOUND FALSE) endif(MEADEDSI_LIBRARIES) if (MEADEDSI_FOUND) if (NOT MEADEDSI_FIND_QUIETLY) message(STATUS "Found Meade DSI: ${MEADEDSI_LIBRARIES}") endif (NOT MEADEDSI_FIND_QUIETLY) else (MEADEDSI_FOUND) if (MEADEDSI_FIND_REQUIRED) message(FATAL_ERROR "Meade DSI not found. Please install Meade DSI library. http://linuxdsi.sourceforge.net") endif (MEADEDSI_FIND_REQUIRED) endif (MEADEDSI_FOUND) mark_as_advanced(MEADEDSI_LIBRARIES) endif (MEADEDSI_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindTOUPCAM.cmake0000644000175100017510000000267614174600255022435 0ustar debiandebian# - Try to find Toupcam Camera Library # Once done this will define # # TOUPCAM_FOUND - system has Toupcam # TOUPCAM_INCLUDE_DIR - the Toupcam include directory # TOUPCAM_LIBRARIES - Link these to use Toupcam # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) # in cache already set(TOUPCAM_FOUND TRUE) message(STATUS "Found libsbig: ${TOUPCAM_LIBRARIES}") else (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) find_path(TOUPCAM_INCLUDE_DIR toupcam.h PATH_SUFFIXES libtoupcam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(TOUPCAM_LIBRARIES NAMES toupcam PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) set(TOUPCAM_FOUND TRUE) else (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) set(TOUPCAM_FOUND FALSE) endif(TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) if (TOUPCAM_FOUND) if (NOT TOUPCAM_FIND_QUIETLY) message(STATUS "Found Toupcam: ${TOUPCAM_LIBRARIES}") endif (NOT TOUPCAM_FIND_QUIETLY) else (TOUPCAM_FOUND) if (TOUPCAM_FIND_REQUIRED) message(FATAL_ERROR "Toupcam not found. Please install Toupcam Library http://www.indilib.org") endif (TOUPCAM_FIND_REQUIRED) endif (TOUPCAM_FOUND) mark_as_advanced(TOUPCAM_INCLUDE_DIR TOUPCAM_LIBRARIES) endif (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindSV305.cmake0000644000175100017510000000264614174600255022102 0ustar debiandebian# - Try to find SV305 Library # Once done this will define # # SV305_FOUND - system has QHY # SV305_INCLUDE_DIR - the QHY include directory # SV305_LIBRARIES - Link these to use QHY # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (SV305_INCLUDE_DIR AND SV305_LIBRARIES) # in cache already set(SV305_FOUND TRUE) message(STATUS "Found libsv305: ${SV305_LIBRARIES}") else (SV305_INCLUDE_DIR AND SV305_LIBRARIES) # find headers find_path(SV305_INCLUDE_DIR NAMES SVBCameraSDK.h PATH_SUFFIXES libsv305 ${_obIncDir} ${GNUWIN32_DIR}/include ) # find libraries find_library(SV305_LIBRARIES NAMES SVBCameraSDK PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(SV305_INCLUDE_DIR AND SV305_LIBRARIES) set(SV305_FOUND TRUE) else (SV305_INCLUDE_DIR AND SV305_LIBRARIES) set(SV305_FOUND FALSE) endif(SV305_INCLUDE_DIR AND SV305_LIBRARIES) if (SV305_FOUND) if (NOT SV305_FIND_QUIETLY) message(STATUS "Found SV305 libraries : ${SV305_LIBRARIES}") endif (NOT SV305_FIND_QUIETLY) else (SV305_FOUND) if (SV305_FIND_REQUIRED) message(FATAL_ERROR "SV305 libraries not found. Please install libsv305 http://www.indilib.org") endif (SV305_FIND_REQUIRED) endif (SV305_FOUND) mark_as_advanced(SV305_INCLUDE_DIR SV305_LIBRARIES) endif (SV305_INCLUDE_DIR AND SV305_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindQSI.cmake0000644000175100017510000000245514174600255021754 0ustar debiandebian# - Try to find Quantum Scientific Imaging Library # Once done this will define # # QSI_FOUND - system has QSI # QSI_INCLUDE_DIR - the QSI include directory # QSI_LIBRARIES - Link these to use QSI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (QSI_INCLUDE_DIR AND QSI_LIBRARIES) # in cache already set(QSI_FOUND TRUE) message(STATUS "Found libqsiapi: ${QSI_LIBRARIES}") else (QSI_INCLUDE_DIR AND QSI_LIBRARIES) find_path(QSI_INCLUDE_DIR qsiapi.h PATH_SUFFIXES qsiapi ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(QSI_LIBRARIES NAMES qsiapi PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(QSI_INCLUDE_DIR AND QSI_LIBRARIES) set(QSI_FOUND TRUE) else (QSI_INCLUDE_DIR AND QSI_LIBRARIES) set(QSI_FOUND FALSE) endif(QSI_INCLUDE_DIR AND QSI_LIBRARIES) if (QSI_FOUND) if (NOT QSI_FIND_QUIETLY) message(STATUS "Found QSI: ${QSI_LIBRARIES}") endif (NOT QSI_FIND_QUIETLY) else (QSI_FOUND) if (QSI_FIND_REQUIRED) message(FATAL_ERROR "QSI not found. Please install libqsi http://www.indilib.org") endif (QSI_FIND_REQUIRED) endif (QSI_FOUND) mark_as_advanced(QSI_INCLUDE_DIR QSI_LIBRARIES) endif (QSI_INCLUDE_DIR AND QSI_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/UnityBuild.cmake0000644000175100017510000001627714174600255022616 0ustar debiandebian# # Copyright (c) 2009-2012 Christoph Heindl # Copyright (c) 2015 Csaba Kertész (csaba.kertesz@gmail.com) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * 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. # * Neither the name of the 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 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. # MACRO (COMMIT_UNITY_FILE UNITY_FILE FILE_CONTENT) SET(DIRTY FALSE) # Check if the build file exists SET(OLD_FILE_CONTENT "") IF (NOT EXISTS ${${UNITY_FILE}} AND NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${${UNITY_FILE}}) SET(DIRTY TRUE) ELSE () # Check the file content FILE(STRINGS ${${UNITY_FILE}} OLD_FILE_CONTENT) STRING(REPLACE ";" "" OLD_FILE_CONTENT "${OLD_FILE_CONTENT}") STRING(REPLACE "\n" "" NEW_CONTENT "${${FILE_CONTENT}}") STRING(COMPARE EQUAL "${OLD_FILE_CONTENT}" "${NEW_CONTENT}" EQUAL_CHECK) IF (NOT EQUAL_CHECK EQUAL 1) SET(DIRTY TRUE) ENDIF () ENDIF () IF (DIRTY MATCHES TRUE) MESSAGE(STATUS "Write Unity Build file: " ${${UNITY_FILE}}) FILE(WRITE ${${UNITY_FILE}} "${${FILE_CONTENT}}") ENDIF () # Create a dummy copy of the unity file to trigger CMake reconfigure if it is deleted. SET(UNITY_FILE_PATH "") SET(UNITY_FILE_NAME "") GET_FILENAME_COMPONENT(UNITY_FILE_PATH ${${UNITY_FILE}} PATH) GET_FILENAME_COMPONENT(UNITY_FILE_NAME ${${UNITY_FILE}} NAME) CONFIGURE_FILE(${${UNITY_FILE}} ${UNITY_FILE_PATH}/CMakeFiles/${UNITY_FILE_NAME}.dummy) ENDMACRO () MACRO (ENABLE_UNITY_BUILD TARGET_NAME SOURCE_VARIABLE_NAME UNIT_SIZE EXTENSION) # Limit is zero based conversion of unit_size MATH(EXPR LIMIT ${UNIT_SIZE}-1) SET(FILES ${SOURCE_VARIABLE_NAME}) # Effectivly ignore the source files from the build, but keep track them for changes. SET_SOURCE_FILES_PROPERTIES(${${FILES}} PROPERTIES HEADER_FILE_ONLY true) # Counts the number of source files up to the threshold SET(COUNTER ${LIMIT}) # Have one or more unity build files SET(FILE_NUMBER 0) SET(BUILD_FILE "") SET(BUILD_FILE_CONTENT "") SET(UNITY_BUILD_FILES "") SET(_DEPS "") FOREACH (SOURCE_FILE ${${FILES}}) IF (COUNTER EQUAL LIMIT) SET(_DEPS "") # Write the actual Unity Build file IF (NOT ${BUILD_FILE} STREQUAL "" AND NOT ${BUILD_FILE_CONTENT} STREQUAL "") COMMIT_UNITY_FILE(BUILD_FILE BUILD_FILE_CONTENT) ENDIF () SET(UNITY_BUILD_FILES ${UNITY_BUILD_FILES} ${BUILD_FILE}) # Set the variables for the current Unity Build file SET(BUILD_FILE ${CMAKE_CURRENT_BINARY_DIR}/unitybuild_${FILE_NUMBER}_${TARGET_NAME}.${EXTENSION}) SET(BUILD_FILE_CONTENT "// Unity Build file generated by CMake\n") MATH(EXPR FILE_NUMBER ${FILE_NUMBER}+1) SET(COUNTER 0) ENDIF () # Add source path to the file name if it is not there yet. SET(FINAL_SOURCE_FILE "") SET(SOURCE_PATH "") GET_FILENAME_COMPONENT(SOURCE_PATH ${SOURCE_FILE} PATH) IF (SOURCE_PATH STREQUAL "" OR NOT EXISTS ${SOURCE_FILE}) SET(FINAL_SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) ELSE () SET(FINAL_SOURCE_FILE ${SOURCE_FILE}) ENDIF () # Treat only the existing files or moc_*.cpp files STRING(FIND ${SOURCE_FILE} "moc_" MOC_POS) IF (EXISTS ${FINAL_SOURCE_FILE} OR MOC_POS GREATER -1) # Add md5 hash of the source file (except moc files) to the build file content IF (MOC_POS LESS 0) SET(MD5_HASH "") FILE(MD5 ${FINAL_SOURCE_FILE} MD5_HASH) SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}// md5: ${MD5_HASH}\n") ENDIF () # Add the source file to the build file content IF (MOC_POS GREATER -1) SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}#include <${SOURCE_FILE}>\n") ELSE () SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}#include <${FINAL_SOURCE_FILE}>\n") ENDIF () # Add the source dependencies to the Unity Build file GET_SOURCE_FILE_PROPERTY(_FILE_DEPS ${SOURCE_FILE} OBJECT_DEPENDS) IF (_FILE_DEPS) SET(_DEPS ${_DEPS} ${_FILE_DEPS}) SET_SOURCE_FILES_PROPERTIES(${BUILD_FILE} PROPERTIES OBJECT_DEPENDS "${_DEPS}") ENDIF() # Keep counting up to the threshold. Increment counter. MATH(EXPR COUNTER ${COUNTER}+1) ENDIF () ENDFOREACH () # Write out the last Unity Build file IF (NOT ${BUILD_FILE} STREQUAL "" AND NOT ${BUILD_FILE_CONTENT} STREQUAL "") COMMIT_UNITY_FILE(BUILD_FILE BUILD_FILE_CONTENT) ENDIF () SET(UNITY_BUILD_FILES ${UNITY_BUILD_FILES} ${BUILD_FILE}) SET(${SOURCE_VARIABLE_NAME} ${${SOURCE_VARIABLE_NAME}} ${UNITY_BUILD_FILES}) ENDMACRO () MACRO (UNITY_GENERATE_MOC TARGET_NAME SOURCES HEADERS) SET(NEW_SOURCES "") FOREACH (HEADER_FILE ${${HEADERS}}) IF (NOT EXISTS ${HEADER_FILE}) MESSAGE(FATAL_ERROR "Header file does not exist (mocing): ${HEADER_FILE}") ENDIF () FILE(READ ${HEADER_FILE} FILE_CONTENT) STRING(FIND "${FILE_CONTENT}" "Q_OBJECT" QOBJECT_POS) STRING(FIND "${FILE_CONTENT}" "Q_SLOTS" QSLOTS_POS) STRING(FIND "${FILE_CONTENT}" "Q_SIGNALS" QSIGNALS_POS) STRING(FIND "${FILE_CONTENT}" "QObject" OBJECT_POS) STRING(FIND "${FILE_CONTENT}" "slots" SLOTS_POS) STRING(FIND "${FILE_CONTENT}" "signals" SIGNALS_POS) IF (QOBJECT_POS GREATER 0 OR OBJECT_POS GREATER 0 OR QSLOTS_POS GREATER 0 OR Q_SIGNALS GREATER 0 OR SLOTS_POS GREATER 0 OR SIGNALS GREATER 0) # Generate the moc filename GET_FILENAME_COMPONENT(HEADER_BASENAME ${HEADER_FILE} NAME_WE) SET(MOC_FILENAME "moc_${HEADER_BASENAME}.cpp") SET(NEW_SOURCES ${NEW_SOURCES} ; "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}") ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}" DEPENDS ${HEADER_FILE} COMMAND ${QT_MOC_EXECUTABLE} ${HEADER_FILE} -o "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}") ENDIF () ENDFOREACH () IF (NEW_SOURCES) SET_SOURCE_FILES_PROPERTIES(${NEW_SOURCES} PROPERTIES GENERATED TRUE) SET(${SOURCES} ${${SOURCES}} ; ${NEW_SOURCES}) ENDIF () ENDMACRO () indi-beefocus-0.1+20220128183230/cmake_modules/FindLibRaw.cmake0000644000175100017510000000562514174600255022502 0ustar debiandebian# - Find LibRaw # Find the LibRaw library # This module defines # LibRaw_VERSION_STRING, the version string of LibRaw # LibRaw_INCLUDE_DIR, where to find libraw.h # LibRaw_LIBRARIES, the libraries needed to use LibRaw (non-thread-safe) # LibRaw_r_LIBRARIES, the libraries needed to use LibRaw (thread-safe) # LibRaw_DEFINITIONS, the definitions needed to use LibRaw (non-thread-safe) # LibRaw_r_DEFINITIONS, the definitions needed to use LibRaw (thread-safe) # # Copyright (c) 2013, Pino Toscano # Copyright (c) 2013, Gilles Caulier # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. FIND_PACKAGE(PkgConfig) IF(PKG_CONFIG_FOUND) PKG_CHECK_MODULES(PC_LIBRAW libraw) SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER}) PKG_CHECK_MODULES(PC_LIBRAW_R libraw_r) SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER}) ENDIF() FIND_PATH(LibRaw_INCLUDE_DIR libraw.h HINTS ${PC_LIBRAW_INCLUDEDIR} ${PC_LibRaw_INCLUDE_DIRS} PATH_SUFFIXES libraw ) FIND_LIBRARY(LibRaw_LIBRARIES NAMES raw HINTS ${PC_LIBRAW_LIBDIR} ${PC_LIBRAW_LIBRARY_DIRS} ) FIND_LIBRARY(LibRaw_r_LIBRARIES NAMES raw_r HINTS ${PC_LIBRAW_R_LIBDIR} ${PC_LIBRAW_R_LIBRARY_DIRS} ) IF(LibRaw_INCLUDE_DIR) FILE(READ ${LibRaw_INCLUDE_DIR}/libraw_version.h _libraw_version_content) STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content}) SET(_libraw_version_major "${CMAKE_MATCH_1}") STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content}) SET(_libraw_version_minor "${CMAKE_MATCH_1}") STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content}) SET(_libraw_version_patch "${CMAKE_MATCH_1}") IF(_version_major_match AND _version_minor_match AND _version_patch_match) SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}") ELSE() IF(NOT LibRaw_FIND_QUIETLY) MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw_version.h") ENDIF() ENDIF() ENDIF() INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw REQUIRED_VARS LibRaw_LIBRARIES LibRaw_INCLUDE_DIR VERSION_VAR LibRaw_VERSION_STRING ) MARK_AS_ADVANCED(LibRaw_VERSION_STRING LibRaw_INCLUDE_DIR LibRaw_LIBRARIES LibRaw_r_LIBRARIES LibRaw_DEFINITIONS LibRaw_r_DEFINITIONS ) indi-beefocus-0.1+20220128183230/cmake_modules/FindALTAIRCAM.cmake0000644000175100017510000000301014174600255022601 0ustar debiandebian# - Try to find Altair Camera Library # Once done this will define # # ALTAIRCAM_FOUND - system has Altair # ALTAIRCAM_INCLUDE_DIR - the Altair include directory # ALTAIRCAM_LIBRARIES - Link these to use Altair # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) # in cache already set(ALTAIRCAM_FOUND TRUE) message(STATUS "Found libaltaircam: ${ALTAIRCAM_LIBRARIES}") else (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) find_path(ALTAIRCAM_INCLUDE_DIR altaircam.h PATH_SUFFIXES libaltaircam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(ALTAIRCAM_LIBRARIES NAMES altaircam PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) set(ALTAIRCAM_FOUND TRUE) else (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) set(ALTAIRCAM_FOUND FALSE) endif(ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) if (ALTAIRCAM_FOUND) if (NOT ALTAIRCAM_FIND_QUIETLY) message(STATUS "Found Altaircam: ${ALTAIRCAM_LIBRARIES}") endif (NOT ALTAIRCAM_FIND_QUIETLY) else (ALTAIRCAM_FOUND) if (ALTAIRCAM_FIND_REQUIRED) message(FATAL_ERROR "Altaircam not found. Please install Altaircam Library http://www.indilib.org") endif (ALTAIRCAM_FIND_REQUIRED) endif (ALTAIRCAM_FOUND) mark_as_advanced(ALTAIRCAM_INCLUDE_DIR ALTAIRCAM_LIBRARIES) endif (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindSBIG.cmake0000644000175100017510000000251214174600255022036 0ustar debiandebian# - Try to find SBIG Universal Library # Once done this will define # # SBIG_FOUND - system has SBIG # SBIG_INCLUDE_DIR - the SBIG include directory # SBIG_LIBRARIES - Link these to use SBIG # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) # in cache already set(SBIG_FOUND TRUE) message(STATUS "Found libsbig: ${SBIG_LIBRARIES}") else (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) find_path(SBIG_INCLUDE_DIR sbigudrv.h PATH_SUFFIXES libsbig ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(SBIG_LIBRARIES NAMES sbig PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) set(SBIG_FOUND TRUE) else (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) set(SBIG_FOUND FALSE) endif(SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) if (SBIG_FOUND) if (NOT SBIG_FIND_QUIETLY) message(STATUS "Found SBIG: ${SBIG_LIBRARIES}") endif (NOT SBIG_FIND_QUIETLY) else (SBIG_FOUND) if (SBIG_FIND_REQUIRED) message(FATAL_ERROR "SBIG not found. Please install SBIG Library http://www.indilib.org") endif (SBIG_FIND_REQUIRED) endif (SBIG_FOUND) mark_as_advanced(SBIG_INCLUDE_DIR SBIG_LIBRARIES) endif (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/CMakeParseArguments.cmake0000644000175100017510000000164214174600255024355 0ustar debiandebian#.rst: # CMakeParseArguments # ------------------- # # This module once implemented the :command:`cmake_parse_arguments` command # that is now implemented natively by CMake. It is now an empty placeholder # for compatibility with projects that include it to get the command from # CMake 3.4 and lower. #============================================================================= # Copyright 2010 Alexander Neundorf # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) indi-beefocus-0.1+20220128183230/cmake_modules/FindGPHOTO2.cmake0000644000175100017510000000562614174600255022405 0ustar debiandebian# - Find the native sqlite3 includes and library # # This module defines # GPHOTO2_INCLUDE_DIR, where to find libgphoto2 header files # GPHOTO2_LIBRARIES, the libraries to link against to use libgphoto2 # GPHOTO2_FOUND, If false, do not try to use libgphoto2. # GPHOTO2_VERSION_STRING, e.g. 2.4.14 # GPHOTO2_VERSION_MAJOR, e.g. 2 # GPHOTO2_VERSION_MINOR, e.g. 4 # GPHOTO2_VERSION_PATCH, e.g. 14 # # also defined, but not for general use are # GPHOTO2_LIBRARY, where to find the sqlite3 library. #============================================================================= # Copyright 2010 henrik andersson #============================================================================= SET(GPHOTO2_FIND_REQUIRED ${Gphoto2_FIND_REQUIRED}) find_path(GPHOTO2_INCLUDE_DIR gphoto2/gphoto2.h) mark_as_advanced(GPHOTO2_INCLUDE_DIR) set(GPHOTO2_NAMES ${GPHOTO2_NAMES} gphoto2 libgphoto2) set(GPHOTO2_PORT_NAMES ${GPHOTO2_PORT_NAMES} gphoto2_port libgphoto2_port) find_library(GPHOTO2_LIBRARY NAMES ${GPHOTO2_NAMES} ) find_library(GPHOTO2_PORT_LIBRARY NAMES ${GPHOTO2_PORT_NAMES} ) mark_as_advanced(GPHOTO2_LIBRARY) mark_as_advanced(GPHOTO2_PORT_LIBRARY) # Detect libgphoto2 version FIND_PROGRAM(GPHOTO2CONFIG_EXECUTABLE NAMES gphoto2-config) IF(GPHOTO2CONFIG_EXECUTABLE) EXEC_PROGRAM(${GPHOTO2CONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GPHOTO2_VERSION) string(REGEX REPLACE "^.*libgphoto2 ([0-9]+).*$" "\\1" GPHOTO2_VERSION_MAJOR "${GPHOTO2_VERSION}") string(REGEX REPLACE "^.*libgphoto2 [0-9]+\\.([0-9]+).*$" "\\1" GPHOTO2_VERSION_MINOR "${GPHOTO2_VERSION}") string(REGEX REPLACE "^.*libgphoto2 [0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GPHOTO2_VERSION_PATCH "${GPHOTO2_VERSION}") set(GPHOTO2_VERSION_STRING "${GPHOTO2_VERSION_MAJOR}.${GPHOTO2_VERSION_MINOR}.${GPHOTO2_VERSION_PATCH}") ENDIF(GPHOTO2CONFIG_EXECUTABLE) # handle the QUIETLY and REQUIRED arguments and set GPHOTO2_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GPHOTO2 DEFAULT_MSG GPHOTO2_LIBRARY GPHOTO2_INCLUDE_DIR) IF(GPHOTO2_FOUND) SET(Gphoto2_LIBRARIES ${GPHOTO2_LIBRARY} ${GPHOTO2_PORT_LIBRARY}) SET(Gphoto2_INCLUDE_DIRS ${GPHOTO2_INCLUDE_DIR}) # libgphoto2 dynamically loads and unloads usb library # without calling any cleanup functions (since they are absent from libusb-0.1). # This leaves usb event handling threads running with invalid callback and return addresses, # which causes a crash after any usb event is generated, at least in Mac OS X. # libusb1 backend does correctly call exit function, but ATM it crashes anyway. # Workaround is to link against libusb so that it wouldn't get unloaded. IF(APPLE) find_library(USB_LIBRARY NAMES usb-1.0 libusb-1.0) mark_as_advanced(USB_LIBRARY) IF(USB_LIBRARY) SET(Gphoto2_LIBRARIES ${Gphoto2_LIBRARIES} ${USB_LIBRARY}) ENDIF(USB_LIBRARY) ENDIF(APPLE) ENDIF(GPHOTO2_FOUND) indi-beefocus-0.1+20220128183230/cmake_modules/FindMMAL.cmake0000644000175100017510000000303214174600255022036 0ustar debiandebian# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # This module can find the MMAL camera libraries. # cmake_minimum_required(VERSION 3.0.0) set (MMAL_LIBS mmal_core mmal_util mmal_vc_client) set (EGL_LIBS brcmGLESv2 brcmEGL) foreach(lib ${MMAL_LIBS} ${EGL_LIBS} vcos bcm_host m dl) find_library(${lib}_LIBRARY NAMES ${lib} HINTS ${MMAL_DIR}/lib /opt/vc/lib ) if (DEFINED ${lib}_LIBRARY) set(MMAL_LIBRARIES ${MMAL_LIBRARIES} ${${lib}_LIBRARY}) else() message(FATAL_ERROR "Failed to find ${${lib}_LIBRARY} library") endif() endforeach(lib) find_path(BCM_INCLUDE_DIR NAMES bcm_host.h HINTS "/opt/vc/include" ) find_path(MMAL_BASE_INCLUDE_DIR NAMES mmal.h HINTS "/opt/vc/include/interface/mmal" ) find_path(MMAL_UTIL_INCLUDE_DIR NAMES mmal_util.h HINTS "/opt/vc/include/interface/mmal/util" ) if (MMAL_BASE_INCLUDE_DIR AND BCM_INCLUDE_DIR AND MMAL_UTIL_INCLUDE_DIR) set(MMAL_INCLUDE_DIR ${MMAL_BASE_INCLUDE_DIR} ${BCM_INCLUDE_DIR} ${MMAL_UTIL_INCLUDE_DIR}) set(MMAL_FOUND TRUE) endif() indi-beefocus-0.1+20220128183230/cmake_modules/FindAIOUSB.cmake0000644000175100017510000000371314174600255022300 0ustar debiandebian# - Try to find libaiousb # Once done this will define # # AIOUSB_FOUND - system has AIOUSB # AIOUSB_INCLUDE_DIR - the AIOUSB include directory # AIOUSB_LIBRARIES - Link these to use AIOUSB (C) # AIOUSB_CPP_LIBRARIES - Link these to use AIOUSB (C++) # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) # in cache already set(AIOUSB_FOUND TRUE) message(STATUS "Found libaiusb: ${AIOUSB_LIBRARIES}") message(STATUS "Found libaiusbcpp: ${AIOUSB_CPP_LIBRARIES}") else (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) find_path(AIOUSB_INCLUDE_DIR aiousb.h ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(AIOUSB_LIBRARIES NAMES aiousb PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(AIOUSB_CPP_LIBRARIES NAMES aiousbcpp PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) set(AIOUSB_FOUND TRUE) else (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) set(AIOUSB_FOUND FALSE) endif(AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) if (AIOUSB_FOUND) if (NOT AIOUSB_FIND_QUIETLY) message(STATUS "Found libaiousb: ${AIOUSB_LIBRARIES}") message(STATUS "Found libaiusbcpp: ${AIOUSB_CPP_LIBRARIES}") endif (NOT AIOUSB_FIND_QUIETLY) else (AIOUSB_FOUND) if (AIOUSB_FIND_REQUIRED) message(FATAL_ERROR "libaiousb not found. Please install libaiousb. https://www.accesio.com") endif (AIOUSB_FIND_REQUIRED) endif (AIOUSB_FOUND) mark_as_advanced(AIOUSB_INCLUDE_DIR AIOUSB_LIBRARIES AIOUSB_CPP_LIBRARIES) endif (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindAPOGEE.cmake0000644000175100017510000000311514174600255022252 0ustar debiandebian# - Try to find Apogee Instruments Library # Once done this will define # # APOGEE_FOUND - system has APOGEE # APOGEE_INCLUDE_DIR - the APOGEE include directory # APOGEE_LIBRARY - Link these to use APOGEE # Copyright (c) 2008, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) # in cache already set(APOGEE_FOUND TRUE) message(STATUS "Found libapogee: ${APOGEE_LIBRARY}") else (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) find_path(APOGEE_INCLUDE_DIR ApogeeCam.h PATH_SUFFIXES libapogee ${_obIncDir} ${GNUWIN32_DIR}/include ) # Find Apogee Library find_library(APOGEE_LIBRARY NAMES apogee PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) set(APOGEE_FOUND TRUE) else (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) set(APOGEE_FOUND FALSE) endif(APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) if (APOGEE_FOUND) if (NOT APOGEE_FIND_QUIETLY) message(STATUS "Found APOGEE: ${APOGEE_LIBRARY}") endif (NOT APOGEE_FIND_QUIETLY) else (APOGEE_FOUND) if (APOGEE_FIND_REQUIRED) message(FATAL_ERROR "libapogee not found. Cannot compile Apogee CCD Driver. Please install libapogee and try again. http://www.indilib.org") endif (APOGEE_FIND_REQUIRED) endif (APOGEE_FOUND) mark_as_advanced(APOGEE_INCLUDE_DIR APOGEE_LIBRARY) endif (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) indi-beefocus-0.1+20220128183230/cmake_modules/FindFFmpeg.cmake0000644000175100017510000001573514174600255022471 0ustar debiandebian# - Try to find ffmpeg libraries (libavcodec, libavdevice, libavformat, libavutil, and libswscale) # Once done this will define # # FFMPEG_FOUND - system has ffmpeg or libav # FFMPEG_INCLUDE_DIR - the ffmpeg include directory # FFMPEG_LIBRARIES - Link these to use ffmpeg # FFMPEG_LIBAVCODEC # FFMPEG_LIBAVDEVICE # FFMPEG_LIBAVFORMAT # FFMPEG_LIBAVUTIL # FFMPEG_LIBSWSCALE # # Copyright (c) 2008 Andreas Schneider # Modified for other libraries by Lasse Kärkkäinen # Modified for Hedgewars by Stepik777 # Modified for INDILIB by rlancaste # # Redistribution and use is allowed according to the terms of the New # BSD license. # macro(_FFMPEG_PACKAGE_check_version) if(EXISTS "${PACKAGE_INCLUDE_DIR}/version.h") file(READ "${PACKAGE_INCLUDE_DIR}/version.h" _FFMPEG_PACKAGE_version_header) string(REGEX MATCH "#define ${PACKAGE_NAME}_VERSION_MAJOR[ \t]+([0-9]+)" _VERSION_MAJOR_match "${_FFMPEG_PACKAGE_version_header}") set(FFMPEG_PACKAGE_VERSION_MAJOR "${CMAKE_MATCH_1}") string(REGEX MATCH "#define ${PACKAGE_NAME}_VERSION_MINOR[ \t]+([0-9]+)" _VERSION_MINOR_match "${_FFMPEG_PACKAGE_version_header}") set(FFMPEG_PACKAGE_VERSION_MINOR "${CMAKE_MATCH_1}") string(REGEX MATCH "#define ${PACKAGE_NAME}_VERSION_MICRO[ \t]+([0-9]+)" _VERSION_MICRO_match "${_FFMPEG_PACKAGE_version_header}") set(FFMPEG_PACKAGE_VERSION_MICRO "${CMAKE_MATCH_1}") set(FFMPEG_PACKAGE_VERSION ${FFMPEG_PACKAGE_VERSION_MAJOR}.${FFMPEG_PACKAGE_VERSION_MINOR}.${FFMPEG_PACKAGE_VERSION_MICRO}) if(${FFMPEG_PACKAGE_VERSION} VERSION_LESS ${FFMPEG_PACKAGE_FIND_VERSION}) set(FFMPEG_PACKAGE_VERSION_OK FALSE) else(${FFMPEG_PACKAGE_VERSION} VERSION_LESS ${FFMPEG_PACKAGE_FIND_VERSION}) set(FFMPEG_PACKAGE_VERSION_OK TRUE) endif(${FFMPEG_PACKAGE_VERSION} VERSION_LESS ${FFMPEG_PACKAGE_FIND_VERSION}) if(NOT FFMPEG_PACKAGE_VERSION_OK) message(STATUS "${PACKAGE_NAME} version ${FFMPEG_PACKAGE_VERSION} found in ${PACKAGE_INCLUDE_DIR}, " "but at least version ${FFMPEG_PACKAGE_FIND_VERSION} is required") else(NOT FFMPEG_PACKAGE_VERSION_OK) mark_as_advanced(FFMPEG_PACKAGE_VERSION_MAJOR FFMPEG_PACKAGE_VERSION_MINOR FFMPEG_PACKAGE_VERSION_MICRO) endif(NOT FFMPEG_PACKAGE_VERSION_OK) else(EXISTS "${PACKAGE_INCLUDE_DIR}/version.h") set(FFMPEG_PACKAGE_VERSION_OK FALSE) message(STATUS "${PACKAGE_NAME}'s version.h file was not found in the include directory: ${PACKAGE_INCLUDE_DIR}, please install this program.") endif(EXISTS "${PACKAGE_INCLUDE_DIR}/version.h") endmacro(_FFMPEG_PACKAGE_check_version) # required ffmpeg library versions, Requiring at least FFMPEG 3.2.11, Hypatia set(_avcodec_ver ">=57.64.101") set(_avdevice_ver ">=57.1.100") set(_avformat_ver ">=57.56.100") set(_avutil_ver ">=55.34.100") set(_swscale_ver ">=4.2.100") if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) # in cache already set(FFMPEG_FOUND TRUE) else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_path(FFMPEG_INCLUDE_DIR NAMES libavcodec/avcodec.h PATHS ${FFMPEG_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES ffmpeg libav ) find_package(PkgConfig) if (PKG_CONFIG_FOUND) pkg_check_modules(AVCODEC libavcodec${_avcodec_ver}) pkg_check_modules(AVDEVICE libavdevice${_avdevice_ver}) pkg_check_modules(AVFORMAT libavformat${_avformat_ver}) pkg_check_modules(AVUTIL libavutil${_avutil_ver}) pkg_check_modules(SWSCALE libswscale${_swscale_ver}) else (PKG_CONFIG_FOUND) # LIBAVCODEC set(PACKAGE_NAME "LIBAVCODEC") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavcodec") set(FFMPEG_PACKAGE_FIND_VERSION _avcodec_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(AVCODEC_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) # LIBAVDEVICE set(PACKAGE_NAME "LIBAVDEVICE") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavdevice") set(FFMPEG_PACKAGE_FIND_VERSION _avdevice_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(AVDEVICE_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) # LIBAVFORMAT set(PACKAGE_NAME "LIBAVFORMAT") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavformat") set(FFMPEG_PACKAGE_FIND_VERSION _avformat_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(AVFORMAT_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) # LIBAVUTIL set(PACKAGE_NAME "LIBAVUTIL") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavutil") set(FFMPEG_PACKAGE_FIND_VERSION _avutil_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(AVUTIL_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) # LIBSWSCALE set(PACKAGE_NAME "LIBSWSCALE") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libswscale") set(FFMPEG_PACKAGE_FIND_VERSION _swscale_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(SWSCALE_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) endif (PKG_CONFIG_FOUND) find_library(FFMPEG_LIBAVCODEC NAMES avcodec libavcodec PATHS ${AVCODEC_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) find_library(FFMPEG_LIBAVDEVICE NAMES avdevice libavdevice PATHS ${AVDEVICE_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) find_library(FFMPEG_LIBAVFORMAT NAMES avformat libavformat PATHS ${AVFORMAT_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) find_library(FFMPEG_LIBAVUTIL NAMES avutil libavutil PATHS ${AVUTIL_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) find_library(FFMPEG_LIBSWSCALE NAMES swscale libswscale PATHS ${SWSCALE_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) #Only set FFMPEG to found if all the libraries are found in the right versions. if(AVCODEC_VERSION AND AVDEVICE_VERSION AND AVFORMAT_VERSION AND AVUTIL_VERSION AND SWSCALE_VERSION AND FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVDEVICE AND FFMPEG_LIBAVFORMAT AND FFMPEG_LIBAVUTIL AND FFMPEG_LIBSWSCALE) set(FFMPEG_FOUND TRUE) endif() if (FFMPEG_FOUND) set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVDEVICE} ${FFMPEG_LIBAVFORMAT} ${FFMPEG_LIBAVUTIL} ${FFMPEG_LIBSWSCALE} ) endif (FFMPEG_FOUND) if (FFMPEG_FOUND) if (NOT FFMPEG_FIND_QUIETLY) message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}") endif (NOT FFMPEG_FIND_QUIETLY) else (FFMPEG_FOUND) message(STATUS "Could not find up to date FFMPEG for INDI Webcam. Up to date versions of these packages are required: libavcodec, libavdevice, libavformat, libavutil, and libswscale") if (FFMPEG_FIND_REQUIRED) message(FATAL_ERROR "Error: FFMPEG is required by this package!") endif (FFMPEG_FIND_REQUIRED) endif (FFMPEG_FOUND) endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) indi-beefocus-0.1+20220128183230/cmake_modules/FindIconv.cmake0000644000175100017510000000426114174600255022373 0ustar debiandebian# # Copyright (C) 2010 Michael Bell # 2015-2016 MariaDB Corporation AB # # Redistribution and use is allowed according to the terms of the New # BSD license. # For details see the COPYING-CMAKE-SCRIPTS file. # # ICONV_EXTERNAL - Iconv is an external library (not libc) # ICONV_FOUND - system has Iconv # ICONV_INCLUDE_DIR - the Iconv include directory # ICONV_LIBRARIES - Link these to use Iconv # ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const # ICONV_VERSION - Iconv version string if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) # Already in cache, be silent set(ICONV_FIND_QUIETLY TRUE) endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) find_path(ICONV_INCLUDE_DIR iconv.h) IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") # There is some libiconv.so in /usr/local that must # be avoided, iconv routines are in libc ELSEIF(APPLE) find_library(ICONV_LIBRARIES NAMES iconv libiconv PATHS /usr/lib/ NO_CMAKE_SYSTEM_PATH) SET(ICONV_EXTERNAL TRUE) ELSE() find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2) IF(ICONV_LIBRARIES) SET(ICONV_EXTERNAL TRUE) ENDIF() ENDIF() if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) set (ICONV_FOUND TRUE) endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) IF(ICONV_EXTERNAL) set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) ENDIF() if (ICONV_FOUND) include(CheckCSourceCompiles) CHECK_C_SOURCE_COMPILES(" #include int main(){ iconv_t conv = 0; const char* in = 0; size_t ilen = 0; char* out = 0; size_t olen = 0; iconv(conv, &in, &ilen, &out, &olen); return 0; } " ICONV_SECOND_ARGUMENT_IS_CONST ) endif (ICONV_FOUND) set (CMAKE_REQUIRED_INCLUDES) set (CMAKE_REQUIRED_LIBRARIES) if (ICONV_FOUND) if (NOT ICONV_FIND_QUIETLY) message (STATUS "Found Iconv: ${ICONV_LIBRARIES}") endif (NOT ICONV_FIND_QUIETLY) else (ICONV_FOUND) if (Iconv_FIND_REQUIRED) message (FATAL_ERROR "Could not find Iconv") endif (Iconv_FIND_REQUIRED) endif (ICONV_FOUND) MARK_AS_ADVANCED( ICONV_INCLUDE_DIR ICONV_LIBRARIES ICONV_EXTERNAL ICONV_SECOND_ARGUMENT_IS_CONST ) indi-beefocus-0.1+20220128183230/cmake_modules/FindLIMESUITE.cmake0000644000175100017510000000301214174600255022646 0ustar debiandebian# - Try to find LIMESUITE # Once done this will define # # LIMESUITE_FOUND - system has LIMESUITE # LIMESUITE_INCLUDE_DIR - the LIMESUITE include directory # LIMESUITE_LIBRARIES - Link these to use LIMESUITE # LIMESUITE_VERSION_STRING - Human readable version number of rtlsdr # LIMESUITE_VERSION_MAJOR - Major version number of rtlsdr # LIMESUITE_VERSION_MINOR - Minor version number of rtlsdr # Copyright (c) 2017, Ilia Platone, # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (LIMESUITE_LIBRARIES) # in cache already set(LIMESUITE_FOUND TRUE) message(STATUS "Found LIMESUITE: ${LIMESUITE_LIBRARIES}") else (LIMESUITE_LIBRARIES) find_library(LIMESUITE_LIBRARIES NAMES LimeSuite PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(LIMESUITE_LIBRARIES) set(LIMESUITE_FOUND TRUE) else (LIMESUITE_LIBRARIES) set(LIMESUITE_FOUND FALSE) endif(LIMESUITE_LIBRARIES) if (LIMESUITE_FOUND) if (NOT LIMESUITE_FIND_QUIETLY) message(STATUS "Found LIMESUITE: ${LIMESUITE_LIBRARIES}") endif (NOT LIMESUITE_FIND_QUIETLY) else (LIMESUITE_FOUND) if (LIMESUITE_FIND_REQUIRED) message(FATAL_ERROR "LIMESUITE not found. Please install libLimeSuite-dev") endif (LIMESUITE_FIND_REQUIRED) endif (LIMESUITE_FOUND) mark_as_advanced(LIMESUITE_LIBRARIES) endif (LIMESUITE_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindPLAYERONE.cmake0000644000175100017510000000322114174600255022646 0ustar debiandebian# - Try to find PlayerOne Library # Once done this will define # # PLAYERONE_FOUND - system has PLAYERONE # PLAYERONE_INCLUDE_DIR - the PLAYERONE include directory # PLAYERONE_LIBRARIES - Link these to use ASI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) # in cache already set(PLAYERONE_FOUND TRUE) message(STATUS "Found libplayerone: ${PLAYERONE_LIBRARIES}") else (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) find_path(PLAYERONE_INCLUDE_DIR PlayerOneCamera.h PATH_SUFFIXES libplayerone ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(PLAYERONECAM_LIBRARIES NAMES PlayerOneCamera PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if (PLAYERONECAM_LIBRARIES) set(PLAYERONE_LIBRARIES ${PLAYERONECAM_LIBRARIES}) endif (PLAYERONECAM_LIBRARIES) if(PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) set(PLAYERONE_FOUND TRUE) else (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) set(PLAYERONE_FOUND FALSE) endif(PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) if (PLAYERONE_FOUND) if (NOT PLAYERONE_FIND_QUIETLY) message(STATUS "Found PLAYERONE: ${PLAYERONE_LIBRARIES}") endif (NOT PLAYERONE_FIND_QUIETLY) else (PLAYERONE_FOUND) if (PLAYERONE_FIND_REQUIRED) message(FATAL_ERROR "PLAYERONE not found. Please install libPlayerOneCamera.2 http://www.indilib.org") endif (PLAYERONE_FIND_REQUIRED) endif (PLAYERONE_FOUND) mark_as_advanced(PLAYERONE_INCLUDE_DIR PLAYERONE_LIBRARIES) endif (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindNNCAM.cmake0000644000175100017510000000256314174600255022154 0ustar debiandebian# - Try to find NNCAM Camera Library # Once done this will define # # NNCAM_FOUND - system has Levenhuk # NNCAM_INCLUDE_DIR - the Levenhuk include directory # NNCAM_LIBRARIES - Link these to use Levenhuk # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) # in cache already set(NNCAM_FOUND TRUE) message(STATUS "Found libnncam: ${NNCAM_LIBRARIES}") else (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) find_path(NNCAM_INCLUDE_DIR nncam.h PATH_SUFFIXES libnncam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(NNCAM_LIBRARIES NAMES nncam PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) set(NNCAM_FOUND TRUE) else (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) set(NNCAM_FOUND FALSE) endif(NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) if (NNCAM_FOUND) if (NOT NNCAM_FIND_QUIETLY) message(STATUS "Found NNCAM: ${NNCAM_LIBRARIES}") endif (NOT NNCAM_FIND_QUIETLY) else (NNCAM_FOUND) if (NNCAM_FIND_REQUIRED) message(FATAL_ERROR "NNCAM not found. Please install NNCAM Library http://www.indilib.org") endif (NNCAM_FIND_REQUIRED) endif (NNCAM_FOUND) mark_as_advanced(NNCAM_INCLUDE_DIR NNCAM_LIBRARIES) endif (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) indi-beefocus-0.1+20220128183230/cmake_modules/FindRT.cmake0000644000175100017510000000152514174600255021642 0ustar debiandebian# FindRT.cmake - Try to find the RT library # Once done this will define # # RT_FOUND - System has rt # RT_INCLUDE_DIR - The rt include directory # RT_LIBRARIES - The libraries needed to use rt # RT_DEFINITIONS - Compiler switches required for using rt # # Also creates an import target called RT::RT find_path (RT_INCLUDE_DIR NAMES time.h PATHS /usr /usr/local /opt PATH_SUFFIXES ) find_library(RT_LIBRARIES NAMES rt PATHS /usr /usr/local /opt ) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(rt DEFAULT_MSG RT_LIBRARIES RT_INCLUDE_DIR) mark_as_advanced(RT_INCLUDE_DIR RT_LIBRARIES) if (NOT TARGET RT::RT) add_library(RT::RT INTERFACE IMPORTED) set_target_properties(RT::RT PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${RT_INCLUDE_DIR} INTERFACE_LINK_LIBRARIES ${RT_LIBRARIES} ) endif()indi-beefocus-0.1+20220128183230/CMakeLists.txt0000644000175100017510000000506014174600255017440 0ustar debiandebiancmake_minimum_required(VERSION 3.0) PROJECT(indi_beefocus CXX C) LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/") include(GNUInstallDirs) find_package(INDI REQUIRED) set(BEEFOCUS_VERSION_MAJOR 1) set(BEEFOCUS_VERSION_MINOR 0) set(INDI_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/indi") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/indi_beefocus.xml.cmake ${CMAKE_CURRENT_BINARY_DIR}/indi_beefocus.xml ) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/driver) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/firmware) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/glue) include_directories(${INDI_INCLUDE_DIR}) include(CMakeCommon) ################# Beefocus ############################ set(indi_beefocus_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/driver/beefocus.cpp ${CMAKE_CURRENT_SOURCE_DIR}/driver/beeconnect.cpp ${CMAKE_CURRENT_SOURCE_DIR}/driver/beesimfirmware.cpp ${CMAKE_CURRENT_SOURCE_DIR}/firmware/command_parser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/firmware/focuser_state.cpp ${CMAKE_CURRENT_SOURCE_DIR}/firmware/hardware_interface.cpp ) add_executable(indi_beefocus ${indi_beefocus_SRCS}) target_link_libraries(indi_beefocus ${INDI_LIBRARIES} ) install(TARGETS indi_beefocus RUNTIME DESTINATION bin ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_beefocus.xml DESTINATION ${INDI_DATA_DIR}) ################# Unit Testing ######################## IF (INDI_BUILD_UNITTESTS) # Workaround for fixing a linking error caused by "-pie" flag in CMakeCommon # set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,nodump -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now") enable_testing() find_package(GTest REQUIRED) include_directories(${GTEST_INCLUDE_DIRS}) SET(UNIT_TESTS test_driver ) foreach( TEST ${UNIT_TESTS} ) SET( TEST_SOURCES ${indi_beefocus_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/test_helpers.cpp ) SET( TEST_MAIN_CPP ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/${TEST}.cpp) SET_SOURCE_FILES_PROPERTIES(${TEST_MAIN_CPP} PROPERTIES LANGUAGE CXX) ADD_EXECUTABLE(${TEST} ${TEST_MAIN_CPP} ${TEST_SOURCES}) TARGET_LINK_LIBRARIES( ${TEST} ${INDI_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} #${ZLIB_LIBRARY} ) add_test( run-tests ${TEST} ) ADD_CUSTOM_COMMAND( TARGET ${TEST} COMMENT "Running ${TEST}" POST_BUILD WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND ${TEST} ) endforeach(TEST) ENDIF (INDI_BUILD_UNITTESTS) indi-beefocus-0.1+20220128183230/indi_beefocus.xml.cmake0000644000175100017510000000040114174600255021271 0ustar debiandebian indi_beefocus 1.0 indi-beefocus-0.1+20220128183230/README.md0000644000175100017510000000510414174600255016156 0ustar debiandebianBeefocus ======== Beefocus is an Open Source Hardware/ Software Telescope Focuser The goal of the project is to create a high quality DIY focuser that's relatively easy to build and modify. The Github page for the project is https://github.com/glowmouse/beefocus The page contains the focuser's firmware and hardware builds. The connection to the focuser hardware is done using WiFi. WiFi telescope setups are becoming common as astronomers mount computers directly onto their telescopes to reduce cabling. The WiFi connection means one less cable and one less USB port. The Focuser's firmware runs on an ESP8266 - these are <$10 micro-controllers similar to Arduinos (in fact, the Arduino SDK is used to compile the firmware) Actual and Simulated Focuser ============================ The Beefocus INDI driver supports two modes, 1. Connect to an actual focuser using a TCP/IP connection 2. Simulate the focuser in software, using a virtual "software-only" connection The actual hardware focuser is controlled by firmware that's compiled and loaded onto the EPS8266 micro-controller. The firmware handles the connection to the driver, accepts new commands from the driver, controls the stepper motor, and sends responses. The same firmware is used when the driver is in simulation mode. The simulated firmware handles the virtual "software-only" connection to the driver, accepts new commands from the driver, controls a simulated stepper motor, and sends responses. Having simulated hardware that's a close match to the actual hardware is useful for testing. The unit tests create an INDI Beefocus driver using a simulated focuser, feed the driver commands (i.e. move to an absolute position), and check the driver's output to make sure it's correct. The tests run in "accelerated time"; a test sequence that would take minutes on an actual focuser takes seconds on the simulated focuser. To try out the simulator to to the Focuser's Connection menu, select Simulated Connection instead of TCP Connect, and then press Connect in Main Control. INDI Driver Directory Layout ============================ File | Description ---- | ----------- driver/beefocus | The core INDI driver driver/beeconnect | Connection interface to actual or simulated focuser driver/beesimfirmware | Uses the Firmware to simulate the focuser unit_tests/test_helpers | General Utilities for unit testing INDI drivers unit_tests/test_driver | Beefocus unit tests (using the simulated firmware) firmware/* | ESP8266 Firmware. Also used for simulation. indi-beefocus-0.1+20220128183230/indi-beefocus.spec0000644000175100017510000000414214174600255020270 0ustar debiandebian%define __cmake_in_source_build %{_vpath_builddir} Name: indi-beefocus Version:1.9.5.git Release: %(date -u +%%Y%%m%%d%%H%%M%%S)%{?dist} Summary: Instrument Neutral Distributed Interface 3rd party drivers License: LGPLv2 # See COPYRIGHT file for a description of the licenses and files covered URL: https://indilib.org Source0: https://github.com/indilib/indi-3rdparty/archive/master.tar.gz BuildRequires: cmake BuildRequires: libfli-devel BuildRequires: libnova-devel BuildRequires: qt5-qtbase-devel BuildRequires: systemd BuildRequires: gphoto2-devel BuildRequires: LibRaw-devel BuildRequires: indi-libs BuildRequires: indi-devel BuildRequires: libtiff-devel BuildRequires: cfitsio-devel BuildRequires: zlib-devel BuildRequires: gsl-devel BuildRequires: libcurl-devel BuildRequires: libjpeg-turbo-devel BuildRequires: fftw-devel BuildRequires: libftdi-devel BuildRequires: gpsd-devel BuildRequires: libdc1394-devel BuildRequires: boost-devel BuildRequires: boost-regex BuildRequires: libasi BuildRequires: gmock BuildRequires: pkgconfig(fftw3) BuildRequires: pkgconfig(cfitsio) BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(gsl) BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libusb-1.0) BuildRequires: pkgconfig(zlib) %description INDI is a distributed control protocol designed to operate astronomical instrumentation. INDI is small, flexible, easy to parse, and scalable. It supports common DCS functions such as remote control, data acquisition, monitoring, and a lot more. This is a 3rd party driver. %prep -v %autosetup -v -p1 -n indi-3rdparty-master %build # This package tries to mix and match PIE and PIC which is wrong and will # trigger link errors when LTO is enabled. # Disable LTO %define _lto_cflags %{nil} cd indi-beefocus %cmake -DINDI_DATA_DIR=/usr/share/indi . make VERBOSE=1 %{?_smp_mflags} -j4 %install cd indi-beefocus make DESTDIR=%{buildroot} install %files %{_bindir}/* %{_datadir}/indi %changelog * Sun Jul 19 2020 Jim Howard 1.8.7.git-1 - update to build from git for copr, credit to Sergio Pascual and Christian Dersch for prior work on spec files