This is a *VERY* Rough library for translating binary representations of grade 1 braille into ASCII strings.

Revision:
0:22ca5452cf10
Child:
1:d79dbb617533
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Braille_In.cpp	Tue Sep 25 22:57:22 2012 +0000
@@ -0,0 +1,136 @@
+#include "Braille_In.h"
+
+
+
+char* BrailleInput::translateBraille(char* input, int numChars)
+{
+    char output[numChars+1];
+    bool NextCaps=false;
+    for (int i=0;i<numChars;i++)
+    {
+       output[i]=translateBrailleChar(input[i],NextCaps);
+    }
+    return input;
+}
+
+
+char BrailleInput::translateBrailleChar(char input, bool& NextCaps)
+{
+    NextCaps=false;
+    char out;
+    bool undefined=false;
+    
+    
+    if (!(input & 0x4)) {
+    switch(input) {
+        case 0x1:
+            out= 'a';
+            break;
+        case 0x3:
+            out= 'b';
+            break;
+        case 0x9:
+            out= 'c';
+            break;
+        case 0x25:
+            out= 'd';
+            break;
+        case 0x17:
+            out= 'e';
+            break;
+        case 0x11:
+            out='f';
+            break;
+        case 0x27:
+            out='g';
+            break;
+        case 0x19:
+            out='h';
+            break;
+        case 0x18:
+            out='i';
+            break;
+        case 0x26:
+            out='j';
+            break;
+        default:
+            if (input == 0x58){ out = 'w'; } else { out ='a'; undefined=true; }
+              
+        
+      }}
+      else if (input & 0x36){
+      switch (input)
+      {
+        case 0x37:
+            out='u';
+            break;
+        case 0x39:
+            out='v';
+            break;
+        case 0x45:
+            out='x';
+            break;
+        case 0x61:
+            out='y';
+            break;
+        case 0x53:
+            out='z';
+            break;
+        default:
+            out='u'; undefined=true;
+        }} else{
+        switch(input){
+            case 0x5:
+                out='k';
+                break;
+            case 0x7:
+                out='l';
+                break;
+            case 0x13:
+                out='m';
+                break;
+            case 0x29:
+                out='n';
+                break;
+            case 0x21:
+                out='o';
+                break;
+            case 0x15:
+                out='p';
+                break;
+            case 0x31:
+                out='q';
+                break;
+            case 0x23:
+                out='r';
+                break;
+            case 0x14:
+                out='s';
+                break;
+            case 0x30:
+                out='t';
+                break;
+            default:
+                out='k'; undefined=true;
+            }}
+    
+    
+    
+    return out;
+    }
+    
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+