Task:

From the phone (iOS) send a signal to the computer (OSX) and simulate pressing a hot key there ...

Question:

  1. Is it possible to do this WITHOUT a signal receiving program? If so, how? (as far as I know, there is a fairly close interaction of the axes on the phone and the computer, so I admit that there is such a possibility). If there is no such possibility ...
  2. How do you advise to start? How to implement a signal transfer to a computer paired with a telephone (into a receiver program)? How to realize maximum energy conservation? (For example, using bluetooth or something else)

Purely for yourself (unimportant information, you can not read):

Simulate keystrokes in Swift 3:

let src = CGEventSource(stateID: CGEventSourceStateID.hidSystemState) let cmdd = CGEvent(keyboardEventSource: src, virtualKey: 0x38, keyDown: true) let cmdu = CGEvent(keyboardEventSource: src, virtualKey: 0x38, keyDown: false) let spcd = CGEvent(keyboardEventSource: src, virtualKey: 0x31, keyDown: true) let spcu = CGEvent(keyboardEventSource: src, virtualKey: 0x31, keyDown: false) spcd?.flags = CGEventFlags.maskCommand; let loc = CGEventTapLocation.cghidEventTap cmdd?.post(tap: loc) spcd?.post(tap: loc) spcu?.post(tap: loc) cmdu?.post(tap: loc) 

And on the link is a fairly large list of digit-key values.

    1 answer 1

    1. As far as I know, there is no such possibility without a receiver program.
    2. Again, in my experience, the Cocoa and Cocoa Touch (NSURLSession) standard network APIs are designed to interact over the Internet. This method will be much easier to learn, and even better in energy saving than Bluetooth, since the network module already works, and Bluetooth must be turned on separately. If Bluetooth is necessary (for example, for speed or security), then for this there is a Core Bluetooth framework, Apple Developer has enough information for it for your tasks. I do not know whether to worry much about energy saving, standard operating system tools should take care of this in this particular case. For more specific advice on this, refer to the Best Practices For Interacting With Remote Peripheral Device article in the Core Bluetooth documentation.