Beispiel #1
0
int main(int argc, const char **argv)
{
	uint32_t count = 100;
	DtpTop indication(IfcNames_DtpIndicationH2S);
	device = new DtpRequestProxy(IfcNames_DtpRequestS2H);
	device->pint.busyType = BUSY_SPIN;   /* spin until request portal 'notFull' */

	device->dtp_reset(32);
    device->dtp_get_mode();
	device->dtp_read_version();

	fprintf(stderr, "Main::about to go to sleep\n");
	while(true){
		for (int i=0; i<2; i++) {
			device->dtp_read_delay(i);
			device->dtp_read_state(i);
			device->dtp_read_error(i);
			device->dtp_read_cnt(i);
			device->dtp_read_local_cnt(i);
		}
		sleep(1);
        
		for (int i=0; i<2; i++) {
			device->dtp_logger_write_cnt(i, count);
		}
		for (int i=0; i<2; i++) {
			device->dtp_logger_read_cnt(i);
		}
		count ++;
		sleep(1);
	}
   
}
Beispiel #2
0
void loop()
{
	static uint32_t last_run = 0;
	uint32_t current_time = millis();
	if (current_time - last_run >= 5000)
	{
		Serial.println("===============");
		for (uint8_t i = 0; i < CAM_COUNT; i++)
		{
			Serial.print("Camera[");
			Serial.print(i + 1);
			Serial.print("] = ");
			Serial.print(cam_status[i].status, BIN);
			Serial.print(" ");
			Serial.print((millis() - cam_status[i].ref_time) / 1000);
			Serial.println(" sec ago");
		}
		Serial.println("===============");
		Serial.println("request...");
		network.send(14, "E", 1);
		network.send(13, "E", 1);
		last_run = millis();
	}
	network.update();
	network.receive(1000);
	read_buttons();
	indication(current_time);
};
static void TestExceptionHandling()
{
    Monitor monitor;
    HTTPConnector httpConnector(&monitor);
    WSMANExportClient client(&httpConnector,&monitor);

    CIMInstance indication(CIMName("My_IndicationClass"));
    indication.addProperty(CIMProperty(CIMName("DeviceName"), String("Disk")));
    indication.addProperty(CIMProperty(CIMName("DeviceId"), Uint32(1)));

    /*
         Missing call to client.connect(...).  Verify NotConnectedException
         is returned.
    */
    Boolean exceptionCaught;
    exceptionCaught = false;
    try
    {
        client.exportIndication(
           "/WSMANListener/Pegasus_IndicationStressTestConsumer", indication);

    }
    catch (const NotConnectedException&)
    {
        exceptionCaught = true;
    }
    PEGASUS_TEST_ASSERT(exceptionCaught);
}
Beispiel #4
0
int main(int argc, char *argv[])
{
	long actualFrequency = 0;
	long requestedFrequency = 1e9 / MainClockPeriod;

	PaxosIndication indication(IfcNames_PaxosIndicationH2S);
	echoRequestProxy = new PaxosRequestProxy(IfcNames_PaxosRequestS2H);

	int status = setClockFrequency(0, requestedFrequency, &actualFrequency);
	fprintf(stderr, "Requested main clock frequency %5.2f, actual clock frequency \
					%5.2f  MHz. status=%d, errno=%d\n",
			(double)requestedFrequency * 1.0e-6,
			(double)actualFrequency * 1.0e-6,
			status, errno);

	uint32_t ballot  = 1;
	send1Amessage(ballot);
	send1Bmessage(ballot, 0, 0, 1);
	send1Bmessage(ballot, 0, 0, 2);
	send2Bmessage(ballot, 42, 0);
	send2Bmessage(ballot, 42, 0);
	send2Bmessage(ballot, 42, 1);

	return 0;
}
bool
AddIndicationCommand::canExecute()
{
    Segment &s(getSegment());

    for (Segment::iterator i = s.begin(); s.isBeforeEndMarker(i); ++i) {

        if ((*i)->getNotationAbsoluteTime() >=
            m_indicationStart + m_indicationDuration) {
            return true;
        }

        if ((*i)->isa(Indication::EventType)) {

            try {
                Indication indication(**i);

                if ((*i)->getNotationAbsoluteTime() +
                    indication.getIndicationDuration() <= m_indicationStart)
                    continue;

                std::string type = indication.getIndicationType();

                if (type == m_indicationType) {
                    // for all indications (including slur), we reject an
                    // exact overlap
                    if ((*i)->getAbsoluteTime() == m_indicationStart &&
                        indication.getIndicationDuration() == m_indicationDuration) {
                        return false;
                    }
                } else if (m_indicationType == Indication::Slur) {
                    continue;
                }

                // for non-slur indications we reject a partial
                // overlap such as this one, if it's an overlap with
                // an indication of the same "sort"

                if (m_indicationType == Indication::Crescendo ||
                    m_indicationType == Indication::Decrescendo) {
                    if (type == Indication::Crescendo ||
                        type == Indication::Decrescendo) return false;
                }

                if (m_indicationType == Indication::QuindicesimaUp ||
                    m_indicationType == Indication::OttavaUp ||
                    m_indicationType == Indication::OttavaDown ||
                    m_indicationType == Indication::QuindicesimaDown) {
                    if (indication.isOttavaType()) return false;
                }
            } catch (...) {}
        }
    }

    return true;
}
Beispiel #6
0
int main(int argc, char **argv)
{
    BcamTestIndication indication(IfcNames_BcamTestIndicationH2S);
    device = new BcamTestRequestProxy(IfcNames_BcamTestRequestS2H);

    device->add_entry(0x3417EB96BF1C,0x200);

    sleep(3);
    return 0;
}
Beispiel #7
0
int main(int argc, const char **argv)
{
  SerialPortalIndication indication(IfcNames_SerialPortalIndicationH2S);
  EchoRequest echo(IfcNames_EchoRequestH2S);
  Simple simple(IfcNames_SimpleRequestH2S);

  SerialPortalRequestProxy *device = new SerialPortalRequestProxy(IfcNames_SerialPortalRequestS2H);
  EchoIndicationProxy *echoIndication = new EchoIndicationProxy(IfcNames_EchoIndicationS2H);
  SimpleRequestProxy *simpleRequest = new SimpleRequestProxy(IfcNames_SimpleRequestS2H);

  if (!argv[1]) {
      //realpath("/sys/class/tty/ttyUSB0/device/driver/");
      fprintf(stderr, "usage: %s /dev/ttyUSBn\n", argv[0]);
      return -EINVAL;
  }

  int serial_fd = initSerial(argv[1]);
  PortalSharedParam paramSerial;
  paramSerial.serial.serial_fd = serial_fd;

  Portal *mcommon = new Portal(0, 0, sizeof(uint32_t), portal_serialmux_handler, NULL, &transportSerial, &paramSerial, 0);
  PortalMuxParam param = {};
  param.pint = &mcommon->pint;

  EchoRequestProxy   echoSerial(0, &transportSerialMux, &param);
  SimpleRequestProxy simpleSerial(1, &transportSerialMux, &param);

  EchoIndication serialEchoIndication(0, &transportSerialMux, &param);
  Simple         serialSimple(1, &transportSerialMux, &param);

  device->setDivisor(134);
  sleep(2);

  echoSerial.say(0x6789);
  echoSerial.say2(0x22, 0x23);

  sleep(2);
  simpleSerial.say1(v1a);
  simpleSerial.say2(v2a, v2b);

  sleep(2);
  echoIndication->heard2(0x68,0x47);
  echoIndication->heard(0x22);

  sleep(2);
  simpleRequest->say1(19);

  while (1) {
    // wait
  }
}
void
AddIndicationCommand::modifySegment()
{
    SegmentNotationHelper helper(getSegment());
    Segment::iterator i, j;
    int actualSubordering = Indication::EventSubOrdering;

    helper.segment().getTimeSlice(getStartTime(), i, j);
    for (Segment::iterator k = i; k != j; ++k) {
        if ((*k)->has(BaseProperties::IS_GRACE_NOTE)) {
            // If a grace note is inserted before an indication, the
            // subordering is minor than Indication::EventSubOrdering,
            // therefore we have to decrement the subordering to insert
            // the new indication before the grace note.
            if ((*k)->getSubOrdering() <= actualSubordering) {
                actualSubordering = (*k)->getSubOrdering() - 1;
            }
        }
    }

    Indication indication(m_indicationType, m_indicationDuration);
    Event *e;

    e = new Event(Indication::EventType, m_indicationStart, m_indicationDuration,
                  actualSubordering);
    e->set<String>(Indication::IndicationTypePropertyName, m_indicationType);
    e->set<Int>("indicationduration", m_indicationDuration);
    helper.segment().insert(e);
    m_lastInsertedEvent = e;

    if (indication.isOttavaType()) {
        for (Segment::iterator i = getSegment().findTime(getStartTime());
             i != getSegment().findTime(getStartTime() + m_indicationDuration);
             ++i) {
            if ((*i)->isa(Note::EventType)) {
                (*i)->setMaybe<Int>(NotationProperties::OTTAVA_SHIFT,
                                    indication.getOttavaShift());
            }
        }
    }
}
Beispiel #9
0
void NewCounter::set_IdPokazanie(int id_pok)
{
    id_pokazanie = id_pok;
    Indications indication(id_pok);
    ui->lblCounter->setText(indication.getNameService());
}