Beispiel #1
0
//---------------------------------------------------------
CSG_String CSG_CRSProjector::Get_Description(void)
{
	CSG_String	s;

	s	+= _TL("Projection routines make use of the Proj.4 Cartographic Projections library.");
	s	+= "\n";
	s	+= _TW("Proj.4 was originally developed by Gerald Evenden and later continued by the "
		       "United States Department of the Interior, Geological Survey (USGS).");
	s	+= "\n";
	s	+= _TL("Proj.4 Version is ") + Get_Version();
	s	+= "\n";
	s	+= "<a target=\"_blank\" href=\"http://trac.osgeo.org/proj/\">Proj.4 Homepage</a>";

	return( s );
}
Beispiel #2
0
/*----------------------------------------------------------------------
 *  This is the Main routine for SWVC64.
 */
void main(short argc, char **argv)
{
   short printmsg=1,done,found,channels,ClearActivity=0;
   char tstr[80],ch;       
   long session_handle;                         

   /* check arguments to see if request instruction with '?' or too many */
   if ((argc > 2) && (argv[1][0] == '?' || argv[1][1] == '?'))
   {
       printf("\nusage: swvc64 <PortNum> \n"
              "  - read/set a DS2406 addressable switch\n"
              "  - <optional> argument 1 specifies the port number\n"
              "  - version 4.02\n");
       Exit_Prog("",BAD_ARGUMENT);
   }


   /* read the default PortNum and PortType */
   PortNum = 1;
   PortType = 5;
   if (TMReadDefaultPort(&PortNum, &PortType) < 1)
   {
     Exit_Prog("ERROR, Could not read the default PortNum and PortType from registry!\n",
               NO_DRIVERS);
   }

   /* check argument to see if provided port number */
   if (argc > 1)
       PortNum = atoi(argv[1]);

   /* check to see that indicated PortNum is  <= 15 */
   if (PortNum > 15)
     Exit_Prog("ERROR, Indicated PortNum is not valid!\n",
               -ONE_WIRE_PORT_ERROR);

   /* print a header */  
   printf("\nSWVC Version 4.02\n"
         "MAXIM Integrated Products\n"
         "Copyright (C) 1992-2008\n\n");
   printf("Port number: %d    Port type: %d\n",PortNum,PortType);
   Get_Version(tstr);
   printf("Main Driver: %s\n",tstr);
   printf("Type%d:",PortType);
   if (TMGetTypeVersion(PortType,tstr) < 0)
      Exit_Prog("No Hardware Driver for this type found!",NO_DRIVERS);
   printf(" %s\n\n\n",tstr);

   /* loop to get a session handle find a switch */
   found = FALSE;
   for (;;)
   {
      /* attempt to get a session */
      session_handle = TMExtendedStartSession(PortNum,PortType,NULL);
      if (session_handle > 0)  
      {
         /* setup the 1-Wire network */
         if (TMSetup(session_handle) == 1)
         {
            printf("Searching for a DS2406...\n\n");
            
            /* look for the first switch iButton (family type 0x12) */
            if (FindFirstFamily(0x12,session_handle))
            {
               found = TRUE;
               break;
            }
            /* Temperature iButton not on 1-Wire network */
            else   
            {
               printf("DS2406 not found on 1-Wire network!"); 
               break;
            }
         }   
         /* 1-Wire network port not valid */
         else   
         {
            printf("1-Wire network setup failed!"); 
            break;
         }
      }
      else if (session_handle == 0)
      {                            
         /* check if need to print the waiting message */
         if (printmsg)
         {  
            printmsg = FALSE;
            printf("\nWaiting to get access to the 1-Wire network\n\n");
         }
      }
      else if (session_handle < 0)   
      {
         MessageBeep(MB_ICONEXCLAMATION);
         printf("No Hardware Driver for this type found!");
         break;
      }
   }

   /* end the session if one is open */
   TMEndSession(session_handle);

   /* continue if a DS2406 was found */
   if (found)                          
   {   
      /* loop while not done */
      done = FALSE;
      do
      {  
         /* always display info first */
         if (DisplaySwitchInfo(ClearActivity,&channels))
         {                              
            /* print menu */
            printf("\n\n(1) Display the switch Info\n"
                 "(2) Clear activity Latches\n"
                 "(3) Set Flip Flop(s) on switch\n"
                 "(4) Quit\n"
                 "Select a Number:");
            ch = _getche();
            printf("\n\n");
            
            /* do something from the menu selection */             
            ClearActivity = FALSE;
            switch(ch)
            {        
               case '1': 
                  break;
               case '2':
                  ClearActivity = TRUE;
                  break;
               case '3':
                  if (SetFlipFlop(WhichFlipFlop(channels)) != 1)
                     done = TRUE;         
                  break;
               case '4': case 'q': case 'Q':
                  done = TRUE;  
                  break;                             
               default:
                  MessageBeep(MB_ICONEXCLAMATION);
            };
         }
      }
      while (!done);
   }
}