Commit 38cfdbfb authored by Alex Moore's avatar Alex Moore
Browse files

Updated workspace, project is now in folder WAMI

parent f608973e
//
// CaptuvoScannerController.h
// CaptuvoSDKDemo
//
// Created by PLUC SeniorDesign on 2/24/15.
// Copyright (c) 2015 Anthony J. Carno. All rights reserved.
//
#import "CaptuvoViewController.h"
@interface CaptuvoScannerController : CaptuvoViewController
@property (weak, nonatomic) IBOutlet UITextField *txtBookID;
@end
//
// CaptuvoScannerController.m
// CaptuvoSDKDemo
//
// Created by PLUC SeniorDesign on 2/24/15.
// Copyright (c) 2015 Anthony J. Carno. All rights reserved.
//
#import "CaptuvoScannerController.h"
@interface CaptuvoScannerController ()
@end
@implementation CaptuvoScannerController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self initDecoder];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/**
@brief This method attempts to establish a connection to the Captuvo SL22 Enterprise Sled and start the decoder hardware. A UIAlertView prompts the user if a connection cannot be established. Additionally, this method adds the current class (self) as a CaptuvoDelegate.
@return ProtocolConnectionStatus - the connection status of the Captuvo sled
*/
- (void)initDecoder
{
ProtocolConnectionStatus status = [[Captuvo sharedCaptuvoDevice] startDecoderHardware];
if (status == ProtocolConnectionStatusUnableToConnect) {
UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error"
message:@"Unable to communicate with sled - unknown communication error."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[sledAlert show];
}
else if (status == ProtocolConnectionStatusUnableToConnectIncompatiableSledFirmware) {
UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error"
message:@"Unable to communicate with sled - incompatible sled firmware."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[sledAlert show];
}
else if (status == ProtocolConnectionStatusBatteryDepleted) {
UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error"
message:@"Unable to communicate with sled - battery depleted."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[sledAlert show];
}
//[[Captuvo sharedCaptuvoDevice] requestBatteryVoltage] ;
//[[Captuvo sharedCaptuvoDevice] requestChargeStatus] ;
Codabar *codabarOptions = [[Codabar alloc] init];
codabarOptions.enabled = TRUE;
codabarOptions.transmitStatStopChar = FALSE;
codabarOptions.checkCharStatus = CodabarCheckCharNoCheckChar;
codabarOptions.concatenationStatus = CodabarConcatenationOff;
codabarOptions.minMessageLength = 4;
codabarOptions.maxMessageLength = 60;
[[Captuvo sharedCaptuvoDevice] setDecoderCodabarConfiguration:codabarOptions persistSetting:NO];
}
/**
@brief This method handles the barcode data returned by the scanner
@param (NSString *)data - the scanned barcode (in text form)
*/
- (void) decoderDataReceived:(NSString *)data {
//self.txtBookID.textAlignment = NSTextAlignmentLeft;
self.txtBookID.text = data;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// CaptuvoViewController.h
// CaptuvoSDKDemo
//
// Created by PLUC SeniorDesign on 2/24/15.
// Copyright (c) 2015 Anthony J. Carno. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "WebViewController.h"
#import "Captuvo.h"
@interface CaptuvoViewController : WebViewController<CaptuvoEventsProtocol>
@end
//
// CaptuvoViewController.m
// CaptuvoSDKDemo
//
// Created by PLUC SeniorDesign on 2/24/15.
// Copyright (c) 2015 Anthony J. Carno. All rights reserved.
//
#import "CaptuvoViewController.h"
@interface CaptuvoViewController ()
@end
@implementation CaptuvoViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[[Captuvo sharedCaptuvoDevice] addCaptuvoDelegate:self] ;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
[[Captuvo sharedCaptuvoDevice] removeCaptuvoDelegate:self];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
(function() {
finishedScanning();
})();
\ No newline at end of file
(function() {
var el = document.getElementById("CollectionList1");
var opts = el.options;
var str = '{ "options" : [';
for (var i = 0; i < opts.length; i++) {
str += '{"value":"' + opts[i].value + '", '
+ '"text":"' + opts[i].innerHTML.trim() + '"}'
if (i + 1 != opts.length)
str += ",";
}
str += "]}";
return str;
})();
\ No newline at end of file
(function() {
var div = document.getElementById("ActionMessage");
var msg = div.getElementsByTagName("td")[0].innerHTML.trim().replace(",", "-");
return msg.replace(/<br>/g, ",");
})();
\ No newline at end of file
(function() {
var scannedDiv = document.getElementById("ScannedListDiv");
var scannedTB = scannedDiv.children[0].children[0];
var allRows = scannedTB.children;
var scannedRows = []; // Array of tr elements
var scannedBooks = '{ "books" : [';
// Go through all rows, except header, to get all scanned rows
for (var i = 1; i < allRows.length; i++) {
if (allRows[i].childElementCount !== 0) { // Ignore empty spacing rows
scannedRows[scannedRows.length] = allRows[i];
}
}
// Go through scanned rows
for (var j = 0; j < scannedRows.length; j++) {
if (scannedRows[j].children.length !== 0) {
// Scanned rows is a tr element with td children
var rowChildren = scannedRows[j].children; // Array of tds
// Go through each td element in a row
for (var k = 0; k < rowChildren.length; k++) { // k is col num
if (rowChildren[k].childElementCount !== 0) { // If the td has children (font)
var bookProp = rowChildren[k].children[0]; // font element
// If the col isn't empty
var a = bookProp.innerHTML;
if (bookProp.innerHTML != "&nbsp;" && bookProp.innerHTML !== "") {
switch(k) {
case 1: // ID Prop
scannedBooks += '{"id":"' + bookProp.innerHTML.trim() + '", ';
break;
case 2: // Call Num
scannedBooks += '"callnum":"' + bookProp.innerHTML.trim() + '", ';
break;
case 3: // Title
scannedBooks += '"title":"' + bookProp.innerHTML.trim() + '"},';
break;
}
}
}
}
}
}
scannedBooks = scannedBooks.substring(0, scannedBooks.length-1);
return scannedBooks + ']}';
})();
\ No newline at end of file
(function() {
var el = document.getElementById("CollectionList2");
var opts = el.options;
var str = '{ "options" : [';
for (var i = 0; i < opts.length; i++) {
str += '{"value":"' + opts[i].value + '", '
+ '"text":"' + opts[i].innerHTML.trim() + '"}'
if (i + 1 != opts.length)
str += ",";
}
str += "]}";
return str;
})();
\ No newline at end of file
//
// GlobalWebController.h
// PLUCdraft
//
// Created by PLUC SeniorDesign on 3/18/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface GlobalWebController : NSObject
{
UIWebView *web;
bool isInitialized;
}
@property(nonatomic, retain) UIWebView *web;
@property(nonatomic, assign) bool isInitialized;
+(GlobalWebController*) getInstance;
@end
//
// GlobalWebController.m
// PLUCdraft
//
// Created by PLUC SeniorDesign on 3/18/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "GlobalWebController.h"
@implementation GlobalWebController
@synthesize web;
@synthesize isInitialized;
static GlobalWebController *instance = nil;
+(GlobalWebController*) getInstance
{
@synchronized(self)
{
if (instance==nil) {
instance = [GlobalWebController new];
instance.isInitialized = false;
}
}
return instance;
}
@end
(function() {
// TODO: Believe this is what the continue button does
onContinue();
})();
\ No newline at end of file
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>BUECE-SD1.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.honeywell.scansled.protocol.decoder</string>
<string>com.honeywell.scansled.protocol.msr</string>
<string>com.honeywell.scansled.protocol.pm</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
//
// LogInViewController.h
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "WebViewController.h"
@interface LogInViewController : WebViewController
@property (weak, nonatomic, readonly) UIButton *btnLogIn;
@property (weak, nonatomic, readwrite) UITextField *txtUsername;
@property (weak, nonatomic, readwrite) UITextField *txtPassword;
@end
//
// LogInViewController.m
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "LogInViewController.h"
@interface LogInViewController ()
//@property (weak, nonatomic, readwrite) IBOutlet UITextField *txtUsername;
//@property (weak, nonatomic, readwrite) IBOutlet UITextField *txtPassword;
//- (IBAction)btnLogInTouch:(id)sender;
@end
@implementation LogInViewController
//@synthesize txtUsername;
//@synthesize txtPassword;
//static NSString *USERNAME = @"";//@"alex";
//static NSString *PASSWORD = @"";//@"what";
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(endEditing:)]];
self.navigationItem.hidesBackButton = YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//allow app to flip to upside down
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
return YES;
if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
return YES;
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)
return NO;
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
return NO;
return NO; // Unknown value
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
- (IBAction)btnLogInTouch:(id)sender {
// NSString *path =
// [[NSBundle mainBundle] pathForResource:@"WhatPage" ofType:@"js"];
// NSString *content = [NSString stringWithContentsOfFile:path
// encoding:NSUTF8StringEncoding
// error:nil];
//
// NSString *page =
// [self.webview stringByEvaluatingJavaScriptFromString:content];
// NSLog(@"PAGE NUMBER IS: %@\n", page);
//
// if ([page isEqual:@"0"]) { // Login Page
// NSString *loginPath =
// [[NSBundle mainBundle] pathForResource:@"Login" ofType:@"js"];
// NSString *login = [NSString stringWithContentsOfFile:loginPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// NSString *success =
// [self.webview stringByEvaluatingJavaScriptFromString:login];
//
// UIAlertView *loginAlert = [[UIAlertView alloc] initWithTitle:@"Logged In!"
// message:success
// delegate:self
// cancelButtonTitle:@"OK"
// otherButtonTitles:nil];
// [loginAlert show];
// }
NSString *login1Path =
[[NSBundle mainBundle] pathForResource:@"Login1" ofType:@"js"];
NSString *login1 = [NSString stringWithContentsOfFile:login1Path
encoding:NSUTF8StringEncoding
error:nil];
NSString *login2Path =
[[NSBundle mainBundle] pathForResource:@"Login2" ofType:@"js"];
NSString *login2 = [NSString stringWithContentsOfFile:login2Path
encoding:NSUTF8StringEncoding
error:nil];
NSString *username = @"user.value = \"";
username = [username stringByAppendingString:[self.txtUsername.text stringByAppendingString:@"\";"]];
NSString *password = @"pword.value = \"";
password = [password stringByAppendingString:[self.txtPassword.text stringByAppendingString:@"\";"]];
NSString *login = [login1 stringByAppendingString:[username stringByAppendingString:[password stringByAppendingString:login2]]];
NSLog(@"%@", login);
NSString *success =
[self.webview stringByEvaluatingJavaScriptFromString:login];
// UIAlertView *loginAlert = [[UIAlertView alloc] initWithTitle:@"Logged In!"
// message:success
// delegate:self
// cancelButtonTitle:@"OK"
// otherButtonTitles:nil];
// [loginAlert show];
//For testing
// if([self.txtUsername.text isEqualToString:@"circ_admin"] && [self.txtPassword.text isEqualToString:@"silver"]) {//check username and password
[self performSegueWithIdentifier:@"segueLogIn" sender:nil];
// } else {
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Incorrect login" message:@"Username or password incorrect" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
// [alert show];
// }
}
@end