iOS GUI for program that uses command line API? - ios

I'm trying to make a GUI frontend in iOS for a chess-like game engine where the API via std input/output. The API it adopts is called the Universal Shogi Interface. It allows decoupling of the GUI and engine so that one can swap out either component without much trouble.
This works fine when building and running via Terminal of course. I also know that I can create a macOS GUI for it by using NSTask but how would I incorporate such a program into an iOS app where NSTask isn't available?
Is there a way to spawn a subprocess in iOS which I can then connect UI buttons to send text commands to the subprocess? (and likewise, labels to read stdout from the program)
Or is would I have to go into the source code of the engine and connect call the functions themselves? That seems like it would defeat the purpose of having a GUI protocol in the first place. Or would I have to port the entire engine into Swift myself?

It isn't clear what you mean by "...the engine GUI protocol is to communicate with it via text commands via std input/output." GUI stands for "Graphical User Interface". A terminal based text interface is the exact opposite of a graphical user interface. It's a command-line interface. Do you mean that the API (not GUI) to the game engine is through a command line?
iOS dos not let apps spawn sub-processes of any kind. You can build third-party frameworks into your app, and those third party frameworks might have an API that takes commands in the form of text input.
It might also be possible to have a 3rd party app running at the same time and taking commands via a custom URL scheme, but iOS doesn't really support the kind of multiprocessing where this makes sense, unless maybe you're using the split-screen interface on iPads in iOS 10 & 11, and I'm not sure if/how well that would work.

Related

JclAppInstances between service and desktop

I'm using the following code in an application that automatically detects when it is run whether it is running as a service or desktop application and behaves appropriately for the situation.
JclAppInst.JclAppInstances('<application descriptive label>').CheckSingleInstance;
The code is embedded into an initialization block at the bottom of a unit that contains code responsibility for acknowledging the service status and displaying key desktop information so I know this unit is included in both modes of operation. The CheckSingleInstance call works perfectly in desktop mode making sure that only one instance is run but doesn't seem to be able to detect if the application is currently running as a service.
Unfortunately I can't work out why the JclAppInstances would be affected by the difference. Both instances are running from the same folder but are operating as different users (ie service user differs from desktop user) but my understanding is different users should work.
Does anyone know whether it is possible to do this with the JclAppInstances and if so what my problem is?
It seems quite clear that the JclAppInstances class doesn't support the required functionality and any solution based on using this Jedi component should refer to the following StackOverflow answer instead.
one instance of app per Computer, how?

Send data from one console application to another

I am working on a project that will essentially run each part of a program on a complete separate computer. Reason for this because these are data servers, gaining data from a target program launched on the main users desktop. (very CPU intensive)
The application just needs to be able to send data and things like this across a network.
One is a Console app and the other is a C# made operating system(Technically WPF, but replaces windows and just leaves a kernel).
So how would I go about doing this?
Since both applications are in C#, the easiest way will be to use Windows Communication Foundation (WCF) - https://msdn.microsoft.com/en-us/library/ms734712(v=vs.90).aspx
It allows you call remote methods as though they are just plain local methods.

Communication issues between Arch Linux and iPad

I'm running Arch Linux and the Bluez libraries on my computer, and I'm trying to connect to an iPad [w/ Retina] over BLE. I can see the iPad in bluetoothctl, pair it, trust it, and connect to it. My question is in two parts:
1) I want to be able to select the attributes, more specifically for the MAP service. However, running
list-attributes
either during or outside of the connection returns no information.
2) My iPad cannot see the computer like it can see the iPad, either through the Settings --> Bluetooth menu or the CBCentralManager in an app that I'm developing. My computer is set to be discoverable and pairable forever, but it just doesn't find it.
How would I be able to connect to the iPad appropriately, if there even is a way?
Disclaimer to anyone using BlueZ user space tools:
OP mentioned in the comments that he utilized hcitool. It's best not to use hciconfig nor hcitool as these are in the process of
being phased out of BlueZ and have been unmaintained for a very long
time. They are prone to errors and the raw calls these programs make are blocking and cause interference with other Bluetooth applications.
BlueZ publishes some methods in order for users to use its Bluetooth (LE) functionality for applications or tasks: DBus and a lower-level approach. Programs included in the BlueZ user space package include bluetoothctl, which uses DBus for bluetooth related tasks, such as scanning, advertising and GATT. Tools like btmgmt, which can be considered a maintained version of hcitool, use the lower level libraries. BlueZ recommends using the DBus API for applications. Be sure to have compiled the source code and have followed the recommended instructions to use the mentioned tools. Also always check the licensing on mentioned tools and source files as some can not be included in proprietary software.
DBus-less solution:
If using bluetoothctl or DBus doesn't work out for you, I would suggest you use btmgmt. It can be found in the /tools folder of the user space source code.
If you're looking for or wanting to include GATT-related tasks, you can use btgatt-client to act as a GATT Client or btgatt-server to act as a GATT server from that same /tools folder.
These do not use DBus, nor the corresponding Bluetooth Daemon (bluetoothd) like bluetoothctl does
DBus solution:
What is most likely the cause of you not seeing services using bluetoothctl, however, is that you are not running the aforementioned bluetooth daemon with the -E flag (experimental). Currently, all GATT-related functionality is only usable when running in this experimental mode. (They're working to get it out of experimental-only mode) I think because it's still being developed. If I recall correctly BlueZ can also be configured/installed in this experimental mode, so that no manual actions are required.
To restart the BlueZ Daemon (bluetoothd) with GATT enabled run:
sudo service bluetooth stop && bluetoothd -E
In most cases, when stopping the bluetooth service, your bluetooth controller will power down and bluetoothctl won't respond to user input/freezes on startup. If this is indeed the case, use btmgmt and issue a power on to power the bluetooth controller again.
To VIEW the MAP service attributes, use list-attributes to view them. Ensure proper spelling. To SELECT the MAP service, you need to list-attributes then select-attributes, in that order.
It sounds like your ipad is having a problem. Perhaps try turning it off and on again. Make sure you have bluetooth enabled!
There is always a way!

Is there an API for SMART?

Developing a NAS system at the moment and I want to use SMART to monitor the state of the harddrive in the NAS. I have looked at tools like smartmontools smartctl and smartd however I want to have more control over the what I tell the NAS to react to when different errors occur. smartd supports running scripts but it is not preferable. Is there an api preferable in c that one can use to speak with a SMART HDD?

How is SkypeKit different from programming with the Skype API?

I have a lot of experience writing Delphi 6 Pro apps using the Skype API. I don't use the COM object but instead I interface directly with the Skype client using the SendMessage() system. My current application acts as a full duplex audio proxy with video transmit. To transport audio I use ALTER CALL with the PORT parameter to establish a duplex audio connection with the Skype client via a pair of sockets. For sending video I have a DSPACK based DirectX filter that I instruct the Skype client to select as the chosen video device. This works fine but since it's the Skype API I have the awkwardness of interfacing with the Skype client as a separate entity.
Now along comes SkypeKit which apparently allows a developer to integrate Skype in a much more integrated manner. I'm about to dive into it and I wanted to hear from any developers out there that switched over from the Skype API to SkypeKit. Some questions:
Was there anything missing from SkypeKit that is offered via the Skype API that made your app conversion difficult if not impossible?
Do you have any tips on making the transition as smooth as possible, especially when it comes to avoiding any design choices that can really come back to haunt you when you get far down the SkypeKit path?
Did you find any web resources or documentation from other developers that were really helpful in saving you time or trouble? (Please share links if so).
I am using SkypeKit in my chat-centric Java application so I haven't dealt with A/V.
SkypeKit is just a “black box” program that interacts with Skype protocol by iteslf. It is an executable that starts a process which listens on local port. The process is lightweight, only 20mB on my Windows-based developer machine. It runs completely in background, there are no any notifications at startup/messaging/shutdown.
Your client program interacts with it by sending byte structures via local SSL tunnel. These structures are wrapped by API for C++, Java and Pyton. Java API is easy. You start the process, create new Skype() object and login with your Skype account credentials and get your program callbacks execution when some events happen.
So #Whiler is not completely right, you always need a host application, but in this case this one is small and fast.
I don't know how hardware-based kit works but I think it is a more low-level way.
You can read the Java API here, C++ API (with examples) here, and Python (with examples) here.
Oh, and at least one small difference between desktop API and kit-based one: you can post XML text in the chat.
SkypeKit is no longer supported - https://support.skype.com/en/faq/FA12322/is-skypekit-being-discontinued
Disclosure: I used work for Microsoft/Skype
The main difference between SkypeKit and the other solutions (sendmessage, COM) is that the Skype client application is not needed... you can directly interact with the skype network...
I haven't dig this solution as the access is not free (not expensive, but without real projet, this was a no go for me...).
So this can be very useful if you plan to replace the real skype client with your own software on final machine... but if you just want to interact with an existing one, I'm not so sure.

Resources