pvbrowser manual
Back Content Forward

main.cpp

//***************************************************************************
//                          main.cpp  -  description
//                             -------------------
//  begin            : Do Apr 12 12:10:56 2007
//  generated by     : pvdevelop (C) 2000-2007 by Lehrig Software Engineering
//  email            : lehrig@t-online.de
//***************************************************************************
#include "pvapp.h"
// todo: comment me out. you can insert these objects as extern in your masks.
//rlModbusClient     modbus(modbusdaemon_MAILBOX,modbusdaemon_SHARED_MEMORY,modbusdaemon_SHARED_MEMORY_SIZE);
//rlSiemensTCPClient siemensTCP(siemensdaemon_MAILBOX,siemensdaemon_SHARED_MEMORY,siemensdaemon_SHARED_MEMORY_SIZE);
//rlPPIClient        ppi(ppidaemon_MAILBOX,ppidaemon_SHARED_MEMORY,ppidaemon_SHARED_MEMORY_SIZE);

rlEIBnetIP eib(EIB_MAXSIGNALS);
rlIpAdr client;
rlIpAdr server;

int pvMain(PARAM *p)
{
int ret;

  pvSetCaption(p,"pvs");
  pvResize(p,0,1280,1024);
  //pvScreenHint(p,1024,768); // this may be used to automatically set the zoomfactor
  ret = 1;
  pvGetInitialMask(p);
  if(strcmp(p->initial_mask,"mask1") == 0) ret = 1;

  while(1)
  {
    switch(ret)
    {
      case 1:
        pvStatusMessage(p,-1,-1,-1,"mask1");
        ret = show_mask1(p);
        break;
      default:
        return 0;
    }
  }
}

#ifdef USE_INETD
int main(int ac, char **av)
{
PARAM p;

  pvInit(ac,av,&p);
  /* here you may interpret ac,av and set p->user to your data */
  pvMain(&p);
  return 0;
}
#else  // multi threaded server
int main(int ac, char **av)
{
PARAM p;
int   s,ret;

  pvInit(ac,av,&p);
  client.setAdr(EIB_LOCALHOST,rlEIBnetIP::PORT);
  server.setAdr(EIB_GATEWAY,rlEIBnetIP::PORT);
  ret = eib.setClient(&client);
  if(ret < 0) return -1;
  ret = eib.setServer(&server);
  if(ret < 0) return -1;
#ifdef DEBUG
  eib.debug = 1;
#endif
  eib.startReading();

  /* here you may interpret ac,av and set p->user to your data */
  while(1)
  {
    s = pvAccept(&p);
    if(s != -1) pvCreateThread(&p,s);
    else        break;
  }
  return 0;
}
#endif

Back Content Forward