Kuwait
Asked — Edited

ARC Mobile App And Firebase

Hi:D I have a simple question please

when making ARC mobile app; can i connect the app with Firebase Realtime Database to read and store variables? i want to use those variables to start and stop scripts...

thank you:)


ARC Pro

Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.

PRO
Synthiam
#1  

If you create a plugin you can. I don't think that exists at the moment by anyone.

#2  

how about mySQL or any other database? Is there an already made plugin for any kind of database? confused

PRO
USA
#5  

Quote:

... ARC mobile app ...

ARC mobile does not support plugins.

Only ARC Desktop (Windows 7+) supports plugins.

#7  

Oh thanks! @ptp then there is no way to connect the mobile app of ARC to a database?

#9  

Can you explain this code for me? I assume you are storing and getting the value of the variable from a certain website, which means you are using a webpage as a database for storing and getting variables. Am i correct?

PRO
USA
#10  

Correct.

I assume if you have a web script or an web api you can get or set values using the HttpGet function.

#11  

@ptp Cool! Is there any kind of web script or web api that you recommend?

Should i use javascript or PHP? And for the database; can i use phpMyAdmin?

PRO
USA
#12  

Some points:

  1. Ez-script httpGet fetches the content from an url on a remote server.

  2. You will need to be able to reach the remote server from ARC mobile application e.g. local or internet server.

  3. Your remote script runs on the remote server, you need to parse the query string and performs the operations i.e. GET, SET and returns plain text. If is a SET operation you should return OK or something similar, if is a GET should return the variable value or empty/default value if does not exist.

  4. Language and database ? You should pick whatever you are familiar with e.g. PHP/mySQL, NodeJS or ASP.NET Core are good options.

IPIA_KU:

Quote:

... Database to read and store variables? i want to use those variables to start and stop scripts...

I presume your plan is to do something like this:


if (HttpGet("http://this.is.an.example.com/sample-application/get?name=script1enabled " )="1")
    ControlCommand("Script 1", ScriptStart)
endif
if (HttpGet("http://this.is.an.example.com/sample-application/get?name=script2enabled " )="1")
    ControlCommand("Script 2", ScriptStart)
endif

#13  

@ptp EXACTLY! :D thank you so much! :)

#14  

@ptp


$temp = HttpGet("http://192.168.1.101/phpmyadmin/sql.php?db=games&table=game&sql_query=SELECT++%60gname%60+FROM+%60game%60" )
ToString( $temp )
Print($temp) 

i wrote that code with the intention to test that I get the contents of the database but it displayed the inspection of the page instead like:

<!DOCTYPE HTML><html lang='en' dir='ltr'><head><meta charset=&quot;utf-8&quot; /><meta name=&quot;referrer&quot; content=&quot;no-referrer&quot; /><meta name=&quot;robots&quot; content=&quot;noindex,nofollow&quot; /><meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=Edge&quot; /><style id=&quot;cfs-style&quot;>html{display: none;}</style><link rel=&quot;icon&quot;

that's only part of what it displayed. i couldn't post it all because it is very long.

so what did I do wrong? I want to get the contents of the database from the link.. :( and the link I used only for local not on a remote server yet. so was that the cause maybe of what it displayed to me? I wanted to test first if it works with local then I will try to make it on remote. but unfortunately it did not even work for local ^.^;

#15  

The issue you are having is that the httpget command reads the entire web page that is returned, so on your database side, you need to create a very simple web page that just displays the returned data in plain text, and then you still need to parse the data out of the http headers and footers from your returned data variable into a variable the project can use.

A question I often ask when people are trying to do complex things with the mobile app. Is there a reason you need to be using the mobile app? ARC is far more extensible in Windows, and it provides two different web servers that can be used to create a nice mobile interface as long as the robot, Windows computer, and mobile device are on the same network (or can communicate with each other, there are certainly ways to do this over the internet as well).

With ARC you could much more easily create an ODBC or JDBC plugin, or use one of the many existing methods of transmitting and retrieving variables from external sources.

Alan

#16  

@thetechguru

Quote:

and then you still need to parse the data out of the http headers and footers from your returned data variable into a variable the project can use.

by "parse the data" do you mean to use toString() function?

Quote:

you need to create a very simple web page that just displays the returned data in plain text

do you mean I should only make HTML file and write text into it? but then how does this is considerd as a database? we will be reading line by line how will i know where exactly to store or which line exactly will have the data i need.. :/

Quote:

Is there a reason you need to be using the mobile app?

our senior project is about a robot that plays with children various games written in ez-scripts. so we want to use ARC mobile on an iPad where there is a start button the child can press and then the robot will start playing the ez-scripts containing the games. but in which order the games will start? this is decided by a mobile application created with xcode where the parent will use to schedule games. the schedule of games will be stored on a database and EZ-Script must read from the database to know which game or which script(containing the game) to start first.

#17  

Quote:

by "parse the data" do you mean to use toString() function?

Someone else will have to answer. I have not done a lot of string functions in ARC, I just recognize what the issue is. Basically, you will need to use functions that extract just the answer of your query from the returned web page.

Quote:

do you mean I should only make HTML file and write text into it? but then how does this is considerd as a database? we will be reading line by line how will i know where exactly to store or which line exactly will have the data i need.. :/
No, I am saying that your web front end to the database needs to return a simple easily parsed page when you send your query via httpget. If you are getting a lot of extraneous data, it is probably mostly stuff for displaying the return in nice human readable format, with colors and boxes and stuff (if you have a publicly accessible example, I can take a look and be more specific). What you want it an easily machine readable return because no human will be looking at it directly.

I won't quote your third answer. Good enough reason.

Alan

#18  

Quote:

ARC is far more extensible in Windows, and it provides two different web servers that can be used to create a nice mobile interface as long as the robot, Windows computer, and mobile device are on the same network

hello, by "mobile interface" do you mean the one we find in ARC: Project >> add control >> mobile ? do you know if i can create my own mobile interface plugin? so i can provide it with database connections and display videos on the mobile screen? i'm currently working on making a firebase plugin; so if there is a way i can create a mobile interface out of this plugin, it would be really great and helpful! blush

#19  

No, I meant the Http server or Http server (custom) . You can design a web page hosted by ARC on the PC and accessed by your mobile browser. By doing this, you have the best of both worlds. The full power of the PC running the app, scripts, and plugins, and a mobile interface to access it.

The object you mention creates a mobile project for ARC Mobile (either iOS or Android) but it is somewhat limited, like no plugins.