I have Ipad control of my layout, using various "division" maps to control turnouts and uncouplers. I am using a system Designed by Dave Hikel. It works with DCC using a box he designed that translates the MTH control functions, for use using DCC Traincontroller software. Traincontroller is a DCC layout control software, so you can program the layout to do a lot of things, include running trains in an automatic mode, where the train will stop if the block ahead is occupied.
Works well for me, however there is some stuff to buy, as you need to add DCC to the layout, allowing you to add track occupancy detection. I use NCE AIU (other brands will work just as well) to detect what blocks are occupied. This occupancy detection is also used for my block signalling using Custom Signals supplied hardware.
If you contact Dave (a member of this forum), he can explain things better than I.