|
to:huanwu
Ha ha, this method implements a "one-way" interaction: that is, the device calls CWhat. Of course in OnEvent1, you can return to remove device1,
But only in OnEvent1(), when the CWhat internal clock triggers polling and wants to request data from the device, this method is not enough.
This is to keep a reference table inside CWhat, and the clock will trigger the callback of each device. "Bidirectional" means this.
But I am not very willing to use "reference table", because the content of each device is called back differently, it may be called by device1: location, then its speed, and finally its status. CWhat may be required during the call Intersperse other operations to match the return result of device1.
So this situation determines that it is impossible to extract an interface like IDeviceFace for all devices, which cannot be achieved! Ha ha, that is to say
"Reference table" is not something like list<> vector<>, but one by one IDevice1* _dev1; IDevice2* _dev2;...
Something like that.
Imagine the following, so many devices, there are so many interface pointers in CWhat..., alas, this is why I am "very unwilling". |
|