Bosch Appliances THE DCN Home Security System User Manual


 
SC & SI Remote Interface Description en | 27
Bosch Security Systems B.V. | 2003 December | SC & SI Remote Interface Description
APPENDIX C. EXAMPLES
In the examples below the remote functions and update notifications, that are defined in this document as
constant values for the wFnId parameter of the message (see [SRS_INF]), are presented as functions
described in a ‘C’ syntax. The parameter structures of these functions are according the input, output or notify
structures described in the appropriate section.
For every function is assumed that the function will create his structure, transport the parameters to the CCU
and waits for the result information coming from the CCU.
For both the remote functions as the update notifications the same names are used as their identifier, but
without the constant mark “C” and using mixed case names. So, e.g. remote function
SC_C_CONNECT_UNIT shall be referenced as function as:
SC_Connect_Unit (SC_T_UNIT_DATA tUnitData);
C.1. Assigning seats using global installation
This example shows how the remote controller can assign his seats to the unit-numbers present in the
conference hall.
Assumed is that the conference hall has a number of seats numbered starting with 1. For this proposed
installation one person must walk through the conference hall and press one of the soft-keys on the units in
order of the seats (starting with seat 1). On each unit a soft-key is only pressed once.
For this seat assignment the global installation mode of the CCU will be used. therefore we start with
activating that mode.
error = SI_Start_Install (SI_C_GLOBAL_INSTALL_MODE);
if (error != SI_E_NOERROR)
{
/* do error handling */
}
After this function the CCU is in global installation mode, all displays are off and no applications are running.
We now initialise the current seat and unit-number, assuming seatnumbers are chosen to be purely numeric:
wCurrentSeatNumber = 1;
The system is now ready to accept the key-presses on the units in order of the seats. When a soft-key is
pressed the CCU sends a notification. During the processing of that function we select the unit where the key
is pressed, and assign the current seat number to the provided unit number.
This result in the following function:
void SI_Register_Unit (SI_T_UNIT_STRUCT *tUnitStruct)
{
/* First turn off the previous selected unit */
/* ........ */
error = SI_Select_Unit (tUnitStruct->wUnitId, TRUE);
if (error != SI_E_NOERROR)
{
/* do error handling */
}
/* assign the current seat to the unit */
MyAssignSeat (wCurrentSeatNumber, tUnitStruct->wUnitId);
/* Increment to the next seat */
wCurrentSeatNumber = wCurrentSeatNumber + 1;
/* and save the unitId to turn off during the assignment of the next seat */
/* ........ */
}
Note that this function is only an example to shown how the interaction between update notifications and
remote functions can appear. For instance, when you press a soft-key the second time, this function will fail.
Better is to look if the selected unit has already a seat assigned. If not, the assign and increment, if assigned,
just keep the assignment.
When done with all seats present in the conference hall, we can leave the global installation mode. This is
done using the following sequence:
/* first turn off the last selected unit */
/* ........ */
error = SI_Stop_Install ();