void NodeIdentificationIndicator::setFrameData(QByteArray data) {
	int idx = 0, dataSize = data.size();
	if ((dataSize < 32) && (data.at(0) != getFrameType())) return;
	setSourceAddress64(data.mid(1,8));
	setSourceAddress16(data.mid(9,2));
	setReceiveOptions(data[11]);
	setRemoteAddress16(data.mid(12,2));
	setRemoteAddress64(data.mid(14,8));
	idx = data.indexOf((char)0x00, 22);
	setNIString(data.mid(22,idx-22));
	setParentAddress16(data.mid(idx+1, 2));
	setDeviceType(data[idx+3]);
	setSourceEvent(data[idx+4]);
	setProfileID(data.mid(idx+5,2));
	setManufacturerID(data.mid(idx+7,2));
	if (dataSize > idx+9) {
		if (dataSize == idx+14) {
			setDeviceTypeID(data.mid(idx+9,4));
			setRSSI(QByteArray(1,data[idx+13]));
		}
		else if (dataSize == idx+13)
			setDeviceTypeID(data.mid(idx+9,4));
		else
			setRSSI(QByteArray(1, data[idx+9]));
	}
}
Example #2
0
LBDbWorkEntry::LBDbWorkEntry( const LQuery & cluster )
 : LDbWorkEntry( cluster.readString( "barcode" ),
				 cluster.readInt( "project_cid" ),
				 cluster.readInt( "sample_id" ),
				 cluster.readDateTime( "in_date" ),
				 cluster.readInt( "test_id" ) )
{
	limits.setAnalyserID( cluster.readInt( "machine_cid" ) );
	limits.setPrivate( cluster.readString( "private_result" ) == "Y" );
	limits.setRange( cluster.readString( "min_value" ), cluster.readString( "max_value" ) );
	limits.setWarnLevels( cluster.readString( "lower_warning" ), cluster.readString( "upper_warning" ) );

	int trigger = cluster.readInt( "trigger_id" );
	if( trigger != 0 )
	{
		limits.setTriggerLimits( trigger, cluster.readString( "trigger_lower_limit" ),
										cluster.readString( "trigger_upper_limit" ) );
	}
	int pid = 0;
	const LPDbProfiles & profiles = LPDbProfiles::records( getProjectID() );
	if( !profiles.empty() )
	{
		String reason = cluster.readString( "profile_name" );
		if( reason.Length() > 3 && reason.Pos( "re-run" ) == 0 )
		{
			const LPDbProfile * pp = profiles.findByName( reason );
			if( pp != NULL )
				pid = pp -> getID();
		}
	}
	setProfileID( pid );

	resultID = duplicate = cluster.readInt( "duplicate" );
	if( duplicate < nextRerun )
		nextRerun = duplicate - 1;		// try to keep unique

	setCategoryID( cluster.readInt( "category_id" ) );
	setTimeStamp( cluster.readDateTime( "time_stamp" ) );

	if( cluster.readChar( "buddy_read" ) == LCDbWorkEntry::FINISHED )
		setStage( LDbStage::TRANSMITTED );
	else
		setStage( makeStage( cluster.readChar( "status" ) ) );
}
Example #3
0
LCDbWorkEntry::LCDbWorkEntry( const LQuery & central )
 : LDbIdBase( central.readInt( "record_no" ) ),
   LDbWorkEntry( central.readString( "barcode" ),
				 central.readInt( "project_cid" ),
				 central.readInt( "sample_id" ),
				 central.readDateTime( "in_date" ),
				 central.readInt( "test_cid" ) ),
   groupID( central.readInt( "group_id" ) ),
   profileName( central.readString( "profile_name" ) )
{
	const LPDbProfile * pp = NULL;
	const LPDbProfiles & profiles = LPDbProfiles::records( getProjectID() );
	if( !profiles.empty() )
	{
		if( central.fieldExists( "profile_id" ) )
		{
			int ppid = central.readInt( "profile_id" );
			if( ppid != 0 )
				pp = profiles.findByID( ppid );
		}
		
		if( pp == NULL && profileName.Length() > 2 )
			pp = profiles.findByName( profileName );
	}
	setProfileID( pp == NULL ? 0 : pp -> getID() );

	limits.setAnalyserID( central.readInt( "machine_cid" ) );
	limits.setPrivate( central.readChar( "private_result" ) == 'Y' );

	if( central.fieldExists( "min_value" ) && central.fieldExists( "max_value" ) )
	{
		limits.setRange( central.readDouble( "min_value" ),
						 central.readDouble( "max_value" ) );
	}

	if( central.fieldExists( "lower_warning" ) && central.fieldExists( "upper_warning" ) )
	{
		limits.setWarnLevels( central.readDouble( "lower_warning" ),
							  central.readDouble( "upper_warning" ) );
	}

	int trigger = central.readInt( "trigger_id" );
	if( trigger != 0 && central.fieldExists( "lower_trigger_limit" )
					 && central.fieldExists( "upper_trigger_limit" ) )
	{
		limits.setTriggerLimits( trigger,
							central.readDouble( "lower_trigger_limit" ),
							central.readDouble( "upper_trigger_limit" ) );
	}

	setTimeStamp( central.readDateTime( "time_stamp" ) );
	setCategoryID( central.readInt( "category_id" ) );

	if( central.fieldExists( "buddy_result_id" ) )
		setDilution( central.readDouble( "buddy_result_id" ) );
	else
		setDilution( 0 );

	if( central.fieldExists( "diluent" ) )
		setDilution( central.readDouble( "diluent" ) );
	else
		setDilution( 0 );

	switch( central.readChar( "buddy_read" ) )
	{
		case LCDbWorkEntry::COPIED:
			copied = true;
			setStage( makeStage( central.readChar( "status" ) ) );
			break;

		case LCDbWorkEntry::HELD:
			copied = true;
			setStage( LDbStage::L0_HELD );
			break;

		case LCDbWorkEntry::FINISHED:
			copied = true;
			setStage( LDbStage::TRANSMITTED );
			break;

		default:
			copied = false;
			setStage( makeStage( central.readChar( "status" ) ) );
	}
}