Go to documentation repository
To create an MDL file, use two classes:
The declared classes and methods are contained in the nissdlle.h header file. The code contained in the nissdlle.h file is shown in APPENDIX 2. NissObjectDLLExt and CoreInterface class declarations.
Note:
The methods of the NissObjectDLLExt class are described in the table below.
Method | Description | Example |
CoreInterface* m_pCore | A pointer to the core interface | |
virtual BOOL IsWantAllEvents() | Returns TRUE if the OnEvent function receives events from all objects; returns FALSE if the function receives events from its own object only | If "CAM,GRABBER" is passed as a parameter, when settings of these objects are modified, the DEMO object receives the following messages: DEMO|1|UPDATE_CAM|parameters of the camera DEMO|1|UPDATE_GRABBER|parameters of the video capture card |
virtual CString DescribeSubscribeObjectsList() | The method accepts a comma-separated list of objects. When an object from the list is modified, the current object is notified | |
virtual CString GetObjectType() | Returns the object type | virtual CString GetObjectType() { return "DEMO"; } |
virtual CString GetParentType() | Returns the parent object type | virtual CString GetParentType() { return "SLAVE"; } |
virtual int GetPos() | Returns the position of the object in the psim.sec key file. Attention! This parameter must be set in consultation with AxxonSoft | virtual int GetPos() { return -1; } Note: If Axxon PSIM is run in the demo mode, the function returns -1 |
virtual CString GetPort() | Returns the number of the port used for communication between the object and the core. Attention! This parameter must be set in consultation with AxxonSoft | virtual CString GetPort() { return "1100"; } |
virtual CString GetProcessName() | Returns the process name. Used by the core to search for and automatically run the executable module on startup of the system and initialization of the module | virtual CString GetProcessName() { return "demo"; } |
virtual CString GetDeviceType() | Determines the type of the object and its behavior. ACD – objects of this type receive all events related to the creation, modification, and deletion of the following objects: Users, Time Zone, and Access Levels ACD2 – a type similar to ACD, providing the additional (provided by the core) functionality of deleting temporary (fixed-term) cards The ACR type means that the object is a reader | All objects of the ACR type are available in the Access Point drop-down list |
virtual BOOL HasChild() | Returns TRUE if the object has child objects, FALSE otherwise | virtual BOOL HasChild() { return TRUE; } |
virtual UINT HasSetupPanel() | Returns TRUE if the object has a setup panel, FALSE otherwise | virtual UINT HasSetupPanel() { return TRUE; } |
virtual void OnPanelInit(CWnd*) | Used when the object's setup panel is initialized. The parameter is a pointer to the setup panel's window |
|
virtual void OnPanelLoad(CWnd*,Msg&) | Used when the setup panel is loaded for setting the parameters of the object. The parameters are the setup panel's window and a message used to pass the parameters and fill in the relevant fields of the setup panel | virtual void OnPanelLoad(CWnd* pwnd,Msg& params) { CString s; s = arams.GetParam("port"); pwnd->GetDlgItem(IDC_PORT)-> SetWindowText(s); } |
virtual void OnPanelSave(CWnd*,Msg&) | Used when the setup panel is saved for saving the parameters of the object. The parameters are a pointer to the setup panel's window and a reference to a message used to pass the parameters and save them in a database | virtual void OnPanelSave(CWnd* pwnd,Msg& params) { CString s; pwnd-> GetDlgItem(IDC_PORT)-> GetWindowText(s); params.SetParam("port",s); } |
virtual void OnPanelExit(CWnd*) | Used when the object's setup panel is closed ("exited"). The parameter is a pointer to the setup panel's window |
|
virtual void OnPanelButtonPressed(CWnd*,UINT) | Used to handle clicks on the setup panel's buttons. The parameters are a pointer to the setup panel's window and a button ID. Note: A button ID must be a number equal to or greater than 1151. For example, the Resource.h file defines the ID of the Test button as follows: #define IDC_TEST 1151 | Virtual void OnPanelButtonPressed (CWnd* pwnd,UINT id) { if(id==IDC_TEST) { React react("DEMO",Id,"TEST"); m_pCore->DoReact(react); } } |
If a button click is to open your own dialog box created in the same MDL file, you must first use the code shown in the example below | HINSTANCE prev_hinst = AfxGetResourceHandle(); HMODULE hRes = GetModuleHandle("demo.mdl"); If (hRes) AfxSetResourceHandle (hRes); //Code for showing a dialog box: CXXXDialog dlg; dlg.DoModal(); AfxSetResourceHandle(prev_hinst); | |
virtual BOOL IsRegionObject() | Shows whether the object supports Axxon PSIM's regions. Regions are used to group objects. They can also be used in the report system |
|
virtual BOOL IsProcessObject() | Shows whether the object supports starting and running multiple executable modules simultaneously. For example, this may be used for starting a separate module for each COM port. Note: We recommend using one RUN file. This makes it easier to debug and modify the module |
|
virtual void OnCreate(Msg&) | Used when the object is created. The parameter is a reference to a message that contains object information. The method is also used to set default parameters | virtual void OnCreate (Msg& msg) { msg.SetParam ("port","COM1"); } |
virtual void OnInit(Msg&) | Used when the object is initialized. The parameter is a reference to a message that contains object information | virtual void OnInit (Msg& msg) { OnChange (msg, msg); } |
virtual void OnChange(Msg&,Msg&) | Used when the object is changed. The first and second parameters are references to messages that contain object information before and after the change, respectively | virtual void OnChange(Msg& msg, Msg& prev) { React react (msg.GetSourceType(), msg.GetSourceId(),"INIT"); react.SetParam("port",msg.GetParam("port")); m_pCore->DoReact(react); } |
virtual void OnDelete(Msg&) | Used when the object is deleted. The parameter is a reference to a message that contains object information | virtual void OnDelete (Msg& msg) { React react (msg.GetSourceType(), msg.GetSourceId(),"EXIT"); m_pCore-> DoReact(react); } |
virtual void OnEnable(Msg&) | Used to handle clicks on the Disable button of Axxon PSIM's panel when the object is enabled. The parameter is a reference to a message that contains object information |
|
virtual void OnDisable(Msg&) | Used to handle clicks on the Disable button of Axxon PSIM's panel when the object is disabled. The parameter is a reference to a message that contains object information |
|
virtual BOOL OnEvent(Event&) | Used to handle the events that are passed as the parameter | virtual BOOL OnEvent(Event& event) { If (event.GetAction() == "ACCESS_IN" || event.GetAction() == "ACCESS_OUT") { Msg per = m_pCore-> FindPersonInfoByCard(event.GetParam("facility_code"), event.GetParam("card")); event.SetParam ("param0", !per.GetSourceId().IsEmpty() ? per.GetParam("name") : event.GetParam("facility_code") + event.GetParam("card")); event.SetParam("param1", per.GetSourceId() ); } Else If (event.GetAction() == "NOACCESS_CARD") { event.SetParam ("param0",event.GetParam("facility_code") + event.GetParam("card")); } return TRUE; } |
virtual BOOL OnReact(React&) | Used to handle the reactions that are passed as the parameter |
|
The CreateNissObject(CoreInterface* core) global function creates instances of the described objects, places them in an array (an instance of CNissObjectDLLExtArray), and returns a pointer to this array. This function is used to receive a pointer to the core interface. This pointer is later used by objects to call interface methods:
CNissObjectDLLExtArray* APIENTRY CreateNissObject(CoreInterface* core) { CNissObjectDLLExtArray* ar = new CNissObjectDLLExtArray; ar->Add(new NissObjectDemo(core)); ar->Add(new NissObjectDemoDevice(core)); return ar; }
After loading a DDL file, the core calls the CreateNissObject function and receives pointers to all the objects in use.
All object setup panels are stored in resources as dialogs. Each dialog ID has the format IDD_object_SETUP, where object is the name of the corresponding object. For example, the ID of the DEMO object is IDD_DEMO_SETUP, and the ID of the DEMO_DEVICE object is IDD_DEMO_DEVICE _SETUP.
Note: