Apple TV gen 2 will send optical audio signal when i patch it though a TOSLINK 1to2 splitter to my Bose speaker
You need a optical switcher, not a spitter. A splitter has one input and distributes to two (or more) outputs, and is not reversible.

Two possible products are available from Amazon and Audio Authority. The second does automatic switching, which may be what you're looking for.

Disclaimer: I have no financial or otherwise tangible connections to either Amazon.com or Audio Authority.