# C Slave Operations The header ftslave.h defines functions for allocalting slave TXTs as well as functions to query names, versions, serial numbers, firmware versions etc. | Content | | ---------------------------------------------- | | [ftop_get_slave_by_order](#get_slave_by_order) | | [ftop_get_slave_by_uid](#get_slave_by_uid) | | [ftop_get_slave_by_name](#get_slave_by_name) | | [ftop_get_slave_by_SN](#get_slave_by_SN) | | [ftop_get_name](#get_name) | | [ftop_get_version](#get_version) | | [ftop_get_firmware](#get_firmware) | | [ftop_get_slaves_number](#get_slaves_number) | | [ftop_get_txt_uid](#get_txt_uid) | | [ftop_get_txt_name](#get_txt_name) | | [ftop_get_txt_SN](#get_txt_SN) | | [ftop_txt_mode](#txt_mode) | | [ftop_txt_name](#txt_name) | ## Allocators ### void *ftop_get_slave_by_order(fttxt2 *device, unsigned int number) Returns the slave TXT with the given number as network id. The network id is the order in which the TXTs are connected to the CAN-network. Returns *NULL* if *device* is **NOT** the master TXT or if a slave TXT with the given network id does not exsist. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to master TXT | | *in* | **number** | network id | Return: pointer to slave object ### void *ftop_get_slave_by_uid(fttxt2 *device, unsigned int uid) Returns the slave TXT with the given uid. Returns *NULL* if *device* is **NOT** the master TXT or if a slave TXT with the given uid does not exsist. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to master TXT | | *in* | **uid** | uid | Return: pointer to slave object ### void *ftop_get_slave_by_name(fttxt2 *device, const char *name) Returns the slave TXT with the given name. In order to get the slave based on the extension number set in the TXT's menu, use this function with the name 'Extension.X' where X is the extension's number. Returns *NULL* if *device* is **NOT** the master TXT or if a slave TXT with the given name does not exsist. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to master TXT | | *in* | **name** | TXT name | Return: pointer to slave object ### void *ftop_get_slave_by_SN(fttxt2 *device, const char *sn) Returns the slave TXT with the given serial number. Returns *NULL* if *device* is **NOT** the master TXT or if a slave TXT with the given serial number does not exsist. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to master TXT | | *in* | **sn** | serial number | Return: pointer to slave object ## Utility Functions ### const char * ftop_get_name(fttxt2 *device) Returns the TXT's name. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to TXT | Return: TXT name ### int ftop_get_version(fttxt2 *device) Returns the TXT's version. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to TXT | Return: TXT version ### int top_get_firmware(fttxt2 *device) Returns the TXT's firmware version. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to TXT | Return: TXT firmware version ### unsigned int ftop_get_slaves_number(fttxt2 *device) Returns the number of slave TXTs in the network. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to TXT | Return: number of slaves ### uint32_t ftop_get_txt_uid(fttxt2 *device, unsigned int number) Returns the uid for the TXT with the given network id. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to master TXT | | *in* | **number** | network id | Return: slave's uid ### const char *ftop_get_txt_name(fttxt2 *device, unsigned int number) Returns the name for the TXT with the given network id. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to master TXT | | *in* | **number** | network id | Return: slave's name ### const char *ftop_get_txt_SN(fttxt2 *device, unsigned int number) Returns the serial number for the TXT with the given network id. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to master TXT | | *in* | **number** | network id | Return: slave's serial number ### void ftop_txt_mode(fttxt2 *device, int mode) Sets or changes the TXT's mode. Pass 0 for single mode, 1 for master mode and 2 for slave mode (see [ft_txt_mode](c_fttypes.md#fttxtmode) enum). | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to master TXT | | *in* | **mode** | new mode | ### void ftop_txt_name(fttxt2 *device, const char *mode) Sets new name for the TXT. A name is a 16 character string. The name can shorter. | Type | Paremeter | Description | | ------- | ------------ | ---------------------- | | *in* | **device** | pointer to master TXT | | *in* | **name** | new name |