/* * UConnCtrlBoard.hh * * Created on: Apr 28, 2013 * Author: * * This class provides interface that EPICS support will use to monitor * and control the control boards on UCon Tagger Microscope detector. * All methods, including accessors, need to be thread-safe since they * may be executing simultaneously on multiple threads. */ #ifndef _UCONN_CTRL_BOARD_HH_ #define _UCONN_CTRL_BOARD_HH_ #include #include #include #include #include #include "UConnBiasChannel.hh" class UConnCtrlBoard { protected: string uccbAddress; // Prevent copying boards UConnCtrlBoard(const UConnCtrlBoard& board); UConnCtrlBoard& operator=(const UConnCtrlBoard& board); // Map that keeps track of the channels served by the board // Key is the address, the address is the address of the // corresponding UConnBiasChannel object instance. std::map uccbChannelMap; // This static member is a map that keep record of all control board // object instances. It is accessible through a class method to ensure // the thread safety. static std::map uccbBoardMap; public: // Constructor. Open communication for board specified by "address" // Create all channel objects on that board and fill the channel map. It also // registers the create board in the map of boards. Throws an // exception if fails to create the object. UConnCtrlBoard(std::string address) : uccbAddress(address) { uccbChannelMap["0"] = new UConnBiasChannel( uccbAddress, "0" ); uccbChannelMap["1"] = new UConnBiasChannel( uccbAddress, "1" ); uccbChannelMap["4"] = new UConnBiasChannel( uccbAddress, "4" ); }; // Destructor. Closes this communication channel. Removes the address of // this board from the map of the boards. ~UConnCtrlBoard(){}; // Reset the communication channel int Reset(){ return 0; }; // Method to check if communication is active bool IsConnected() { return true; }; // Return the measured temperature of the board double GetTemperature(){ return 75.5; }; // Return the 32-bit status word for this board uint32_t GetStatus(){ return 0xF0F; }; // Return the number of channels this board is serving unsigned GetNumberOfChannels(){ return 50; }; // Return the address of the board std::string GetAddress(){ return "192.168.1.1"; }; // Create and return a vector with pointer to all channels // served by this control board. std::map GetChannelMap(){ return uccbChannelMap; }; // Translate the status word to a list of human readable messages static std::vector StatusString(unsigned long status){}; // Get the map of pointers to all active boards. static std::map GetBoardMap(){}; }; #endif /* _UCONN_CTRL_BOARD_HH_ */