uint32_t librpipTransactionSend(struct librpip_tx* t, uint32_t device, uint32_t client);


Actually performs a transaction, i.e. data is transferred with a device. If the transaction contains ‘variable’ messages then these need to be populated before it can be sent. Any data coming form the device is stored internally and extracted with one or more calls to librpipTransactionRead()


  • struct librpip_tx* t
    A pointer to a transaction that is to be sent. This will have been created from a previous librpipTransactionCreate().
  • uint32_t device
    The device ID that the transaction will be sent via. The ID is the numerical part of the device name. e.g. if the transactions was created with mode ‘LIBRPIP_TX_MODE_I2C’ then the device ID is 0 for /dev/i2c-0 or 1 for /dev/i2c-1. If the mode was ‘LIBRPIP_TX_MODE_SPI’ then ¬†the device ID is 0 for /dev/spidev0.x or 1 for /dev/spidev1.x etc.
  • uint32_t client
    The client ID on the device. for I2C this is the slave ID, for SPI it is the CS number. For UARTS this is ignored.


0 on failure or 1 on success.


Create a transaction to read an I2C sensor, and send it to I2C0, Slave 0x30:

uint32_t feature_set,i;
uint8_t result;
struct librpip_tx* MySensor;
feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0);
MySensor=librpipTransactionCreate(LIBRPIP_TX_MODE_I2C, 8);
librpipTransactionMsgAddRegRead(MySensor, 0x01, 1);
for(i=0;i<5;i++) {
        librpipTransactionSend(MySensor, 0, 0x30); 
        librpipTransactionRead(MySensor, &result, 1);
        fprintf(stdout,"The sensor is %u\n",result);