Skip to content

AccessBraille API Documentation

Michael Timbrook edited this page Jul 25, 2013 · 21 revisions

DRAFT

Using the Keyboard

Using the ABKeyboard interface is quite simple, there are a few option for doing so. If you wish to explicitly handle all the returned data from the keyboard you simply need to set yourself as the delegate and add the protocol methods.

#import <ABKeyboard/ABKeyboard.h>

@interface ViewController () <ABKeyboard>
@end

- (void)viewDidLoad
{
	ABKeyboard *keyboard = [[ABKeyboard alloc] initWithDelegate:self];
}

- (void)characterTyped:(NSString *)character withInfo:(NSDictionary *)info
{
	// Handle characters here
} 

- (void)wordTyped:(NSString *)word withInfo:(NSDictionary *)info
{
	// Handle completed word, this is where expanded shorthand gets sent
}

Another, simpler option, to using the keyboard is to pass in a UITextView and let ABKeyboard be the first responder.

#import <ABKeyboard/ABKeyboard.h>

@interface ViewController () <ABKeyboard>

@property UITextView *myOutput;

@end

- (void)viewDidLoad
{
	ABKeyboard *keyboard = [[ABKeyboard alloc] initWithDelegate:self];
	[keyboard setOutput:_myOutput];
}

Configuring the Keyboard

Setting up the keyboard to work best for the user is very important, so make sure to open theses options up to your users.

Setting grade
@property (assign) ABGrade grade

Two types of braille are supported, grade one and two. Grades are defined in ABTypes.

Setting transparency
[userDefaults setFloat:0.6 forKey:KeyboardTransparency];

Keyboard transparency is set through NSUserDefaults. It is a float value between 0.0 and 1.0. KeyboardTransparency is defined in ABTypes.

Disabling the keyboard
@property (assign) BOOL enabled

Set if the keyboard should activate or not.

Space buffer
@property (assign) int spaceOffset

Set a custom buffer area for where the keyboard detects a space.

Getting information

The keyboard provides status information about its state.

Active
@property BOOL keyboardActive

If the keyboard is currently active or not.

Did become active
-keyboardDidBecomeActive

Part of the ABKeyboard protocol, delegate gets this call on keyboard activation.

Did did dismiss
-keyboardDidDismiss

Part of the ABKeyboard protocol, delegate gets this call when is keyboard is dismissed.

Additional features

ABKeyboard comes with a few extra features that makes using the keyboard easier and providing the best user experience.

Speaking

In addition to using ABSpeak, ABKeyboard has a -startSpeakingString: method that can be used to provide audio feedback to the user. To use ABSpeak without a keyboard instance, use [ABSpeak sharedInstance] to get the ABSpeak object.

Parsing

The sentence and word parsing class that's used by the keyboard is also available to the user. See ABParser:

/* Parses a sentence into an array of words */
+ (NSArray *)arrayOfWordsFromSentence:(NSString *)sentence;

/* Parses word down to array of characters */
+ (NSArray *)arrayOfCharactersFromWord:(NSString *)word;

Braille output

ABBrailleOutput is a UIView with a text property that outputs braille. Currently only supports braille grade 1, and not numbers. Planning to just use the SimBraille font for this instead of doing the rendering ourselves.

Types

Definitions of all the custom types can be found in the ABTypes header.

System Requirements

ABKeyboard was built for and supports iOS 6.1+ for iPad.

Importing ABKeyboard

To start using ABKeyboard in your project:

  1. Build the AccessBrailleAggregate and the <ABKeyboard.framework> will build into AccessBraille/Products.
  2. Add <ABKeyboard.framework> under "Linked Frameworks and Libraries" in your project.
  3. Start using ABKeyboard!