[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference azur::mcc

Title:DECmcc user notes file. Does not replace IPMT.
Notice:Use IPMT for problems. Newsletter location in note 6187
Moderator:TAEC::BEROUD
Created:Mon Aug 21 1989
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:6497
Total number of notes:27359

1354.0. "Q : Event Manager & Callable MCC !..." by TENERE::HAYES (A European Telecomet ...) Tue Aug 20 1991 07:59

Hello, 

I have some problems with the event manager used from two callable
MCC programs.

Can someone explain the problem or is this an MCC callable
interface known limitation ?

Thanks for any hint...

I have a version of the event_put/get in a yourmm context i.e I put the 
event_put in the set directive, and the event_get in the show directive.
This code is working.

I tried to split this code in separate modules using the calable MCC, 
but I have some problems.

I got the error message MCC_S_INV_DESC in the event_get routine.
However, I think the problem might be a memory allocation problem.


1) Is memory allocation used properly?

2) I am allocating 128 bytes for the 'event_report' in the put routine.
   Is the event report limited to 128 bytes?

Here is a copy of my MSL code for the 'CRYSTAL 0' entity:

       EVENT PARTITION CONFIGURATION = 15 :
             (* EVENT PARTITION *)

         EVENT Crystal error = 11 :
           DISPLAY = TRUE,
           SYMBOL = CRYSTAL_ERROR,
           TEXT = "Error on CRYSTAL",
           ARGUMENT Bit error rate = 22 : Integer32
             DISPLAY = TRUE,
             UNITS = "bit per bit",
             SYMBOL = BER
           END ARGUMENT Bit error rate;
         END EVENT Crystal error;
       END EVENT PARTITION CONFIGURATION; (* EVENT PARTITION *)

The event_put and event_get routines follow ...

1) MCC_EVENT_PUT using callable MCC :


/* PROG- */

#include <ssdef.h>
#include <stddef.h>
#include <mcc_descrip.h>
#include <stsdef.h>e
#include <mcc_interface_def.h>
#include <mcc_vea_def.h>
#include <mcc_msg>
#include "mcc_desframe.h"
#include "<-.crystal>MCC_CRYSTAL_AM_SRVC_IF.H" 
#include <mcc_fm_alarms_svc_if.h>

main()

{
   MCC_A_AES                    in_entity;
   MCC_A_TIMEFRAME              time_spec;
   MCC_A_AES                    out_entity;
   MCC_T_Descriptor             time_stamp;
   MCC_T_Descriptor             in_instance;

   MCC_T_Descriptor             event_report;
   MCC_T_Descriptor             arg_desc;
   unsigned long int            status ;
   static int                   event_code = { 11 };
   static int                   configuration_event = { 
MCC_K_PRT_CONFIGURATION_EVENTS };
   unsigned long int            event_val;
   struct MCC_R_ILV_CONTEXT     ctx;
   int                          wild_type;
   MCC_T_Unsigned32             id_buffer;
   MCC_T_Unsigned32             class;
   MCC_T_Unsigned32             IdCode;
   MCC_T_Unsigned32             Mode; 
   char                         buffer[500];


   /* Populate the entity descriptor... */
   in_instance.mcc_w_maxstrlen = in_instance.mcc_w_curlen = 
sizeof(MCC_T_UNSLONG);                                                    
   in_instance.mcc_b_class = DSC_K_CLASS_S;
   in_instance.mcc_a_pointer = &id_buffer;
   in_instance.mcc_b_flags = 0;
   in_instance.mcc_b_ver = MCC_K_VER_DESCRIPTOR;
   in_instance.mcc_l_id = 0;
   in_instance.mcc_l_dt = MCC_K_DT_UNSIGNED32;
   in_instance.mcc_a_link = MCC_K_NULL_PTR;

   /* Set entity... */
   class = MCC_K_CLASS_CRYSTAL;
   id_buffer = 0;
   wild_type = MCC_K_AES_NOT_WILD;
   in_entity = MCC_K_NULL_PTR;

   status = mcc_aes_create(&in_entity, &class, &in_instance, &wild_type);

   /* Descriptor for the event report... */
   event_report.mcc_w_maxstrlen = event_report.mcc_w_curlen = 128;
   event_report.mcc_b_dtype = 0;
   event_report.mcc_b_class = DSC_K_CLASS_S; 
   event_report.mcc_a_pointer = &buffer; 
   event_report.mcc_b_flags = 0;
   event_report.mcc_b_ver = 1;
   event_report.mcc_l_id = MCC_K_EVENT_RECEIVED;  
   event_report.mcc_l_dt = MCC_K_DT_ILV; 
   event_report.mcc_a_link = MCC_K_NULL_PTR;

   /* Begin building for Event Mgr */
   if(status == MCC_S_NORMAL)
      status = mcc_ilv_put_param_begin(&ctx, &event_report);              
    
   Mode = MCC_K_ILV_NATIVE_VALUE; 

   /* Begin Constructor, Id = Reply-Argument Id Value */
   IdCode =   MCC_K_ARG_EVENT_REPORT;
   if(status == MCC_S_NORMAL)
      status = mcc_ilv_put_cons_begin(&ctx,  &IdCode,  
                        &MCC_K_NULL_PTR, &MCC_K_NULL_PTR, &Mode);

   if(status == MCC_S_NORMAL) 
      status = mcc_ilv_put_cons_begin(&ctx, &event_code,
                           &MCC_K_NULL_PTR, &MCC_K_NULL_PTR, &Mode);
    
   event_val = 42;
   arg_desc.mcc_w_maxstrlen = arg_desc.mcc_w_curlen = 4;
   arg_desc.mcc_b_class = DSC_K_CLASS_S; 
   arg_desc.mcc_b_dtype = DSC_K_DTYPE_LU;  
   arg_desc.mcc_a_pointer = &event_val;
   arg_desc.mcc_l_dt = MCC_K_DT_UNSIGNED32;
   arg_desc.mcc_b_ver = 1;
   arg_desc.mcc_b_flags = 0;
   arg_desc.mcc_l_id = 22; 
      

   if(status == MCC_S_NORMAL)
      status = mcc_ilv_put(&ctx, &arg_desc, MCC_K_NULL_PTR );  
    
   if(status == MCC_S_NORMAL)
      status = mcc_ilv_put_cons_end(&ctx); 

   /* End Constructor */
   if(status == MCC_S_NORMAL)
      status = mcc_ilv_put_cons_end(&ctx);
    
   /* End building attr Output */
   if(status == MCC_S_NORMAL)
      status = mcc_ilv_put_param_end(&ctx, &event_report);
    
   if(status == MCC_S_NORMAL)
            mcc_ilv_dump(&event_report );
         
   if(status == MCC_S_NORMAL)     
          status = mcc_time_create(&time_stamp, &MCC_K_DT_BIN_ABS_TIM, 0, 0);

   if(status == MCC_S_NORMAL)     
      status = mcc_time_get_current(time_stamp);

   if(status == MCC_S_NORMAL)     
      status = mcc_event_put (in_entity,
                              &configuration_event,
                              &event_code,  
                              &event_report,
                              time_stamp);
    
  exit();
}


2) MCC_EVENT_GET using CALLABLE MCC :




/* PROG- */

#include <ssdef.h>
#include <stddef.h>
#include <mcc_descrip.h>
#include <stsdef.h>e
#include <mcc_interface_def.h>
#include <mcc_vea_def.h>
#include <mcc_msg>
#include "mcc_desframe.h"
#include "<-.crystal>MCC_CRYSTAL_AM_SRVC_IF.H" 
#include <mcc_fm_alarms_svc_if.h>

main()

{
   MCC_A_AES                    in_entity;
   MCC_A_TIMEFRAME              time_spec;
   MCC_A_AES                    out_entity;
   MCC_T_Descriptor             in_instance;
   MCC_T_Descriptor             time_stamp;
   MCC_T_Descriptor             event_report;
   unsigned long int            status ;
   static int                   event_code = { 11 };
   static int                   configuration_event = { 
MCC_K_PRT_CONFIGURATION_EVENTS };
   MCC_A_HANDLE                 handle;
   int                          wild_type;
   MCC_T_Unsigned32             id_buffer;
   MCC_T_Unsigned32             class;
   char                         event_store[2000];

   /* Instance descriptor... */
   in_instance.mcc_w_maxstrlen = in_instance.mcc_w_curlen = 
sizeof(MCC_T_UNSLONG);                                                    
   in_instance.mcc_b_ver = MCC_K_VER_DESCRIPTOR;
   in_instance.mcc_b_flags = 0;
   in_instance.mcc_b_class = DSC_K_CLASS_S;
   in_instance.mcc_l_id = 0;
   in_instance.mcc_l_dt = MCC_K_DT_UNSIGNED32;
   in_instance.mcc_a_link = MCC_K_NULL_PTR;
   in_instance.mcc_a_pointer = &id_buffer;

   /* Entity definition... */
   class = MCC_K_CLASS_CRYSTAL;
   id_buffer = 0;
   wild_type = MCC_K_AES_NOT_WILD;
   in_entity = MCC_K_NULL_PTR;

   status = mcc_aes_create(&in_entity, &class, &in_instance, &wild_type);

   out_entity = MCC_K_NULL_PTR;
   if(status == MCC_S_NORMAL)     
      status = mcc_aes_copy(&in_entity, &out_entity);

   /* Descriptor for the event report... */
   event_report.mcc_w_maxstrlen = 500;
   event_report.mcc_b_dtype = 0;
   event_report.mcc_b_ver = MCC_K_VER_DESCRIPTOR;
   event_report.mcc_b_flags = 0;
   event_report.mcc_b_class = DSC_K_CLASS_S; 
   event_report.mcc_w_curlen = 0;
   event_report.mcc_l_id = MCC_K_EVENT_RECEIVED;  
   event_report.mcc_l_dt = MCC_K_DT_ILV; 
   event_report.mcc_a_link = MCC_K_NULL_PTR;
   event_report.mcc_a_pointer = &event_store; 

   if(status == MCC_S_NORMAL)     
      status = mcc_time_create(&time_stamp,
                               &MCC_K_DT_BIN_ABS_TIM,
                               0, 0);

   if(status == MCC_S_NORMAL)     
      status = mcc_ahs_create(&handle); 
      *handle = MCC_K_HANDLE_FIRST;

   if(status == MCC_S_NORMAL)     
      status = mcc_event_get (in_entity,            /* Entity Spec...        */
                              &configuration_event, /* Event Partition...    */
                              MCC_K_NULL_PTR,       /* Event Filter...       */
                              MCC_K_NULL_PTR,       /* Time frame = NEXT...  */
                              handle,               /* Handle flag...        */
                              out_entity,           /* Out Entity...         */
                              time_stamp,           /* Time Stamp...   ????  */
                              &event_code,          /* Event Code...         */
                              &event_report);       /* Event Report...       */

   printf("Status = %d\n", status);

   if(status == MCC_S_NORMAL)
            mcc_ilv_dump(&event_report );

  exit();
}


        	Best Regards


				Catherine
	
T.RTitleUserPersonal
Name
DateLines
1354.1Please turn on event tracingTOOK::GUERTINDon't fight fire with flamesTue Aug 20 1991 17:0619
    Catherine,
    
    Callable MCC should work the same.  The only real difference to an
    application, is that with regular MCC, the MCC Kernel provides a more
    "sanitary" environment for MCC to start up in.  With callable MCC, the
    MCC Kernel starts up when you make the first MCC routine call, and MCC
    has no control over what the execution environment is like at that
    point.  This sometimes results in slightly different behavior, but it
    is due to the application, not MCC.
    
    To trace what the MCC Event Manager is seeing, define two logicals
    $ define MCC_EVENT_LOG 1
    $ define MCC_EVENT_TRACE 180
    and re-run your application.  Hopefully, it will give some indication
    of which parameter (to mcc_event_get or mcc_event_put) it is declaring
    invalid.
    
    Thanks,
    -Matt.