|
|
|
|
|
|
|
|
Toolkit::TStimulationEncoder<CBoxAlgorithmUDPStimcodeSender> m_StimEncoder;
|
|
|
Toolkit::TStimulationEncoder<CBoxAlgorithmUDPStimcodeSender> m_StimEncoder;
|
|
|
private:
|
|
|
private:
|
|
|
// Box setting variables
|
|
|
// Box setting variables
|
|
|
CString FeatherIP;
|
|
|
|
|
|
uint64_t FeatherPort;
|
|
|
|
|
|
uint64_t RowStimulationBase;
|
|
|
|
|
|
uint64_t NumberofTactilos;
|
|
|
|
|
|
|
|
|
CString m_IP = "";
|
|
|
|
|
|
uint64_t m_Port = 0;
|
|
|
|
|
|
uint64_t m_RowBase = 0;
|
|
|
|
|
|
uint64_t m_nTactilos = 0;
|
|
|
// Socket
|
|
|
// Socket
|
|
|
boost::asio::io_service io_service;
|
|
|
|
|
|
boost::asio::ip::udp::socket socket{io_service};
|
|
|
|
|
|
|
|
|
boost::asio::io_service m_IOService;
|
|
|
|
|
|
boost::asio::ip::udp::socket m_Socket{m_IOService};
|
|
|
};
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If you need to implement a box Listener, here is a sekeleton for you.
|
|
|
|
|
|
// Use only the callbacks you need.
|
|
|
|
|
|
// For example, if your box has a variable number of input, but all of them must be stimulation inputs.
|
|
|
|
|
|
// The following listener callback will ensure that any newly added input is stimulations :
|
|
|
|
|
|
/*
|
|
|
|
|
|
bool onInputAdded(Kernel::IBox& box, const size_t index) override
|
|
|
|
|
|
{
|
|
|
|
|
|
box.setInputType(index, OV_TypeId_Stimulations);
|
|
|
|
|
|
};
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
// The box listener can be used to call specific callbacks whenever the box structure changes : input added, name changed, etc.
|
|
|
|
|
|
// Please uncomment below the callbacks you want to use.
|
|
|
|
|
|
/// <summary> Listener of the box UDPStimcodeSender. </summary>
|
|
|
|
|
|
class CBoxAlgorithmUDPStimcodeSenderListener final : public Toolkit::TBoxListener<IBoxListener>
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
//bool onInitialized(Kernel::IBox& box) override { return true; };
|
|
|
|
|
|
//bool onNameChanged(Kernel::IBox& box) override { return true; };
|
|
|
|
|
|
//bool onInputConnected(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onInputDisconnected(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onInputAdded(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onInputRemoved(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onInputTypeChanged(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onInputNameChanged(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onOutputConnected(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onOutputDisconnected(Kernel::IBox& box, const size_t index) { return true; };
|
|
|
|
|
|
//bool onOutputAdded(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onOutputRemoved(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onOutputTypeChanged(Kernel::IBox& box, const size_t index) override override { return true; };
|
|
|
|
|
|
//bool onOutputNameChanged(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onSettingAdded(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onSettingRemoved(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onSettingTypeChanged(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onSettingNameChanged(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onSettingDefaultValueChanged(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
//bool onSettingValueChanged(Kernel::IBox& box, const size_t index) override { return true; };
|
|
|
|
|
|
|
|
|
|
|
|
_IsDerivedFromClass_Final_(Toolkit::TBoxListener<IBoxListener>, CIdentifier::undefined())
|
|
|
|
|
|
};
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> Descriptor of the box UDPStimcodeSender. </summary>
|
|
|
/// <summary> Descriptor of the box UDPStimcodeSender. </summary>
|
|
|
class CBoxAlgorithmUDPStimcodeSenderDesc final : virtual public IBoxAlgorithmDesc
|
|
|
class CBoxAlgorithmUDPStimcodeSenderDesc final : virtual public IBoxAlgorithmDesc
|
|
|
{
|
|
|
{
|
|
|
|
|
|
|
|
|
CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_UDPStimcodeSender; }
|
|
|
CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_UDPStimcodeSender; }
|
|
|
IPluginObject* create() override { return new CBoxAlgorithmUDPStimcodeSender; }
|
|
|
IPluginObject* create() override { return new CBoxAlgorithmUDPStimcodeSender; }
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
IBoxListener* createBoxListener() const override { return new CBoxAlgorithmUDPStimcodeSenderListener; }
|
|
|
|
|
|
void releaseBoxListener(IBoxListener* listener) const override { delete listener; }
|
|
|
|
|
|
*/
|
|
|
|
|
|
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
|
|
|
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
|
|
|
{
|
|
|
{
|
|
|
prototype.addInput("StimcodeIn",OV_TypeId_Stimulations);
|
|
|
prototype.addInput("StimcodeIn",OV_TypeId_Stimulations);
|
|
|
|
|
|
|
|
|
prototype.addSetting("FeatherIP",OV_TypeId_String,"192.168.4.1");
|
|
|
prototype.addSetting("FeatherIP",OV_TypeId_String,"192.168.4.1");
|
|
|
prototype.addSetting("FeatherPort",OV_TypeId_Integer,"8888");
|
|
|
prototype.addSetting("FeatherPort",OV_TypeId_Integer,"8888");
|
|
|
prototype.addSetting("RowStimulationBase",OV_TypeId_Stimulation,"OVTK_StimulationId_Label_01");
|
|
|
prototype.addSetting("RowStimulationBase",OV_TypeId_Stimulation,"OVTK_StimulationId_Label_01");
|
|
|
//prototype.addSetting("Number of Tactilos",OV_TypeId_Integer,"6"); //used to make this setting accessable in the box settings
|
|
|
|
|
|
|
|
|
prototype.addSetting("Number of Tactilos",OV_TypeId_Integer,"6");
|
|
|
|
|
|
|
|
|
prototype.addFlag(Kernel::BoxFlag_CanModifySetting);
|
|
|
prototype.addFlag(Kernel::BoxFlag_CanModifySetting);
|
|
|
//prototype.addFlag(Kernel::BoxFlag_CanAddSetting);
|
|
|
//prototype.addFlag(Kernel::BoxFlag_CanAddSetting);
|