Controlling Arduino with Android app using firmata

Hi lads,
I have made a android app using Ionic framework that communicates to arduino via bluetooth (HC06). Right now, I can simply turn off/on an already programmed port through bluetooth. However this is not really a very useful for real life applications. I would like to increase or decrease the number of pins used on arduino and be able to control them individually, which will allow me to add/remove component like lights, relays etc.. at any time without having to code my app and arduino (specially arduino) again and again.
My question is how can I implement something like johnnyfivejs in Ionic App which uses HTML and Angularjs, or how can I activate or deactivate (setting up pins as input or output mode) an arduino PIN through my app by simply sending some string commands?
I hope my query is clear.
I would deeply appreciate any help.
Thank you lads.

I hope my query is clear.

Perfectly. The problem is that it hasn't a damned thing to do with the Arduino.

PaulS:
Perfectly. The problem is that it hasn't a damned thing to do with the Arduino.

"or how can I activate or deactivate (setting up pins as input or output mode) an arduino PIN through my app by simply sending some string commands?"

I think you should have read my post thoroughly. Thank you.

I think you should have read my post thoroughly. Thank you.

Well, I think that you should have left all the crap about johnnyfive out of your post, since that has NOTHING to do with the Arduino. You are welcome.

The key to having the Arduino understand "Please turn pin eight into an input pin, and turn it off" is to NOT send crap like that. "<I, 8><L, 8>" conveys the same data (make pin 8 and input; make pin 8 LOW) in a way that is easy to parse and act on.

Defining the commands that the Arduino is to understand is called developing a protocol. As long as both sides agree on the format of the commands (read, write, input, output, etc.) and the order of data in the commands, each end can format or parse the command string properly.