Bluefruit LE App - custom labels

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
southernatheart
 
Posts: 79
Joined: Tue Mar 22, 2011 10:54 pm

Bluefruit LE App - custom labels

Post by southernatheart »

Is it possible to customize some labels in this app? Adding labels like "Den Light" "living room blinds", or Fan high, medium, low...
This sure would make the app useful to Arduino DIYers.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluefruit LE App - custom labels

Post by adafruit_support_mike »

I don't think there's a label configuration interface in the app itself, but the project files are available here: http://github.com/adafruit/Bluefruit_LE_Connect

Editing button labels in Xcode is pretty easy.

User avatar
southernatheart
 
Posts: 79
Joined: Tue Mar 22, 2011 10:54 pm

Re: Bluefruit LE App - custom labels

Post by southernatheart »

Don't we have to have an apple developer license to edit and install the app on our iphone?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluefruit LE App - custom labels

Post by adafruit_support_mike »

I'd have to check Apple's terms of service.. I'm registered myself, and it's easy to forget limits once they're gone.

IIRC, it's possible to load things onto a personal device without having to pay the $99 registration, you just can't distribute it anywhere.

User avatar
southernatheart
 
Posts: 79
Joined: Tue Mar 22, 2011 10:54 pm

Re: Bluefruit LE App - custom labels

Post by southernatheart »

I've used xcode a little, to work with AppleScript and make a form, but it looked all around the different files in your test app for a place to edit labels and couldn't find anywhere. Can you give me a idea or where to start or which file to look into to add labels. Thanks

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluefruit LE App - custom labels

Post by adafruit_support_mike »

Let's see..

The interface lives in the '.xib' files, which are stored in the 'UI' folder in the Xcode project. The ones whose names start with 'PinIOViewController' seem to be the relevant ones, and it looks like those are just starter templates that get copied and named in the code.

Our coders have good naming habits, so the code which creates the pin views will probably be in the file 'PinIOViewController.m'.. and yes, there's a function named 'initializeCells' in there.

That loops over the pins by number, creating a new cell object and assigning information to each one. This section looks like a pretty strong candidate for the field names:

Code: Select all

        //Assign properties via tags
        cell.pinLabel = (UILabel*)[cell viewWithTag:100];
        cell.modeLabel = (UILabel*)[cell viewWithTag:101];
        cell.valueLabel = (UILabel*)[cell viewWithTag:102];
which, as an aside, seems to be searching for the labels using the 'tag' attribute rather than linking directly.. that makes sense in a situation like this where we're copying the template over and over.

The item named 'pinLabel' seems like a probable candidate.. and yes, we have a match between the viewWithTag parameter of '100' and the tag of the text field that says 'Pin 1' in the .xib file.

That means this line sets the name of each cell:

Code: Select all

            cell.pinLabel.text = [NSString stringWithFormat:@"Pin %d", cell.digitalPin];
You can assign arbitrary names by creating an array of NSString objects :

Code: Select all

    NSArray * buttonNames = [NSArray arrayWithObjects:
        @"Foo",
        @"Bar",
        @"Baz",
        @"Quux",
    nil];
then using the loop index to select those:

Code: Select all

            cell.pinLabel.text = [ buttonNames objectAtIndex: i ];

User avatar
southernatheart
 
Posts: 79
Joined: Tue Mar 22, 2011 10:54 pm

Re: Bluefruit LE App - custom labels

Post by southernatheart »

Code: Select all

  NSArray * buttonNames = [NSArray arrayWithObjects:
        @"Foo",
        @"Bar",
        @"Baz",
        @"Quux",
    nil];
Where do I paste this in the code? I tried putting it in the function "- (void)initializeCells{", but I get a triangle error symbol that says "unused variable - buttonNames". Do I have to set buttonNames as a variable somewhere else. Sorry, I just know a little about Arduino C programming.

Then I assume I replace the line

Code: Select all

            cell.pinLabel.text = [NSString stringWithFormat:@"Pin %d", cell.digitalPin];
with

Code: Select all

            cell.pinLabel.text = [ buttonNames objectAtIndex: i ];
?

User avatar
southernatheart
 
Posts: 79
Joined: Tue Mar 22, 2011 10:54 pm

Re: Bluefruit LE App - custom labels

Post by southernatheart »

I changed it slightly to this and it builds:

Code: Select all

NSArray * buttonNames;
        buttonNames= [NSArray arrayWithObjects:
                                 @"Start",
                                 @"Stop",
                                 @"Fan",
                                 @"High",
                                 nil];
And I replaced the line

Code: Select all

            cell.pinLabel.text = [NSString stringWithFormat:@"Pin %d", cell.digitalPin];
with the new line, and it builds. Now to figure out how to load this app to my iPhone! If this is possible, this will really be cool!!

User avatar
southernatheart
 
Posts: 79
Joined: Tue Mar 22, 2011 10:54 pm

Re: Bluefruit LE App - custom labels

Post by southernatheart »

IIRC, it's possible to load things onto a personal device without having to pay the $99 registration, you just can't distribute it anywhere.
I am only coming up with: I have to pay $99 a year!
Am I missing something somewhere? It really would be nice to be able to customize this app to suite my uses...

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluefruit LE App - custom labels

Post by adafruit_support_mike »

You'll probably need to check with Apple. Like I said earlier, I'm already registered as an Apple Developer so I don't see a lot of things that people new to the platform do.

User avatar
southernatheart
 
Posts: 79
Joined: Tue Mar 22, 2011 10:54 pm

Re: Bluefruit LE App - custom labels

Post by southernatheart »

It is clear that us non developers can not make our own apps for iOS, so to even slightly modify the test/example app is out of our reach. I would think that it wouldn't be too time intensive to modify the Bluefruiit LE app to give the user some ability to customize it bit, to use in their projects. I would think there would be quite a few Arduino DIYers who would vote for this option. If anyone has the ability and know how to do this we'd all appreciate it!
Thanks.

User avatar
southernatheart
 
Posts: 79
Joined: Tue Mar 22, 2011 10:54 pm

Re: Bluefruit LE App - custom labels

Post by southernatheart »

Something like this with your BLE board would give endless possibilities!
https://www.kickstarter.com/projects/16 ... ect-in-5-m

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”