
DCN Next Generation Open Interface Release 2.4 Voting
en | 200
Bosch Communications Systems | 2007 February | SRS_VTINF | Du040905
For controlling the time mechanism and the interaction with the operator we use another two
external functions. The first function returns TRUE when a second has passed and the second
function returns TRUE when the operator has decided to stop the vote-round.
Another external function is assumed to store the voting result. This function accepts the voting
results as used for collecting the results from the CCU.
The function declarations are:
extern BOOLEAN MyFunction_GetSubject (WORD *wVotingNumber, CHAR *szSubject);
extern BOOLEAN MyFunction_SecondTick (void);
extern BOOLEAN MyFunction_OkToStopVoting (void);
extern void MyFunction_StoreResults (VT_T_RESULT_REC *tResults);
Because we are going to run multiple voting rounds, we must set up a looping mechanism:
VT_T_SUBJECT_REC tSubject;
VT_T_RESULT_REC tResults;
/* start the loop to run all voting rounds */
while (MyFunction_GetSubject (tSubject.wVotingNumber, tSubject.szVotingSubject))
{
We have now received the voting number and the voting subject. All we have to do is extend the
structure with the legend and pass the information to the CCU.
strcpy (tSubject.szLegendSubject, “Voting”);
wError = VT_DownloadSubject (&tSubject);
If (wError != VT_E_NOERROR)
{
/* do error handling */
}
The subject is downloaded to the CCU. The CCU is now ready to start this voting round.
Let’s start the voting.
wError = VT_StartVoting (); /* no parameters */
If (wError != VT_E_NOERROR)
{
/* do error handling */
}
The voting round is running.
During the run of the vote round the program must wait for the operator to stop the voting. In the
mean time we collect the voting results from the CCU and store them.
while ( ! MyFunction_OkToStopVoting ())
{
if (MyFunction_SecondTick ())
{
/* collect the interim results */
wError = VT_GetResults (&tResults);
If (wError != VT_E_NOERROR)
{
/* do error handling */
}
/* store the results */
MyFunction_StoreResults (&tResults);
}
}
Note that after the collection of the results the voting-number present in the result-structure
should be the same as set during the download of the subject.
The vote round should be finished by stopping the VT application on the CCU. We do not allow
that the results are shown on the units LCD’s, so no show-results.
wError = VT_StopVoting (FALSE); /* no parameters */
If (wError != VT_E_NOERROR)
{
/* do error handling */
}
After successful completion the final results are ready on the CCU to be collected. Note that the
CCU sends an update notification with the final results (if activated). But in this example we have
stated that we do not use the update notifications. Therefore we collect the final result using the
remote function.
Kommentare zu diesen Handbüchern