Serial Port Manager Class

Hi, I'm trying to implement a serialport manager class as part of a very large project. The idea is the this manager class would be a controller for the Serial Port.

general class structure is as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class SerialPortManager
{
public:
	SerialPortManager(){}
	~SerialPortManager(){}

	void Init(SerialSettings currentSerialSettings);
	System::IO::Ports::SerialPort GetSerialPort();
	SerialSettings GetSerialSettings();
	void SendData(std::string command);
	void InitCommunication();
        void StopCommunication();

	

private:
	System::IO::Ports::SerialPort CurrentSerialPort_;
	void SetCurrentSerialPort(System::IO::Ports::SerialPort serialport);
	SerialSettings CurrentSerialSettings_;
	void SetSerialSettings(SerialSettings serialsettings);


};


For some reason when i compile this code i'm given an error regarding managed vs unmanaged classes. "Error 1 error C3265: cannot declare a managed 'CurrentSerialPort_' in an unmanaged 'SerialPortManager'"

I could put ref keyword in but then that would mean i would be unable to include events(an extension of this class i wish to perform).
I'm no good at .Net or CLI but can't you just make your custom class managed? http://www.codeproject.com/Articles/1479/Introduction-to-Managed-C
I figure out that the best way to do this is to windows.h to pass a HANDLE to the Serial Port
Topic archived. No new replies allowed.