示例#1
0
size_t device::receive_data(std::vector<unsigned char>& data_buf,
			       int device_number,
			       int channel )
{
    talk( device_number );
    data_talk( channel );

    size_t received = 0;
    try
    {
	received = receive_from_bus(data_buf);
    }
    catch (raspbiec_error &e)
    {
	untalk();
	throw;
    }
    untalk();

    return received;
}
示例#2
0
uint8 IEC::OutATN(uint8 byte)
{
	received_cmd = sec_addr = 0;	// Command is sent with secondary address
	switch (byte & 0xf0) {
		case ATN_LISTEN:
			listening = true;
			return listen(byte & 0x0f);
		case ATN_UNLISTEN:
			listening = false;
			return unlisten();
		case ATN_TALK:
			listening = false;
			return talk(byte & 0x0f);
		case ATN_UNTALK:
			listening = false;
			return untalk();
	}
	return ST_TIMEOUT;
}