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

📄 icta_var.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 5 页
字号:
  if (rtned != SD_SUCCESS)    {    printf("Unable to add variable '%s'.\n", pstVar->varName);    printf("See Log file for Details.\n");    chk_free(pstVar);    }  pause_msg("Press a key to continue!\n");  showCurrMenu();  }/************************************************************************//* readVarTypes:  get variable type via icReadVariableType		*//************************************************************************/ST_VOID readVarTypes (ST_VOID)  {ICTA_LINK_INFO *pstLink;ICTA_REMOTE_INFO *pstRemote;ST_BOOLEAN dataEntered;ST_CHAR buffer[100];ST_CHAR varName[MAX_ID_LEN];icInt status, scope;ST_BOOLEAN bIsClient = SD_FALSE;  printf("\n\nRead Variable Types . . .\n");  pstRemote = pstVCC->remoteList;  while (pstRemote && !bIsClient)    {    bIsClient = pstRemote->bIsClient;    pstRemote = (ICTA_REMOTE_INFO *) list_get_next		((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote);    }      if (!bIsClient)    {    printf("Client not defined - read variable types option not available.\n");    pause_msg("Press a key to continue!\n");    showCurrMenu();    return;    }  pstRemote = pstVCC->remoteList;  pstLink = findOutWhichLink(&pstRemote);  if (!pstLink)    {    printf ("Invalid LinkName");    pause_msg("Press a key to continue!\n");    showCurrMenu();    return;    }  printf("\nEnter Variable Name:  ");  dataEntered = strget(varName);  if (!dataEntered)    {    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  printf("\nEnter V=VMD Scope or D=Domain Scope:  ");  dataEntered = strget(buffer);  if (!dataEntered || ( (buffer[0]!='V') && (buffer[0]!='D') ) )    {    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  if (buffer[0] == 'D')    scope = IC_SCOPE_DOMAIN;  else    scope = IC_SCOPE_VMD;  status = icReadVariableType(pstLink->linkId, scope, varName, readTypeCallBack);  if (status)    {    printf("Read Variable Type Failed - see log file for details.\n");    ICA_Log_Err2("ERROR:  ReadVariableType status = %d %s",                  status, icPerror(status));    ICA_Log_ErrC2("       Link = %s, Var=%s", pstLink->linkName, varName);    }  }/************************************************************************//* readVarNames:  get server var names via icReadVariableNames		*//************************************************************************/ST_VOID readVarNames (ST_VOID)  {ICTA_LINK_INFO *pstLink;ICTA_REMOTE_INFO *pstRemote;ST_BOOLEAN dataEntered;ST_CHAR buffer[100];ST_CHAR varName[MAX_ID_LEN];icInt status, scope;ST_BOOLEAN bIsClient = SD_FALSE;  varName[0] = '\0';  printf("\n\nRead Variable Names . . .\n");   pstRemote = pstVCC->remoteList;  while (pstRemote && !bIsClient)    {    bIsClient = pstRemote->bIsClient;    pstRemote = (ICTA_REMOTE_INFO *) list_get_next		((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote);    }  if (!bIsClient)    {    printf("Client not defined - read variable names option not available.\n");    pause_msg("Press a key to continue!\n");    showCurrMenu();    return;    }  pstRemote = pstVCC->remoteList;  pstLink = findOutWhichLink(&pstRemote);  if (!pstLink)    {    printf ("Invalid LinkName");    pause_msg("Press a key to continue!\n");    showCurrMenu();    return;    }  printf("\nEnter Start After Variable Name:  ");  dataEntered = strget(varName);  printf("\nEnter V=VMD Scope or D=Domain Scope:  ");  dataEntered = strget(buffer);  if (!dataEntered || ( (buffer[0]!='V') && (buffer[0]!='D') ) )    {    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  if (buffer[0] == 'D')    scope = IC_SCOPE_DOMAIN;  else    scope = IC_SCOPE_VMD;  status = icReadVariableNames(pstLink->linkId, scope, varName, readNamesCallBack);  if (status)    {    printf("Read Variable Names Failed - see log file for details.\n");    ICA_Log_Err2("ERROR:  ReadVariableNames status = %d %s",                  status, icPerror(status));    ICA_Log_ErrC2("       Link = %s, Var=%s", pstLink->linkName, varName);    }  }/************************************************************************//* readVar:  read a variable via icReadVariable				*//************************************************************************/ST_VOID readVar (ST_VOID)  {ICTA_LINK_INFO *pstLink;ICTA_REMOTE_INFO *pstRemote;ICTA_VAR_INFO *pstVar;icInt status;ST_BOOLEAN bIsClient = SD_FALSE;  printf("\n\nRead Variable  . . .\n");  pstRemote = pstVCC->remoteList;  while (pstRemote && !bIsClient)    {    bIsClient = pstRemote->bIsClient;    pstRemote = (ICTA_REMOTE_INFO *) list_get_next		((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote);    }  if (!bIsClient)    {    printf("Client not defined - read option not available.\n");    pause_msg("Press a key to continue!\n");    showCurrMenu();    return;    }  pstRemote = pstVCC->remoteList;  pstLink = findOutWhichLink(&pstRemote);  if (!pstLink)    {    printf ("Invalid LinkName");    pause_msg("Press a key to continue!\n");    showCurrMenu();    return;    }  pstVar = findOutWhichVar(pstRemote, ICTA_CLIENT);  if (pstVar)    {    printf("*** Read Variable Data for %s:  \n", pstVar->varName);    printf("\tCurrent Value:");    showVarValue(pstVar);    startInterval();		/* set a start time	*/    bTimedRead = icTrue;    status = icReadVariable(pstVar->varId, pstLink->linkId);    if (status)      {      printf("Read Variable Failed - see log file for details.\n");      ICA_Log_Err2("ERROR:  ReadVariable status = %d %s",                    status, icPerror(status));      ICA_Log_ErrC2("       Link = %s, Var=%s", pstLink->linkName, pstVar->varName);      }    else      {      printf ("Read Request for Variable %s issued\n", pstVar->varName);      ICA_Log_Flow1 ("Read Request for Variable %s issued", pstVar->varName);      }    }  else    printf("Variable Not Found!\n");  }/************************************************************************//* writeVar:  issue write request to server via icWriteVariable		*//************************************************************************/ST_VOID writeVar (ST_VOID)  {ICTA_LINK_INFO *pstLink;ICTA_REMOTE_INFO *pstRemote;ICTA_VAR_INFO *pstVar;ST_BOOLEAN dataEntered;ST_CHAR buffer[100];ST_UCHAR flagBuf[100];icInt status;ST_BOOLEAN bIsClient = SD_FALSE;  printf("\n\nWrite Variable  . . .\n");  pstRemote = pstVCC->remoteList;  while (pstRemote && !bIsClient)    {    bIsClient = pstRemote->bIsClient;    pstRemote = (ICTA_REMOTE_INFO *) list_get_next		((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote);    }  if (!bIsClient)    {    printf("Client not defined - write option not available.\n");    pause_msg("Press a key to continue!\n");    showCurrMenu();    return;    }  pstRemote = pstVCC->remoteList;  pstLink = findOutWhichLink(&pstRemote);  if (!pstLink)    {    printf ("Invalid LinkName");    pause_msg("Press a key to continue!\n");    showCurrMenu();    return;    }  pstVar = findOutWhichVar(pstRemote, ICTA_CLIENT);  if (pstVar)    {    printf("\nEnter New Value:  ");    dataEntered = strget(buffer);    if (!dataEntered)      {      pause_msg("\nPress a key to continue!");      showCurrMenu();      return;      }    printf("\nEnter Flag Value:  ");    dataEntered = input_hex(flagBuf, 1);    printf("\n");    updateData(pstVar, buffer, flagBuf);#ifdef SISCO_THREADS    ICA_Log_Flow0 ("Calling icWriteVariableEx");    status = icWriteVariableEx (pstVar->varId, pstLink->linkId,     				pstVar->extraPtr);#else    status = icWriteVariable(pstVar->varId, pstLink->linkId);#endif    if (status)      {      printf("Write Variable Failed - see log file for details.\n");      ICA_Log_Err2("ERROR:  WriteVariable status = %d %s",                    status, icPerror(status));      ICA_Log_ErrC2("       Link = %s, Var=%s", pstLink->linkName, pstVar->varName);      }    else      {      printf ("Write Request for Variable %s issued", pstVar->varName);      ICA_Log_Flow1 ("Write Request for Variable %s issued", pstVar->varName);      }    }  else    printf("Variable Not Found!\n");  pause_msg("\nPress a key to continue!");  showCurrMenu();  }/************************************************************************//* readLocal:  read local value of a variable 				*//************************************************************************/ST_VOID readLocal (ST_VOID)  {ICTA_LINK_INFO *pstLink;ICTA_REMOTE_INFO *pstRemote;ICTA_VAR_INFO *pstVar;int todo;  printf("\n\nRead Local Variable  . . .\n");  todo = findOutWho();  if ( (todo == ICTA_CLIENT) || (todo == ICTA_BOTH) )    {    printf("Client Variable . . .\n");    pstRemote = pstVCC->remoteList;    pstLink = findOutWhichLink(&pstRemote);    if (!pstLink)      {      printf ("Invalid LinkName");      pause_msg("Press a key to continue!\n");      showCurrMenu();      return;      }    pstVar = findOutWhichVar(pstRemote,ICTA_CLIENT);    if (pstVar)      {      printf("*** Read LOCAL Client Variable Data for %s:  \n", pstVar->varName);      printf("Local Value:  ");      showVarValue(pstVar);      }    else      printf("Client Variable Not Found!\n");    }  if ( (todo == ICTA_SERVER) || (todo == ICTA_BOTH) )    {    printf("Server Variable . . .\n");    pstRemote = pstVCC->remoteList;    pstLink = findOutWhichLink(&pstRemote);    if (!pstLink)      {      printf ("Invalid LinkName");      pause_msg("Press a key to continue!\n");      showCurrMenu();      return;      }    pstVar = findOutWhichVar(pstRemote, ICTA_SERVER);    if (pstVar)      {      printf("*** Read LOCAL Server Variable Data for %s:  \n", pstVar->varName);      printf("Local Value:  ");      showVarValue(pstVar);      }    else      printf("Server Variable Not Found!\n");    }  pause_msg("Press a key to continue!\n");  showCurrMenu();  }/************************************************************************//* writeLocal:  Modify the local value of a variable			*//************************************************************************/ST_VOID writeLocal (ST_VOID)  {ICTA_LINK_INFO *pstLink;ICTA_REMOTE_INFO *pstRemote;ICTA_VAR_INFO *pstVar;ST_BOOLEAN dataEntered;ST_CHAR buffer[100];ST_UCHAR flagBuf[100];int todo;  printf("\n\nWrite LOCAL Variable  . . .\n");  todo = findOutWho();  if ( (todo == ICTA_CLIENT) || (todo == ICTA_BOTH) )    {    printf("Local Client Variable . . . \n");    pstRemote = pstVCC->remoteList;    pstLink = findOutWhichLink(&pstRemote);    if (!pstLink)      {      printf ("Invalid LinkName");      pause_msg("Press a key to continue!\n");      showCurrMenu();      return;      }    pstVar = findOutWhichVar(pstRemote, ICTA_CLIENT);    if (pstVar)      {      printf("\nEnter New Value:  ");      dataEntered = strget(buffer);      if (dataEntered)        {        printf("\nEnter Flag Value:  ");        dataEntered = input_hex(flagBuf, 1);        printf("\n");        updateData(pstVar, buffer, flagBuf);	}      }    else      printf("Variable Not Found!\n");

⌨️ 快捷键说明

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