void CRecognizerViewImpl::HandleForegroundEventL(TBool aForeground)
{
	CALLSTACKITEM_N(_CL("CRecognizerViewImpl"), _CL("HandleForegroundEventL"));
	Reporting().DebugLog(_L("CRecognizerViewImpl::HandleForegroundEventL"));

	if (aForeground) {
		StartDisplay();
	} else {
		StopDisplay();
	}
}
Exemplo n.º 2
0
extern "C" void DisplayInit(void)
{
  DisplaySetup();
  StartDisplay();
#ifndef __PC__
  DisplayHwSetup();
#endif

  OS_CREATETASK(&TCBDisplayMainTask, "Display Main Task", DisplayMainTask, DISPLAY_MAIN_TASK_PRIO, DisplayTaskStack);
#ifndef __PC__
  InitKeyboard();
#endif
}
Exemplo n.º 3
0
static void
CheckDisplayStatus (struct display *d)
{
    switch (d->state) {
      case MissingEntry:
        StopDisplay (d);
        break;
      case NewEntry:
        d->state = OldEntry;
      case OldEntry:
        if (d->status == notRunning)
            StartDisplay (d);
        break;
    }
}
Exemplo n.º 4
0
void
MazeInit(int argc, char	**argv)
{
	getMaze();

	setRandom();

	InitDisplay(argc, argv);

	NewPosition(M);

	printf("%d X LOC \n",M->xloc().value());
	/*
	 * We don't do ShowPosition() or ShowView() here, but let the update
	 * routine in the window handler do it for the first time when
	 * the window is exposed.
	 */

	netInit();
	StartDisplay();
	RatCursor();
}
Exemplo n.º 5
0
int main(){ // the argument list is not used
  // but there is provision for it.

  printf("Welcome to the FIREBALL Guider. Please wait while we configure\n");

    fflush(NULL);

  StartLog();
  GtoM_StartCount(); 
  GtoT_StartCount();
  ResetReceivedMessageCounters();

  trackpointEL = CHIPHEIGHT/2;
  trackpointCE = CHIPWIDTH/2;

  QCamera camera; // open the camera.

  //  UniversalTime();
  //  printf("The Local Sidereal Time is: %lf\n",LST(31.761, -95.63));

  /*
  double ra1, ra2;
  double dec1, dec2;
  double alt1, alt2;
  double az1, az2;
  double del, dce;
  double lat, lon;
  */ 

  GtoT_CameraError(0);

  SetLatLon(31.761,-95.64);

  /*  lat = 31.761;
  lon = -95.64;
  ra1 = 0.50;
  ra2 = 0.51;
  dec1 = 0.41;
  dec2 = 0.41;
  RADEC_to_ALTAZ(ra1,dec1, lat,lon, &alt1,&az1);
  printf("the first alt-az I have found: %lf %lf\n",alt1,az1);
  RADEC_to_ALTAZ(ra2,dec2, lat,lon, &alt2,&az2);
  printf("the second alt-az I have found: %lf %lf\n",alt2,az2);
  ALTAZ_to_ELCE(alt1,az1,alt2,az2,&del,&dce); 
  printf("The difference I have found is: %lf %lf\n",del,dce);
  */
  InitDAC(); // prepare the dac.

  InitializeLEDs(); // turn off the Lamp.

  if(!ComSetup()) GtoT_TextError("COM working");


  //  RunSillyProg();

  StartDisplay(); // begin the display.

  turnOnGps();
  

  // starts some of the statistic quantities. Defaulting to 100 frames -- 10s in full chip mode, 3s in ROI mode. 





  InitMode.setCallback(InitModeCallback);
  AutocollimationMode.setCallback(AutocollimationModeCallback);
  AlignmentMode.setCallback(AlignmentModeCallback);
  AlignmentSubMode.setCallback(AlignmentModeCallback);
  SlewingMode.setCallback(SlewPointModeCallback);
  PointingMode.setCallback(SlewPointModeCallback);
  PointingModeRoi.setCallback(SlewPointModeCallback);
 
  camera.prepSettings(InitMode,0,0);
  if(camera.LoadQCamState()){
    switch(camera.nextMode.getModeID()){
    case INITMODE:{
      camera.nextMode.setCallback(InitModeCallback);
      break;
    };
    case ALIGNMENTMODE:{
      camera.nextMode.setCallback(AlignmentModeCallback);
      alignmentMD.winx = camera.getWinX();
      alignmentMD.winy = camera.getWinY();
      alignmentMD.wind = camera.getWinDX();
      WriteToLog("Stuff","%d %d %d",alignmentMD.winx,alignmentMD.winy,alignmentMD.wind);
      break;
    };
    case SLEWINGMODE:{
      camera.nextMode.setCallback(SlewPointModeCallback);
      break;
    };
    case POINTINGMODE:{
      camera.nextMode.setCallback(SlewPointModeCallback);
      break;
    };
    case AUTOCOLLIMATIONMODE:{
      camera.nextMode.setCallback(AutocollimationModeCallback);
      break;
    };  
    default:
      break;
    };
  };
  //  camera.prepSettings(SlewingMode,0,0);
  //  camera.prepSettings(PointingMode,0,0);
  //  camera.nowMode.setEqual(AlignmentMode);
 
  //    HomeCamera();
  
    //MoveStage(30000);

  // periodicmessages.h/c contains the variables and calls needed to 
  // set up periodic messages that have to be sent to the MPF and the 
  // ground in various modes. 
#include "periodicmessages.h"
  
  // processmessages.h/c contains the variables and calls needed to 
  // process the messages from the MPF and the ground.
#include "processmessages.h"


  //for every change of mode there will be a goto mainloop command
  //to exit a program there will be a goto loopexit command. 

  FillRSquared();
  //  if(camera.getActiveSensor() == GUIDERSENSOR){
  //    GtoM_SwitchingGuiderRequest();
  //  };
  //  HelloDither.DitherPattern1(10);
 MainLoop:
  
  camera.stopStreaming();  // stop camera streaming


  camera.changeSettings(); // adjust camera parameters, including 
                           // the trigger time.

  modeID = camera.getModeID();

  camera.startStreaming(); // restart camera streaming. 


  //  WriteToLog("Got Here! B ");
  loopcounter = 0;

  if(camera.getModeID() == POINTINGMODE || (camera.getModeID()==ALIGNMENTMODE && camera.getSubModeID()==ALIGNTRACKROI)){
    ClearScreen();
    FontOverwrite();
  } else {
    FontMask();
  };
  
  //  WriteToLog("Got Here A !");

  if(camera.getModeID()==ALIGNMENTMODE && (camera.getSubModeID() == ALIGNTRACKROI || camera.getSubModeID() == ALIGNTRACKFULLCHIP || camera.getSubModeID() == ALIGNDRAGFULLCHIP)){
    //    GtoM_SwitchingGuiderRequest();
    //    camera.setActiveSensor(GUIDERSENSOR);
  } else {
    //    GtoM_SwitchingDTURequest();
    //    camera.setActiveSensor(OTHERSENSOR);
  }

  //    WriteToLog("Got Here!");
  //    WriteToLog("FLOOD","%d %d %d" ,camera.getRoiX(), camera.getRoiY(),camera.getRoiDX());
  do{

    #include "periodicmessages.cpp"
    #include "processmessages.cpp"

    camera.queueFrame();
    


  } while(1);
  

  camera.~QCamera();
  CloseLog();

  return 0;
};
Exemplo n.º 6
0
Arquivo: simud.c Projeto: chinacat/rs
void ShowCurrentResidualProgOK()
{
   char tmpstr[TEMPSTRINGLEN];
   FILE *file_ptr;
   ShowpageGlobals * show_globals;	/* The psuedo global structure. */
   char c;
   int filesize0 = 0, filesize1 = 0;


   file_ptr = fopen(TEMPFILENAME, "r");
   if (file_ptr != NULL)
   {
      strcpy(tmpstr, "rm ");
      strcat(tmpstr, TEMPFILENAME);
      system(tmpstr);
   }
   fclose(file_ptr);

   strcpy(tmpstr, "(writelpp (residual-program) \"");
   strcat(tmpstr, TEMPFILENAME);
   strcat(tmpstr, "\")");
   SendToSimilix(tmpstr);

   /* Make sure TEMPFILENAME can be generated completely. */
   sleep(SIMUONE);
   do 
   {
      file_ptr = fopen(TEMPFILENAME, "r");
      if (file_ptr != NULL)
      {
         c = fgetc(file_ptr);
	 filesize0 = 0;
	 while (c != EOF)
	 {
	     filesize0 = filesize0 + 1;
	     c = fgetc(file_ptr);
         }
      }
      fclose(file_ptr);
      sleep(SIMUTWO);
      file_ptr = fopen(TEMPFILENAME, "r");
      if (file_ptr != NULL)
      {
	 c = fgetc(file_ptr);
         filesize1 = 0;
         while (c != EOF)
         {
	    filesize1 = filesize1 + 1;
	    c = fgetc(file_ptr);
         }
      }
      fclose(file_ptr);
   } while ((filesize0 == 0) || (filesize1 == 0) || (filesize0 != filesize1));

   file_ptr = fopen(TEMPFILENAME, "r");
   if (file_ptr != NULL)
   {
      strcpy(tmpstr, "rm ");
      strcat(tmpstr, TEMPFILENAME);
      system(tmpstr);

      textglobals_context = XStringToContext(SIMUNAME);

      show_globals = InitPsuedoGlobals();
      strcpy(tmpstr, TITLESHOW);
      CreateDisplayWidget(show_globals, tmpstr);
      ReadFile(show_globals, file_ptr);
      strcpy(show_globals->showpage_title, "The current residual program");
      ChangeLabel(show_globals->label, show_globals->showpage_title);
      XtManageChild(show_globals->showpage);
      StartDisplay(show_globals);
   }
   fclose(file_ptr);
}
Exemplo n.º 7
0
static void manage(struct sockaddr *from, int fromlen, int length, int fd)
{
    CARD32 sessionID;
    CARD16 displayNumber;
    ARRAY8 displayClass;
    int expectlen;
    struct protoDisplay *pdpy;
    struct display *d;
    char *name = NULL;
    char *class2 = NULL;
    XdmcpNetaddr from_save;
    ARRAY8 clientAddress, clientPort;
    CARD16 connectionType;

    Debug("<manage> %d\n", length);
    displayClass.data = 0;
    displayClass.length = 0;
    if(XdmcpReadCARD32(&buffer, &sessionID) && XdmcpReadCARD16(&buffer, &displayNumber) && XdmcpReadARRAY8(&buffer, &displayClass))
    {
        expectlen = 4 +                      /* session ID */
                    2 +                      /* displayNumber */
                    2 + displayClass.length; /* displayClass */
        if(expectlen != length)
        {
            Debug("<manage> length error got %d expect %d\n", length, expectlen);
            goto abort;
        }
        pdpy = FindProtoDisplay((XdmcpNetaddr)from, fromlen, displayNumber);
        Debug("<manage> session ID %ld, pdpy %p\n", (long)sessionID, pdpy);
        if(!pdpy || pdpy->sessionID != sessionID)
        {
            /*
             * We may have already started a session for this display
             * but it hasn't seen the response in the form of an
             * XOpenDisplay() yet. So check if it is in the list of active
             * displays, and if so check that the session id's match.
             * If all this is true, then we have a duplicate request that
             * can be ignored.
             */
            if(!pdpy && (d = FindDisplayByAddress((XdmcpNetaddr)from, fromlen, displayNumber)) && d->sessionID == sessionID)
            {
                Debug("manage: got duplicate pkt, ignoring\n");
                goto abort;
            }
            Debug("session ID %ld refused\n", (long)sessionID);
            if(pdpy)
                Debug("existing session ID %ld\n", (long)pdpy->sessionID);
            send_refuse(from, fromlen, sessionID, fd);
        }
        else
        {
            name = NetworkAddressToName(pdpy->connectionType, &pdpy->connectionAddress, from, pdpy->displayNumber);
            if(!name)
            {
                Debug("could not compute display name\n");
                send_failed(from, fromlen, "(no name)", sessionID, "out of memory", fd);
                goto abort;
            }
            Debug("computed display name: %s\n", name);
            if((d = FindDisplayByName(name)))
            {
                Debug("terminating active session for %s\n", d->name);
                StopDisplay(d);
            }
            if(displayClass.length)
            {
                if(!StrNDup(&class2, (char *)displayClass.data, displayClass.length))
                {
                    send_failed(from, fromlen, name, sessionID, "out of memory", fd);
                    goto abort;
                }
            }
            if(!(from_save = (XdmcpNetaddr)Malloc(fromlen)))
            {
                send_failed(from, fromlen, name, sessionID, "out of memory", fd);
                goto abort;
            }
            memmove(from_save, from, fromlen);
            if(!(d = NewDisplay(name)))
            {
                free((char *)from_save);
                send_failed(from, fromlen, name, sessionID, "out of memory", fd);
                goto abort;
            }
            d->class2 = class2;
            class2 = 0;
            d->displayType = dForeign | dTransient | dFromXDMCP;
            d->sessionID = pdpy->sessionID;
            d->from.data = (unsigned char *)from_save;
            d->from.length = fromlen;
            d->displayNumber = pdpy->displayNumber;
            ClientAddress(from, &clientAddress, &clientPort, &connectionType);
            d->useChooser = 0;
            d->xdmcpFd = fd;
            if(IsIndirectClient(&clientAddress, connectionType))
            {
                Debug("IsIndirectClient\n");
                ForgetIndirectClient(&clientAddress, connectionType);
                if(UseChooser(&clientAddress, connectionType))
                {
                    d->useChooser = 1;
                    Debug("use chooser for %s\n", d->name);
                }
            }
            d->clientAddr = clientAddress;
            d->connectionType = connectionType;
            d->remoteHost = NetworkAddressToHostname(pdpy->connectionType, &pdpy->connectionAddress);

            XdmcpDisposeARRAY8(&clientPort);
            if(pdpy->fileAuthorization)
            {
                d->authorizations = (Xauth **)Malloc(sizeof(Xauth *));
                if(!d->authorizations)
                {
                    free((char *)from_save);
                    free((char *)d);
                    send_failed(from, fromlen, name, sessionID, "out of memory", fd);
                    goto abort;
                }
                d->authorizations[0] = pdpy->fileAuthorization;
                d->authNum = 1;
                pdpy->fileAuthorization = 0;
            }
            DisposeProtoDisplay(pdpy);
            Debug("starting display %s,%s\n", d->name, d->class2);
            if(LoadDisplayResources(d) < 0)
            {
                LogError(
                    "Unable to read configuration for display %s; "
                    "stopping it.\n",
                    d->name);
                StopDisplay(d);
            }
            else
                StartDisplay(d);
            CloseGetter();
        }
    }
abort:
    XdmcpDisposeARRAY8(&displayClass);
    if(name)
        free((char *)name);
    if(class2)
        free((char *)class2);
}