Ejemplo n.º 1
0
int 
itest6(int flag)
{
  int n=0;
  MsgStr errMsg;
  ValueVector ranges;
  size_t nRanges;
  htmSqlInterface htm(6);
  char hull[100]	 = "J2000 6 41.4 47.9 41.2.47.9 41.0 47.5 41.4 48";

  /* Example of convex hull */

  nRanges = htm.convexHull(hull,ranges);
  if(htm.err())
    std::cout << htm.error() << std::endl;
  else
    printRanges(hull,nRanges,ranges,flag);

  n = (nRanges != 9);
  return showtest("iTest6 (cHull#1)",n,flag);
}
Ejemplo n.º 2
0
int 
itest5(int flag)
{
  int n=0;
  MsgStr errMsg;
  ValueVector ranges;
  size_t nRanges;
  htmSqlInterface htm(6);
  char circle[100] = "J2000 6 41.4 47.9 2.0";

  /* Generic interface */

  strcpy(circle,"CIRCLE J2000 6 41.4 47.9 20");
  nRanges = htm.intersect2(circle, ranges);
  if(htm.err())
    cout << htm.error() << endl;
  else {
    printRanges(circle,nRanges,ranges,flag);
  }

  n = (nRanges != 4);
  return showtest("iTest5 (circle#3)",n,flag);
}
Ejemplo n.º 3
0
int 
itest4(int flag)
{
  int n=0;
  MsgStr errMsg;
  ValueVector ranges;
  size_t nRanges;
  htmSqlInterface htm(6);
  char circle[100] = "J2000 6 41.4 47.9 8.0";

  /* 2nd Example of circle region */

  nRanges = htm.circleRegion(circle,ranges);

  if(htm.err())
    cout << htm.error() << endl;
  else {
    printRanges(circle,nRanges,ranges,flag);
  }

  n = (nRanges != 2);
  return showtest("iTest4 (circle#2)",n,flag);
}
Ejemplo n.º 4
0
void ProcessTextFile(DiskFileB &infile, GXSTD::ostream &stream)
{
  char c;
  HyperText htm(stream);

  
  if(use_comments) {
    char date[255]; htm.GetSystemTime(date);
    htm << comment << "HTML file generated by: " << ProgramName << " version ";
    htm.precision(3);
    htm << AS2HTMVersionNumber << ecomment << "\n";
    htm << comment << "File Creation date: " << date << ecomment << "\n";
  }
  
  htm.Prologue(open_file);
  htm.StartBody("BGCOLOR=\"#FFFFFF\"");

  if(use_header) htm.DocHeader(open_file);
  
  htm.FONT("FACE=\"Courier New\" SIZE=3");
  htm << pre << "\n";

  while(!infile.df_EOF()) {
    if(infile.df_Get(c) != DiskFileB::df_NO_ERROR) {
      break; // Error reading from the disk file
    }
    if(c == '\r') continue; // Filter hard returns
    htm << c;
  }

  htm << "\n" << epre << efont << "\n";

  if(use_header) htm.DocTrailer();
  
  htm.Epilogue();
}
Ejemplo n.º 5
0
int 
itest7(int flag)
{
  int n=0;
  MsgStr errMsg;
  ValueVector ranges;
  size_t nRanges;
  htmSqlInterface htm(6);
  char hull[100] = "CONVEX J2000 1 1 -1 1 -1 -1 1 -1"; // counterclockwise
  //	char hull[100] = "CONVEX J2000 1 1 1 -1 -1 -1 -1 1"; // clockwise
  //	char hull[100] = "CONVEX J2000 1 1 -1 -1 -1 1 1 -1"; // diag + cw
  //	char hull[100] = "CONVEX J2000 1 1 -1 -1 1 -1 -1 1"; // diag+ccw

  /* Generic interface */
  nRanges = htm.intersect2(hull, ranges);
  if(htm.err())
    cout << htm.error() << endl;
  else
    printRanges(hull,nRanges,ranges,flag);

  n = (nRanges != 9);
  n = 0;
  return showtest("iTest7 (cHull#2)",n,flag);
}
Ejemplo n.º 6
0
int 
itest3(int flag)
{
  int n=0;

  MsgStr errMsg;
  ValueVector ranges;
  size_t nRanges;
  htmSqlInterface htm(6);
  char circle[100] = "J2000 6 41.4 47.9 2.0";

  /* 1st Example of circle region */

  errMsg = htm.circleRegionDiagnostic(circle);

  if(errMsg.empty()) {
    nRanges = htm.circleRegion(circle,ranges);
    printRanges(circle,nRanges,ranges,flag);
  } else
    cout << errMsg;

  n = (nRanges != 2);
  return showtest("iTest3 (circle#1)",n,flag);
}
Ejemplo n.º 7
0
//
// main routine
//
int main(void) {
#ifdef DEBUG
	CSerial ser;		// declare a UART object
	ser.enable();
	CDebug dbg(ser);	// Debug stream use the UART object
	dbg.start();
#endif
	//
	// Declare SoftDevice Object
	//
	bleDevice ble;
	ble.enable();						// enable BLE stack

	// GAP
	ble.m_gap.settings(DEVICE_NAME);	// set Device Name on GAP
	ble.m_gap.tx_power(BLE_TX_0dBm);	// set output radio Power

	//
	// Declare a HRM service object
	//
	bleServiceHRM hrm(ble);

	//
	// Declare a HTM service object
	//
	bleServiceHTM htm(ble);

	//
	// Declare a BAT service object
	//
	bleServiceBattery bat(ble);

	//
	// Add "connection parameters update" negotiation. (optional)
	//
	bleConnParams conn(ble);

	//
	// update advertisement contents
	//
	ble.m_advertising.commpany_identifier(APP_COMPANY_IDENTIFIER);	// add company identifier
	ble.m_advertising.add_uuid_to_complete_list(hrm);				// add hrm object to the uuid list of advertisement
	ble.m_advertising.add_uuid_to_complete_list(htm);				// add htm object to the uuid_list of advertisement
	ble.m_advertising.add_uuid_to_complete_list(bat);				// add bat object to the uuid_list of advertisement
	ble.m_advertising.appearance(BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR);
	ble.m_advertising.update();										// update advertisement data

	// Start advertising
	ble.m_advertising.interval(APP_ADV_INTERVAL);					// set advertising interval
//	ble.m_advertising.timeout(30); // set timeout, will cause the system to enter to the power off mode.
	ble.m_advertising.start();

	//
	// Tickless Low Power Feature
	//
#ifndef DEBUG
	CPowerSave::tickless(true);
#endif

	//
	// Analog input (for VDD detected)
	//
	CAdc::init();			// AREF internal VBG
	CAdc::source(VDD_1_3);	// source from internal: VDD x 1/3
	CAdc::enable();

	//
	// LED Task
	//
	CThread t(tskLED);
	t.start("LED", 45);	// stack size=45 DWORD

	//
	uint16_t value;
	float 	 temp, percentage;

	//
    // Enter main loop.
	//
    while(1) {

    	//
    	// wait for BLE connected, the task will be blocked until connected.
    	//
    	ble.wait();

    	//
    	// Heart Rate Measurement Service
    	//
    	if ( hrm.isAvailable() ) {	// is service available (when remote app connected to the service)
    		hrm.send(70);			// send Heart Rate Measurement
    	}

    	//
    	// Health Thermometer Measurement Service
    	//
    	if ( htm.isAvailable() ) {		// is service available (when remote app connected to the service)
			if ( bleServiceHTM::get_temperature(temp) ) {
				htm.send(temp);	// send temp
			}
    	}

    	//
    	// Battery Service
    	//
    	if ( bat.isAvailable() ) {		// is service available (when remote app connected to the service)
			if ( CAdc::read(value) ) {
				percentage = (value / 1024.0f) * 100.0;
				bat.send(percentage);
			}
    	}

    	// Negotiate the "connection parameters update"
    	conn.negotiate();

    	// sleep to make more idle time for tickless.
    	sleep(200);
    }
}