I have 3 devices that communicate via a serial port. Let's call them Device 1, Device 2, and Bluetooth (BT to serial adapter). The BT is used to communicate with a computer, but it can be treated just like a 3rd device for the purposes of the question. There are 3 modes I need this setup to function in. Mode A would have Device 1 be connected to the Bluetooth, Mode B would have Device 2 be connected to the Bluetooth, and Mode C would have Device 1 and Device 2 connected to each other. Please see attached image for a diagram to make things clear.
I can switch between modes with a 3 way switch or a button. What I am looking for is a way to switch between these 3 modes. I have considered just using a mechanical switch, but given the number of connections, and considering that my final project needs to be very small, this is impractical.
My ideal solution would be to use some kind of IC that would allow me to foreword a serial signal from one pin to another, depending on the mode selected, or a set of transistors that would allow me to switch between different modes. But I am completely open to any other, better, solution.
Any help or pointers in the right direction would be very appreciated. Thank you!