Step 4: Adding A-functions
|Top Previous Next|
This step corresponds to test_agg_lib_4.
A-functions are methods that the AggreGate server can execute on the device. In our access control project, we will add an "open door" A-function which will be used for remote unlocking of the door. This A-function will have an argument — for how long the door will have to remain unlocked.
The A-function's argument will be of an overriding nature. When set to 0, it will have no effect and the door will be unlocked for the period of time specified by the UT A-variable. When not zero, the argument will override the UT A-variable once.
1. Aggregate.xtxt now contains the UL A-function.
2. Callback_agg_device_function() implements necessary code for executing the UL A-function.
3. Notice how Agg_record_decode() is used to extract the argument of the A-function.
4. Agg_record_encode() is used to return A-function value to the AggreGate server. The value is always "success" in our case.
Single-click on the device in the AggreGate tree, and locate Unlock the Door in the Related Actions pane below. Click Unlock the Door, and you will get a dialog requesting Door Unlock Duration. Input a value, press OK. The function will be executed and return Success.
Of course, there is no code (yet) that actually unlocks the door. We will take care of this later.