⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ictab4b8.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 5 页
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//*   (c) Copyright Systems Integration Specialists Company, Inc.,       *//*          1996-2002, All Rights Reserved                              *//*                                                                      *//* MODULE NAME : ICTAB4B8.C                                            	*//*                                                                      *//* MODULE DESCRIPTION :                                                 *//*   handle new block 4 and block 8 functions				*//*                                                                      *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE :				*//*				void b4b8RegMsgCB (void);		*//*				void b4DefCond (void);			*//*				void b8DefCond (void);			*//*				void b4RegCondCB (void);		*//*				void b8RegCondCB (void);		*//*				void b4b8SendMsg (void);		*//*									*//*                                                                      *//* MODIFICATION LOG :                                                   *//*  Date     Who   Rev                     Comments                     *//* --------  ---  ------   -------------------------------------------  *//* 08/22/02  nav    09     Fix printf - (Tru64Unix warning)             *//* 02/15/02  EJV    08     Added typecast in ctime.			*//* 05/18/01  nav    07	   block8ConditionsCB - save conditions		*//* 11/29/00  nav    06     Send Block 4 message using a text file	*//* 08/28/00  NAV    05     Add some setup functions			*//* 04/14/99  NAV    04     PowerPlant object corrections		*//* 11/02/98  NAV    03     Check the link on receiveMessageCB		*//* 10/21/98  NAV    02     Add Profile Accounts				*//* 08/06/98  NAV    01     Some casting to please the SUN		*//* 04/09/98  NAV           creation		                        *//************************************************************************/#include "ictamain.h"#include "scrndefs.h"#include "gvaldefs.h"#include "fkeydefs.h"#include "icb4b8msgs.h"static char *thisFileName = __FILE__;static void receiveMessageCB (icMessageStatus status,			      icLinkId        linkId,			      icInt           variableType,			      icMessageId     messageId,			      icBoolean       referIdValid,			      icReferenceId   referenceId,			      icUChar         *message,			      icInt           messageSize,			      icUserData      userData);static void block4ConditionsCB (icLinkId   linkId,			        icBoolean  condition,				icUserData userData);static void block8ConditionsCB (icLinkId   linkId,				icChar     condition,				icUserData userData);static void sendB4Data (int msgType, icLinkId linkId);static void sendSegPrd (int msgType, icLinkId linkId);static void sendPeriodic (int msgType, icLinkId linkId);static void sendSegPrf (int msgType, icLinkId linkId);  static void sendProfile (int msgType, icLinkId linkId);static void sendB8Request (int msgType, icLinkId linkId);static void sendDONewRev (int msgType, icLinkId linkId);static void sendDOCancel (int msgType, icLinkId linkId);static void sendDOActual (int msgType, icLinkId linkId);static void sendPlAvail (int msgType, icLinkId linkId);static void sendPlUnavail (int msgType, icLinkId linkId);static void sendPlStatusAvail (int msgType, icLinkId linkId);static void sendPlStatusUnavail (int msgType, icLinkId linkId);static void sendPlForecast (int msgType, icLinkId linkId);static void sendPlCurve (int msgType, icLinkId linkId);static void sendPlGenDataRpt (int msgType, icLinkId linkId);static void sendPlGenDataRsp (int msgType, icLinkId linkId);static void sendB4TextFile (int msgType, icLinkId linkId, ST_CHAR *textFilename);typedef struct tag_SEND_TBL  {  char *name;  void (*fpSendService) (int msgType, icLinkId linkId);  int constant;  } SEND_TBL;static SEND_TBL ictaB4B8SendTbl[]=  {    {"Block4 Data", 	     sendB4Data,	  IC_MSG_TYPE_B4_DATA},    {"Seg Prd",		     sendSegPrd,	  IC_MSG_TYPE_TA_SEG_PRD},    {"Periodic",	     sendPeriodic,	  IC_MSG_TYPE_TA_PERIODIC},    {"Seg Prf",		     sendSegPrf,	  IC_MSG_TYPE_TA_SEG_PRF},    {"Profile",		     sendProfile,	  IC_MSG_TYPE_TA_PROFILE},    {"B8 Request",	     sendB8Request, 	  IC_MSG_TYPE_B8_REQUEST},    {"DO New",		     sendDONewRev,	  IC_MSG_TYPE_DO_NEW},    {"DO Revised",	     sendDONewRev, 	  IC_MSG_TYPE_DO_REVISED},    {"DO Cancel",	     sendDOCancel,	  IC_MSG_TYPE_DO_CANCEL},    {"DO Actual",	     sendDOActual,	  IC_MSG_TYPE_DO_ACTUAL},    {"Pl Avail",	     sendPlAvail, 	  IC_MSG_TYPE_PL_AVAILABLE},    {"Pl Unavail",	     sendPlUnavail, 	  IC_MSG_TYPE_PL_UNAVAILABLE},    {"Pl RT Status Avail",   sendPlStatusAvail,	  IC_MSG_TYPE_PL_RT_STATUS_AVAIL},    {"Pl RT Status Unavail", sendPlStatusUnavail, IC_MSG_TYPE_PL_RT_STATUS_UNAVAIL},    {"Pl Forecast",	     sendPlForecast,	  IC_MSG_TYPE_PL_FORECAST},    {"Pl Curve",	     sendPlCurve,	  IC_MSG_TYPE_PL_CURVE},    {"Gen Data Report",	     sendPlGenDataRpt,	  IC_MSG_TYPE_GEN_DATA_REPORT},    {"Gen Data Resp",	     sendPlGenDataRsp,	  IC_MSG_TYPE_GEN_DATA_RESPONSE},  };#define NUM_SEND_SERVICES (sizeof (ictaB4B8SendTbl) / sizeof (SEND_TBL))typedef struct tag_RECV_MSG  {  icMessageStatus status;  icLinkId        linkId;  icInt           variableType;  icMessageId     messageId;  icBoolean       referIdValid;  icReferenceId   referenceId;  icUChar         *message;  icInt           messageSize;  icUserData      userData;  } RECV_MSG;static void recvB4Data (RECV_MSG *pstRecvMsg);static void recvSegPrd (RECV_MSG *pstRecvMsg);static void recvPeriodic (RECV_MSG *pstRecvMsg);static void recvSegPrf (RECV_MSG *pstRecvMsg);static void recvProfile (RECV_MSG *pstRecvMsg);static void recvB8Request (RECV_MSG *pstRecvMsg);static void recvDONew (RECV_MSG *pstRecvMsg);static void recvDORevised (RECV_MSG *pstRecvMsg);static void recvDOCancel (RECV_MSG *pstRecvMsg);static void recvDOActual (RECV_MSG *pstRecvMsg);static void recvPlAvail (RECV_MSG *pstRecvMsg);static void recvPlUnavail (RECV_MSG *pstRecvMsg);static void recvPlStatusAvail (RECV_MSG *pstRecvMsg);static void recvPlStatusUnavail (RECV_MSG *pstRecvMsg);static void recvPlForecast (RECV_MSG *pstRecvMsg);static void recvPlCurve (RECV_MSG *pstRecvMsg);static void recvGenDataRpt (RECV_MSG *pstRecvMsg);static void recvGenDataRsp (RECV_MSG *pstRecvMsg);    static void showIccpHeader (icTypeIccpHeader *iccpHdr);static void getHdrData (void);static icInt _hdrRemoteId;static icInt _hdrRequestId;static icInt _hdrDestId;static icInt _hdrRefNum;static icChar _hdrConditions;/************************************************************************//* b4b8RegMsgCB:  register message callbacks 				*//*		  demonstrate usage of icRegisterMessageCallbacks	*//************************************************************************/void b4b8RegMsgCB (void)  {ST_BOOLEAN dataEntered;ST_CHAR    buffer[100];ICTA_REMOTE_INFO *pstRemote;icInt status;  printf("\nEnter Remote Name:  ");    dataEntered = strget(buffer);  if (!dataEntered)    {    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  pstRemote = findRemote(ICTA_CLIENT, buffer);  if (!pstRemote)    {    printf("\nInvalid Remote Name!!!!!\n\n");    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }    status = icRegisterMessageCallbacks (pstRemote->remoteId,  				       receiveMessageCB,                                       (icUserData) pstRemote);  if (status)    {    ICA_Log_Err2("ERROR:  RegisterMessageCallbacks status=%d %s\n",                  status, icPerror (status));    printf ("\nRegisterMessageCallbacks status=%d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0("RegisterMessageCallbacks OK");    printf ("\nRegisterMessageCallbacks successful for %s", pstRemote->remoteName);    }  pause_msg("\nPress a key to continue!");  showCurrMenu();  }/************************************************************************//* b4DefCond:  Define Block 4 Conditions				*//************************************************************************/void b4DefCond (void)  {ST_BOOLEAN dataEntered, bEnable;ST_CHAR    buffer[100];ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO   *pstLink;icInt status;  printf("\nEnter Remote Name:  ");    dataEntered = strget(buffer);  if (!dataEntered)    {    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  pstRemote = findRemote(ICTA_CLIENT, buffer);  if (!pstRemote)    {    printf("\nInvalid Remote Name!!!!!\n\n");    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  pstLink = findOutWhichLink(&pstRemote);  if (!pstLink)    {    printf("\nInvalid Link!!!");    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  printf ("\nEnter E)nable or D)isable:  ");  dataEntered = strget(buffer);  if (!dataEntered)    {    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  if ( (buffer[0] == 'd') || (buffer[0] == 'D') )    bEnable = icFalse;  else if ( (buffer[0] == 'e') || (buffer[0] == 'E') )    bEnable = icTrue;  else    {    printf ("\nInvalid selection %s", buffer);    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  status =icDefineBlock4MessageConditions (pstLink->linkId,					   bEnable);  if (status)    {    ICA_Log_Err2("ERROR:  DefineBlock4MessageCond status=%d %s\n",                  status, icPerror (status));    printf ("\nDefineBlock4MessageCond status=%d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0("DefineBlock4MessageCond OK");    printf ("\nDefineBlock4MessageCond successful for %s", pstRemote->remoteName);    }  pause_msg("\nPress a key to continue!");  showCurrMenu();  }/************************************************************************//* b8DefCond:  Define Block 8 Conditions				*//************************************************************************/void b8DefCond (void)  {ST_BOOLEAN dataEntered;ST_CHAR    buffer[100];ST_UCHAR   hexBuf[100];ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO   *pstLink;icInt status;icChar condition;  printf("\nEnter Remote Name:  ");    dataEntered = strget(buffer);  if (!dataEntered)    {    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  pstRemote = findRemote(ICTA_CLIENT, buffer);  if (!pstRemote)    {    printf("\nInvalid Remote Name!!!!!\n\n");    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  pstLink = findOutWhichLink(&pstRemote);  if (!pstLink)    {    printf("\nInvalid Link!!!");    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  printf("\nEnter Condition in HEX:  ");  dataEntered = input_hex(hexBuf, 1);  if (dataEntered)    condition = hexBuf[0];  else    condition = (char) TAC_ALL;  status =icDefineBlock8MessageConditions (pstLink->linkId,					   condition);  if (status)    {    ICA_Log_Err2("ERROR:  DefineBlock8MessageCond status=%d %s\n",                  status, icPerror (status));    printf ("\nDefineBlock8MessageCond status=%d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0("DefineBlock8MessageCond OK");    printf ("\nDefineBlock8MessageCond successful for %s", pstRemote->remoteName);    }  pause_msg("\nPress a key to continue!");  showCurrMenu();  }/************************************************************************//* b4RegCondCB:  Register Block 4 Conditions Callback			*//************************************************************************/void b4RegCondCB (void)  {ST_BOOLEAN dataEntered;ST_CHAR    buffer[100];ICTA_REMOTE_INFO *pstRemote;icInt status;  printf("\nEnter Remote Name:  ");    dataEntered = strget(buffer);  if (!dataEntered)    {    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  pstRemote = findRemote(ICTA_SERVER, buffer);  if (!pstRemote)    {    printf("\nInvalid Remote Name!!!!!\n\n");    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  status = icRegisterBlock4Conditions (pstRemote->remoteId,  				       block4ConditionsCB,				       (icUserData) pstRemote);  if (status)    {    ICA_Log_Err2("ERROR:  RegisterBlock4CondCallbacks status=%d %s\n",                  status, icPerror (status));    printf ("\nRegisterBlock4CondCallbacks status=%d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0("RegisterBlock4CondCallbacks OK");    printf ("\nRegisterBlock4CondCallbacks successful for %s", pstRemote->remoteName);    }  pause_msg("\nPress a key to continue!");  showCurrMenu();  }/************************************************************************//* b8RegCondCB:  register block 8 condition callback			*//************************************************************************/void b8RegCondCB (void)  {ST_BOOLEAN dataEntered;ST_CHAR    buffer[100];ICTA_REMOTE_INFO *pstRemote;icInt status;  printf("\nEnter Remote Name:  ");    dataEntered = strget(buffer);  if (!dataEntered)    {    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  pstRemote = findRemote(ICTA_SERVER, buffer);  if (!pstRemote)    {    printf("\nInvalid Remote Name!!!!!\n\n");    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  status = icRegisterBlock8Conditions (pstRemote->remoteId,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -