UBogun / Xojo-pigpio

A Xojo library for pigpio features in Raspberry Pi projects
MIT License
2 stars 2 forks source link

Remote GPIO and Mac builds. #1

Closed sarossell closed 6 years ago

sarossell commented 6 years ago

I've used the pigpio Python library commands via shell commands in Xojo on the Mac, but I was hoping for a more elegant solution without the Python middle-man. I was excited to see you had created a Xojo module for pigpio, but due my lack of experience, I can't quite make heads nor tails of it, so please forgive my ignorant questions. I read the Read.me and looked at the code in depth, but I'm still at a loss.

It appears as if the module can only be compiled for the Raspberry Pi. Is this true or are the commands for remote GPIO included that would allow me to write an app for the Mac to connect remotely to the pigpiod daemon over the network?

UBogun commented 6 years ago

You‘re right. This is a pure declare library for the Pi that makes the pigpio C API accessible for Pi Xojo projects. You could, however, use it to create your own Pi daemon that uses some Xojo inter-app communication feature to talk to the Mac app.

sarossell commented 6 years ago

With my painful lack of experience with programming, it will be quite a while before I can consider attempting to create any kind of daemon from scratch. So, it's good news it's possible, but bad news that it's up to me to accomplish it. I'm a retired technical writer. I picked up a lot of things about programming and various languages over the past 35 years, but the only meaningful programming I ever did, before about a year ago with Xojo, was with Gfa Basic on my Atari Mega ST.

I've been trying to avoid learning Python, but considering the fact that everything has already been built in Python (including the pigpio socket daemon) and I know I can interact with Python in Xojo, I'm guessing I have no choice but to start there until I have enough skill to write my own. After all, as I understand it, it's just a console app run as a service, right?

I kind of knew I was climbing a steep hill in hoping that a relatively obscure language like Xojo would just happen to have a library already compiled for it that does exactly what I want to connect to a completely different computer platform to remotely control it's functions. As it stands, I'm thrilled I ran across your efforts. Gives me hope. Thanks!

UBogun commented 6 years ago

Do you have to learn Python if you want to employ the daemon? As far as I understood, it opens a port, so you could use a Xojo server socket and communicate with the daemon by sending a few command bytes to it. That’s not too difficult and the commands are well documented. Plus you would not have to add a Python layer which would surely influence the overall performance.

sarossell commented 6 years ago

Therein lies my question. I don't know. I hope so. It seems that would be the case. I just don't know how. I posed this same question on the Xojo forum (https://forum.xojo.com/47706-remote-gpio-with-xojo) and got a whole bunch of different solutions, but nothing quite as close as what you just mentioned.

My biggest challenge right now is that I don't know what I don't know, so I don't know what to ask. I will definitely look into the Xojo socket method you mentioned. However, It would be ideal if I could find someone else with more experience with these methods who's interested in doing what I'm trying to do; a mentor as it were.

I find I don't need much. I'm good with example code. Hopefully, I will be able to find some example Xojo socket code that makes some sense to me in this situation.

Please feel free to drop into the conversation mentioned above. Maybe it will spark someone to take pity on me and help with some code snippets. The problem with Xojo is you can't just go out and buy a book like you can with Python or C. Xojo has one book. ONE! It's a really good one, but it was written by Xojo and is really just an introduction to the language.

To be honest, I've kind of painted myself into a corner. I chose to try to control another computer of a completely different CPU architecture remotely, over wi-fi, using a language (Xojo) few people know about on a Mac. That's like trying to go to the moon in a hot air balloon in the 19th century. But Xojo is just so darn easy to work with. :@)

UBogun commented 6 years ago

I did write a small proof of concept about a FileMaker-Xojo connection using a ServerSocket, which should be quite similar. You could also investigate Aloe Express which does the same for Web content but might be a little sophisticated to be understood easily.

I don‘t see you in that corner so much. The CPU architecture models don‘t matter when you are using sockets to communicate. There are a lot of examples on (RESTful) API usage on the forum.

And about the book: Yes, there is no current written book about Xojo on the market. Besides the intro and the handbook – you found that too? –, the old Definitive Guide to RealBasic still has a lot of valid content and there are a lot of specialized PDFs and eBooks available, especially at the XDev library.

Anyway: I hope you don‘t mind if I close this issue now and join you on the forum thread.

sarossell commented 6 years ago

Thanks for you help. Much appreciated. See you on the forums. :@)

UBogun commented 6 years ago

Solution: https://forum.xojo.com/47706-remote-gpio-with-xojo