Getting into LiveCode for iOS? Ask your questions here.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
seaniepie
- Posts: 154
- Joined: Wed Sep 07, 2011 10:56 am
Post
by seaniepie » Mon Sep 19, 2011 2:38 am
Hi All,
Just been getting back into the swing of Rev. Working on a project that has a requirement to make use of the rreSocket SDK. It's communicating via a wireless RS232 transceiver to a custom built PIC logic board. First up I get it to connect to the wireless unit. No problem. Makes the connection right away as expected.
So then I have to pass it a string to get it to enter Command Mode so I can adjust some of its settings in the background. To do this the command must be "$$$" with no character return (<cr>) or anything else for at least 250ms. Easy I thought. Simply adjust one of the LiveCode button scripts to read
Code: Select all
rreSocketWrite pSocket, "$$$","commandMode"
Apparently, that's not enough. The device receives the message but the 'on commandMode' doesn't get triggered.
So I went to the Xcode script and tried adjusting the NSData for the "$$$" command but that did nothing. I tried to use an LCObjectSend to get some idea of what was going on but couldn't work out how to get that to work - The user guide doesn't explain it very well. The debugging kinda sucks at the moment. Hopefully some of you guys can help me out cause I'm at a loss now. Hit a brick wall. I'm sure if I just get past this problem the rest of it will fall into place - famous last words.
Cheers
Seaniepie
-
seaniepie
- Posts: 154
- Joined: Wed Sep 07, 2011 10:56 am
Post
by seaniepie » Mon Sep 19, 2011 7:08 pm
23 Views and no replies. Thanks for looking but I could do with some help here!
I've been in touch with Roving Networks who make the RN-131G I'm using and trying to connect to. They say they can sell me some source code for $750. Well, gee, thanks! That's half my budget and all my profits gone! How about this. You help me code it and I'll buy 100 of your devices. Idiots, help the customer.
Anyhoo, If anyone can help I'd much appreciate it.
-
wsterdan
- Livecode Opensource Backer

- Posts: 16
- Joined: Sat Oct 30, 2010 2:57 am
Post
by wsterdan » Tue Sep 20, 2011 5:46 am
Hi;
I don't believe sockets are supported at this time; the latest iOS release notes in the "What doesn't Work" section still reads "socket syntax and functionality (planned for a future release)".
One way to test it would be to run the same code from the desktop and see what happens.
Hope I'm wrong, let us know how it shakes out.
-- Walt Sterdan
Oops, just catching up and found that in another thread you do have sockets working (I assume you're using something newer than the official release).
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Tue Sep 20, 2011 9:46 am
Hi,
Seaniepie, $750 is not a bad deal, although selling 100 devices should also be in their interest. I might be able to help you, but I would charge a similar amount (and I have no devices to sell).
Walt, sockets seem to be supported on a limited basis by the rreSocketWrite external, even though "supported" may be not exactly the right word. The put URL and get URL commands seem to be fully supported.
Kind regads,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
seaniepie
- Posts: 154
- Joined: Wed Sep 07, 2011 10:56 am
Post
by seaniepie » Tue Sep 20, 2011 3:06 pm
It's ok, everything is sorted.
Turns out everything I was doing was correct. The device, a Roving Networks RN-131G evaluation kit, had been configured wrong. After chatting with RN it appears that the reseller must have sold me a secondhand one as brand new and someone had set up the trigger for the command mode from being $$$ to %%%. RN themselves were not much use except for saying 'well, it should just work'. I knew that. I eventually decided to try the entire ASCII character set to work out what was stopping it from entering command mode. so after £££, &&&, ***, :::, @@@ I eventually tried %%% and low and behold the CMD return came back and all was hunky dory again. Now I'm whizzing through my code.
Can I just say while I'm here though that this whole process is made just sooooo much easier because of the high level language LiveCode uses. On top of that I have to convert a CSV file to SQLite for my program. You guys know how many lines of code that would take in Xcode OBJ-C right? In LiveCode its just 7 lines - in plain english. It's frikin awesome!!
And the SDK, while needing an overhaul on the guidance notes (they need to be in more Apple style format for the ObjC/C/C++ stuff), is so useful and can be adapted to handle pretty much anything. A little bit of tweaking on their demo of Sockets and it just works. Applying them to other projects (i.e., adding extensions to another project) also need better descriptions. If anyone needs help give me a shout.
Thanks for replying though Mark. I still believe that a manufacturer of a device should offer that kind of code for free when buying the device off them. It's like buying a Sony DVD Recorder and getting it with no manual. Sure you can flounder around the product but not really put it to any proper use. How can we put their devices to use in the form they have it with out having any guidance on how to script for it. It's in their best interest for the sale of their goods (especially when we have already bought them!).
All the best
Pi
-
rca
- Posts: 16
- Joined: Wed Aug 03, 2011 8:22 pm
Post
by rca » Wed Oct 05, 2011 1:23 am
Hi Pi
I have been using the Roving Networks products as well - let me know if you are interested in collaborating on some runrev/ios/RN development
r
-
seaniepie
- Posts: 154
- Joined: Wed Sep 07, 2011 10:56 am
Post
by seaniepie » Mon Oct 17, 2011 2:58 pm
Hi RCA,
I would be interested in collaborating with you. You don't have any contact details available so pm me when you have a chance.
All the best
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Mon Oct 17, 2011 3:20 pm
Hi,
I don't think you can PM people. You need to leave your e-mail address, e.g. bS5zY2hvbmV3aWxsZUBlY29ub215LXgtdGFsay5jb20=
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
seaniepie
- Posts: 154
- Joined: Wed Sep 07, 2011 10:56 am
Post
by seaniepie » Mon Oct 17, 2011 5:37 pm
Ah ok, thanks Mark.
My PM address is sean at pidigital dot co dot uk
Continuing the thread, I've been sending data via the rreSocketWrite command and this has all been going fine because I was just sending individual packets of data. Now I'm trying to send a batch. It packet has 5bytes of data. It sends the first ok using
rreSocketWrite tActiveSocket, tBitString, "write"&tLampNo
but when the repeat loop goes to the second it gets stuck at this command. I'm assuming so far that this is because it is waiting for a return message to say it completed (which will never come) so it still has the first write command sitting and waiting. Any clues as to a way around this?
cheers
Sean
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Wed Oct 26, 2011 11:42 am
Hi Sean,
I think you need to find a way to "timeout" the attempt to write to the socket. I didn't look at the external myself yet, so I don't know how that would work.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
seaniepie
- Posts: 154
- Joined: Wed Sep 07, 2011 10:56 am
Post
by seaniepie » Wed Oct 26, 2011 4:34 pm
I wrote to support but got no reply. For now I've ended up storing up the data stream to transmit, send on as a big message then close the connection. I then have to reestablish the connection before sending the next batch.
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Thu Oct 27, 2011 1:33 am
Hi,
Thanks for telling how you solved this. It'll be good to keep that in mind when I have to do something similar.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode