예제 #1
0
TimeRecord ClockDisplay::getTimeRecord(bool black)
{
	if(black)
		return TimeRecord(b_time, b_stones_periods);
	else
		return TimeRecord(w_time, w_stones_periods);
}
예제 #2
0
TimeRecord BoardDispatch::getTheirTimeRecord(void)
{
	if(boardwindow)
		return boardwindow->qgoboard->getTheirTimeRecord();
	else
		return TimeRecord();
}
예제 #3
0
void PlayerBase::timerHandler(mp_sint32 currentBeatPacket)
{
	timeRecord[currentBeatPacket] = TimeRecord(poscnt, 
											   rowcnt, 
											   bpm, 
											   tickSpeed, 
											   mainVolume,
											   ticker);
}
예제 #4
0
StartOfFileRecord::StartOfFileRecord(const Source &source, const unsigned char *payload, int payload_len) {
  try {
    const unsigned char *ptr=payload;
    protocol_version = read_u16(ptr);
    time = TimeRecord(source, ptr);
    tick_period = read_u48(ptr);
    if (verbose) log_f("parse_bt_file: Parsing SOFR:  tick_period is %llu", tick_period);
    char *cptr = (char*) ptr, *end= (char*) payload+payload_len;
    if (end[-1] != 0) throw ParseError("At byte %d: DEVICE_PARAMS don't end with NUL", source.pos(end-1));
    while (cptr < end-1) {
      char *keyptr = cptr;
      cptr = strchr(cptr, '\t');
      if (!cptr) throw ParseError("At byte %d: DEVICE_PARAMS missing tab", source.pos(keyptr));
      std::string key(keyptr, cptr);
      cptr++; // skip tab
      char *valueptr = cptr;
      cptr = strchr(cptr, '\n');
      if (!cptr) throw ParseError("At byte %d: DEVICE_PARAMS missing newline", source.pos(valueptr));
      std::string value(valueptr, cptr);
      cptr++; // skip
      if (verbose) log_f("parse_bt_file:   '%s'='%s'", key.c_str(), value.c_str());
      device_params[key] = value;
    }
    
    if (!device_params.count("channel_specs")) {
      throw ParseError("No channel_specs field in DEVICE_PARAMS in START_OF_FILE record");
    }
    Json::Reader reader;
    if (!reader.parse(device_params["channel_specs"], channel_specs)) {
      throw ParseError("Failed to parse channel_specs JSON");
    }
    Json::Value::Members channel_names = channel_specs.getMemberNames();
    for (unsigned i = 0; i < channel_names.size(); i++) {
      std::string units = get_channel_units(channel_names[i]);
      double scale = get_channel_scale(channel_names[i]);
      if (verbose)
        log_f("parse_bt_file:   channel %d: '%s', units '%s', scale %g",
                i, channel_names[i].c_str(), units.c_str(), scale);
    }
  }
  catch (ParseError &e) {
    throw ParseError("In RTYPE_START_OF_FILE payload starting at byte %d: %s", source.pos(payload), e.what());
  }
}