@@ -65,10 +65,8 @@ interrogationHandler(void* parameter, IMasterConnection connection, CS101_ASDU a
6565{
6666 printf ("Received interrogation for group %i\n" , qoi );
6767
68- CS101_ASDU_clone (asdu , NULL );
69-
70- if (qoi == 20 ) { /* only handle station interrogation */
71-
68+ if (qoi == 20 ) /* only handle station interrogation */
69+ {
7270 CS101_AppLayerParameters alParams = IMasterConnection_getApplicationLayerParameters (connection );
7371
7472 IMasterConnection_sendACT_CON (connection , asdu , false);
@@ -143,7 +141,8 @@ interrogationHandler(void* parameter, IMasterConnection connection, CS101_ASDU a
143141
144142 IMasterConnection_sendACT_TERM (connection , asdu );
145143 }
146- else {
144+ else
145+ {
147146 IMasterConnection_sendACT_CON (connection , asdu , true);
148147 }
149148
@@ -291,26 +290,22 @@ main(int argc, char** argv)
291290 {
292291 Thread_sleep (1000 );
293292
294- // CS101_ASDU newAsdu = CS101_ASDU_create(alParams, false, CS101_COT_PERIODIC, 0, 1, false, false);
293+ CS101_ASDU newAsdu = CS101_ASDU_create (alParams , false, CS101_COT_PERIODIC , 0 , 1 , false, false);
295294
296- // InformationObject io = (InformationObject) MeasuredValueScaled_create(NULL, 110, scaledValue, IEC60870_QUALITY_GOOD);
295+ InformationObject io = (InformationObject ) MeasuredValueScaled_create (NULL , 110 , scaledValue , IEC60870_QUALITY_GOOD );
297296
298- // scaledValue++;
297+ scaledValue ++ ;
299298
300- // CS101_ASDU_addInformationObject(newAsdu, io);
301-
302- // InformationObject_destroy(io);
299+ CS101_ASDU_addInformationObject (newAsdu , io );
303300
304- // /* Add ASDU to slave event queue */
305- // CS104_Slave_enqueueASDU(slave, newAsdu);
301+ InformationObject_destroy (io );
306302
307- // CS101_ASDU_destroy(newAsdu);
303+ /* Add ASDU to slave event queue */
304+ CS104_Slave_enqueueASDU (slave , newAsdu );
308305
309- // if (connected)
310- // break;
306+ CS101_ASDU_destroy (newAsdu );
311307 }
312308
313-
314309 Thread_sleep (1000 );
315310 printf ("Stopping server\n" );
316311 CS104_Slave_stop (slave );
0 commit comments