コード例 #1
0
ファイル: k3bdatamodewidget.cpp プロジェクト: franhaufer/k3b
void K3b::DataModeWidget::saveConfig( KConfigGroup c )
{
    QString datamode;
    if( dataMode() == K3b::DataMode1 )
        datamode = "mode1";
    else if( dataMode() == K3b::DataMode2 )
        datamode = "mode2";
    else
        datamode = "auto";
    c.writeEntry( "data_track_mode", datamode );
}
コード例 #2
0
uint8_t BT::sendDATA(uint8_t id, uint8_t type, void* buffer, uint16_t bytes)
{
	if(!present)
		return 1;

	debug(STR("Sending: "));
	debug(id);
	debug(STR(", "));
	debug(type);
	debug_nl();
	if(dataMode())
	{
		waitRTS();
		if(BT_RTS)
		{
			char* byte;

			if(waitRTS()) return 1;
			Serial_SendByte('$');
			if(waitRTS()) return 1;
			Serial_SendByte((char) id);
			if(waitRTS()) return 1;
			Serial_SendByte((char) type);
			if(waitRTS()) return 1;
			Serial_SendByte((char) *(&bytes));
			if(waitRTS()) return 1;
			Serial_SendByte((char) *(&bytes + 1));
			if(waitRTS()) return 1;
			Serial_SendByte(':');

			byte = (char *) buffer;
			if(bytes > 0)
			{
				while(bytes--)
				{
					if(waitRTS()) break;
					Serial_SendByte(*byte);
					byte++;
				}
			}
			return 1;
		}
		else
		{
			debug(STR("BT RTS Failed!\r\n"));
		}
	}

	return 0;
}