title: Redundant master slave system and Getting data from specific slave module
body: <p>I am dealing with Master-Slave model as follows:</p>
  
  <pre><code>  Person &lt;-------- Master controller ---
                                          |                
                                          |----------|---------.......---------|   
                                       Slave1     Slave2                     SlaveN
  </code></pre>
  
  <p>Master is controller unit and slaves are DC-DC modules. Master and slave units communicates via Basic Serial Interface Protocol (BSIP) over RS485 interface or SCI interface. Master controller also gives data access to person using Modbus over Ethernet. 
  The controller code is written in C language (via automatic code generation using python).</p>
  
  <p>My question is :
  What code should I write for developing master-slave communication so that I do not have to repeat same code for all slaves (redundancy). Also by doing this I also want to implement if a "Person" can access only data from the slave he asks for. For example if a "Person" wants some specific data from slave 3, what structure should I use?</p>