rtlduino rtl8710af gcc base version
20
tools/simple_config_wizard/iOS/ChangeLog
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
ChangeLog
|
||||
----------------------------------------------------------------
|
||||
2016/03/08
|
||||
- Using CocoaAsyncSocket framework to instead of AsyncUdpSocket
|
||||
- Adjust AsyncSocket releated code
|
||||
|
||||
2015/10/23
|
||||
- Support iOS 9.
|
||||
|
||||
2015/08/24
|
||||
- Re-fine simple config
|
||||
|
||||
2015/05/26
|
||||
- Support iOS 8.
|
||||
|
||||
2014/10/20
|
||||
- Re-fine configure flow when DUT receives first UDP packet.
|
||||
|
||||
2014/03/27
|
||||
- Initial Release
|
||||
BIN
tools/simple_config_wizard/iOS/SimpleConfigWizard_v109/.DS_Store
vendored
Normal file
|
|
@ -0,0 +1,657 @@
|
|||
//
|
||||
// AsyncSocket.h
|
||||
//
|
||||
// This class is in the public domain.
|
||||
// Originally created by Dustin Voss on Wed Jan 29 2003.
|
||||
// Updated and maintained by Deusty Designs and the Mac development community.
|
||||
//
|
||||
// http://code.google.com/p/cocoaasyncsocket/
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class AsyncSocket;
|
||||
@class AsyncReadPacket;
|
||||
@class AsyncWritePacket;
|
||||
|
||||
extern NSString *const AsyncSocketException;
|
||||
extern NSString *const AsyncSocketErrorDomain;
|
||||
|
||||
typedef NS_ENUM(NSInteger, AsyncSocketError) {
|
||||
AsyncSocketCFSocketError = kCFSocketError, // From CFSocketError enum.
|
||||
AsyncSocketNoError = 0, // Never used.
|
||||
AsyncSocketCanceledError, // onSocketWillConnect: returned NO.
|
||||
AsyncSocketConnectTimeoutError,
|
||||
AsyncSocketReadMaxedOutError, // Reached set maxLength without completing
|
||||
AsyncSocketReadTimeoutError,
|
||||
AsyncSocketWriteTimeoutError
|
||||
};
|
||||
|
||||
@protocol AsyncSocketDelegate
|
||||
@optional
|
||||
|
||||
/**
|
||||
* In the event of an error, the socket is closed.
|
||||
* You may call "unreadData" during this call-back to get the last bit of data off the socket.
|
||||
* When connecting, this delegate method may be called
|
||||
* before"onSocket:didAcceptNewSocket:" or "onSocket:didConnectToHost:".
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock willDisconnectWithError:(NSError *)err;
|
||||
|
||||
/**
|
||||
* Called when a socket disconnects with or without error. If you want to release a socket after it disconnects,
|
||||
* do so here. It is not safe to do that during "onSocket:willDisconnectWithError:".
|
||||
*
|
||||
* If you call the disconnect method, and the socket wasn't already disconnected,
|
||||
* this delegate method will be called before the disconnect method returns.
|
||||
**/
|
||||
- (void)onSocketDidDisconnect:(AsyncSocket *)sock;
|
||||
|
||||
/**
|
||||
* Called when a socket accepts a connection. Another socket is spawned to handle it. The new socket will have
|
||||
* the same delegate and will call "onSocket:didConnectToHost:port:".
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket;
|
||||
|
||||
/**
|
||||
* Called when a new socket is spawned to handle a connection. This method should return the run-loop of the
|
||||
* thread on which the new socket and its delegate should operate. If omitted, [NSRunLoop currentRunLoop] is used.
|
||||
**/
|
||||
- (NSRunLoop *)onSocket:(AsyncSocket *)sock wantsRunLoopForNewSocket:(AsyncSocket *)newSocket;
|
||||
|
||||
/**
|
||||
* Called when a socket is about to connect. This method should return YES to continue, or NO to abort.
|
||||
* If aborted, will result in AsyncSocketCanceledError.
|
||||
*
|
||||
* If the connectToHost:onPort:error: method was called, the delegate will be able to access and configure the
|
||||
* CFReadStream and CFWriteStream as desired prior to connection.
|
||||
*
|
||||
* If the connectToAddress:error: method was called, the delegate will be able to access and configure the
|
||||
* CFSocket and CFSocketNativeHandle (BSD socket) as desired prior to connection. You will be able to access and
|
||||
* configure the CFReadStream and CFWriteStream in the onSocket:didConnectToHost:port: method.
|
||||
**/
|
||||
- (BOOL)onSocketWillConnect:(AsyncSocket *)sock;
|
||||
|
||||
/**
|
||||
* Called when a socket connects and is ready for reading and writing.
|
||||
* The host parameter will be an IP address, not a DNS name.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port;
|
||||
|
||||
/**
|
||||
* Called when a socket has completed reading the requested data into memory.
|
||||
* Not called if there is an error.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag;
|
||||
|
||||
/**
|
||||
* Called when a socket has read in data, but has not yet completed the read.
|
||||
* This would occur if using readToData: or readToLength: methods.
|
||||
* It may be used to for things such as updating progress bars.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didReadPartialDataOfLength:(NSUInteger)partialLength tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Called when a socket has completed writing the requested data. Not called if there is an error.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didWriteDataWithTag:(long)tag;
|
||||
|
||||
/**
|
||||
* Called when a socket has written some data, but has not yet completed the entire write.
|
||||
* It may be used to for things such as updating progress bars.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didWritePartialDataOfLength:(NSUInteger)partialLength tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Called if a read operation has reached its timeout without completing.
|
||||
* This method allows you to optionally extend the timeout.
|
||||
* If you return a positive time interval (> 0) the read's timeout will be extended by the given amount.
|
||||
* If you don't implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual.
|
||||
*
|
||||
* The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.
|
||||
* The length parameter is the number of bytes that have been read so far for the read operation.
|
||||
*
|
||||
* Note that this method may be called multiple times for a single read if you return positive numbers.
|
||||
**/
|
||||
- (NSTimeInterval)onSocket:(AsyncSocket *)sock
|
||||
shouldTimeoutReadWithTag:(long)tag
|
||||
elapsed:(NSTimeInterval)elapsed
|
||||
bytesDone:(NSUInteger)length;
|
||||
|
||||
/**
|
||||
* Called if a write operation has reached its timeout without completing.
|
||||
* This method allows you to optionally extend the timeout.
|
||||
* If you return a positive time interval (> 0) the write's timeout will be extended by the given amount.
|
||||
* If you don't implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual.
|
||||
*
|
||||
* The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.
|
||||
* The length parameter is the number of bytes that have been written so far for the write operation.
|
||||
*
|
||||
* Note that this method may be called multiple times for a single write if you return positive numbers.
|
||||
**/
|
||||
- (NSTimeInterval)onSocket:(AsyncSocket *)sock
|
||||
shouldTimeoutWriteWithTag:(long)tag
|
||||
elapsed:(NSTimeInterval)elapsed
|
||||
bytesDone:(NSUInteger)length;
|
||||
|
||||
/**
|
||||
* Called after the socket has successfully completed SSL/TLS negotiation.
|
||||
* This method is not called unless you use the provided startTLS method.
|
||||
*
|
||||
* If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close,
|
||||
* and the onSocket:willDisconnectWithError: delegate method will be called with the specific SSL error code.
|
||||
**/
|
||||
- (void)onSocketDidSecure:(AsyncSocket *)sock;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@interface AsyncSocket : NSObject
|
||||
{
|
||||
CFSocketNativeHandle theNativeSocket4;
|
||||
CFSocketNativeHandle theNativeSocket6;
|
||||
|
||||
CFSocketRef theSocket4; // IPv4 accept or connect socket
|
||||
CFSocketRef theSocket6; // IPv6 accept or connect socket
|
||||
|
||||
CFReadStreamRef theReadStream;
|
||||
CFWriteStreamRef theWriteStream;
|
||||
|
||||
CFRunLoopSourceRef theSource4; // For theSocket4
|
||||
CFRunLoopSourceRef theSource6; // For theSocket6
|
||||
CFRunLoopRef theRunLoop;
|
||||
CFSocketContext theContext;
|
||||
NSArray *theRunLoopModes;
|
||||
|
||||
NSTimer *theConnectTimer;
|
||||
|
||||
NSMutableArray *theReadQueue;
|
||||
AsyncReadPacket *theCurrentRead;
|
||||
NSTimer *theReadTimer;
|
||||
NSMutableData *partialReadBuffer;
|
||||
|
||||
NSMutableArray *theWriteQueue;
|
||||
AsyncWritePacket *theCurrentWrite;
|
||||
NSTimer *theWriteTimer;
|
||||
|
||||
id theDelegate;
|
||||
UInt16 theFlags;
|
||||
|
||||
long theUserData;
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
- (id)initWithDelegate:(id)delegate;
|
||||
- (id)initWithDelegate:(id)delegate userData:(long)userData;
|
||||
|
||||
/* String representation is long but has no "\n". */
|
||||
- (NSString *)description;
|
||||
|
||||
/**
|
||||
* Use "canSafelySetDelegate" to see if there is any pending business (reads and writes) with the current delegate
|
||||
* before changing it. It is, of course, safe to change the delegate before connecting or accepting connections.
|
||||
**/
|
||||
- (id)delegate;
|
||||
- (BOOL)canSafelySetDelegate;
|
||||
- (void)setDelegate:(id)delegate;
|
||||
|
||||
/* User data can be a long, or an id or void * cast to a long. */
|
||||
- (long)userData;
|
||||
- (void)setUserData:(long)userData;
|
||||
|
||||
/* Don't use these to read or write. And don't close them either! */
|
||||
- (CFSocketRef)getCFSocket;
|
||||
- (CFReadStreamRef)getCFReadStream;
|
||||
- (CFWriteStreamRef)getCFWriteStream;
|
||||
|
||||
// Once one of the accept or connect methods are called, the AsyncSocket instance is locked in
|
||||
// and the other accept/connect methods can't be called without disconnecting the socket first.
|
||||
// If the attempt fails or times out, these methods either return NO or
|
||||
// call "onSocket:willDisconnectWithError:" and "onSockedDidDisconnect:".
|
||||
|
||||
// When an incoming connection is accepted, AsyncSocket invokes several delegate methods.
|
||||
// These methods are (in chronological order):
|
||||
// 1. onSocket:didAcceptNewSocket:
|
||||
// 2. onSocket:wantsRunLoopForNewSocket:
|
||||
// 3. onSocketWillConnect:
|
||||
//
|
||||
// Your server code will need to retain the accepted socket (if you want to accept it).
|
||||
// The best place to do this is probably in the onSocket:didAcceptNewSocket: method.
|
||||
//
|
||||
// After the read and write streams have been setup for the newly accepted socket,
|
||||
// the onSocket:didConnectToHost:port: method will be called on the proper run loop.
|
||||
//
|
||||
// Multithreading Note: If you're going to be moving the newly accepted socket to another run
|
||||
// loop by implementing onSocket:wantsRunLoopForNewSocket:, then you should wait until the
|
||||
// onSocket:didConnectToHost:port: method before calling read, write, or startTLS methods.
|
||||
// Otherwise read/write events are scheduled on the incorrect runloop, and chaos may ensue.
|
||||
|
||||
/**
|
||||
* Tells the socket to begin listening and accepting connections on the given port.
|
||||
* When a connection comes in, the AsyncSocket instance will call the various delegate methods (see above).
|
||||
* The socket will listen on all available interfaces (e.g. wifi, ethernet, etc)
|
||||
**/
|
||||
- (BOOL)acceptOnPort:(UInt16)port error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* This method is the same as acceptOnPort:error: with the additional option
|
||||
* of specifying which interface to listen on. So, for example, if you were writing code for a server that
|
||||
* has multiple IP addresses, you could specify which address you wanted to listen on. Or you could use it
|
||||
* to specify that the socket should only accept connections over ethernet, and not other interfaces such as wifi.
|
||||
* You may also use the special strings "localhost" or "loopback" to specify that
|
||||
* the socket only accept connections from the local machine.
|
||||
*
|
||||
* To accept connections on any interface pass nil, or simply use the acceptOnPort:error: method.
|
||||
**/
|
||||
- (BOOL)acceptOnInterface:(NSString *)interface port:(UInt16)port error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* Connects to the given host and port.
|
||||
* The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2")
|
||||
**/
|
||||
- (BOOL)connectToHost:(NSString *)hostname onPort:(UInt16)port error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* This method is the same as connectToHost:onPort:error: with an additional timeout option.
|
||||
* To not time out use a negative time interval, or simply use the connectToHost:onPort:error: method.
|
||||
**/
|
||||
- (BOOL)connectToHost:(NSString *)hostname
|
||||
onPort:(UInt16)port
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* Connects to the given address, specified as a sockaddr structure wrapped in a NSData object.
|
||||
* For example, a NSData object returned from NSNetService's addresses method.
|
||||
*
|
||||
* If you have an existing struct sockaddr you can convert it to a NSData object like so:
|
||||
* struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len];
|
||||
* struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len];
|
||||
**/
|
||||
- (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* This method is the same as connectToAddress:error: with an additional timeout option.
|
||||
* To not time out use a negative time interval, or simply use the connectToAddress:error: method.
|
||||
**/
|
||||
- (BOOL)connectToAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr;
|
||||
|
||||
- (BOOL)connectToAddress:(NSData *)remoteAddr
|
||||
viaInterfaceAddress:(NSData *)interfaceAddr
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* Disconnects immediately. Any pending reads or writes are dropped.
|
||||
* If the socket is not already disconnected, the onSocketDidDisconnect delegate method
|
||||
* will be called immediately, before this method returns.
|
||||
*
|
||||
* Please note the recommended way of releasing an AsyncSocket instance (e.g. in a dealloc method)
|
||||
* [asyncSocket setDelegate:nil];
|
||||
* [asyncSocket disconnect];
|
||||
* [asyncSocket release];
|
||||
**/
|
||||
- (void)disconnect;
|
||||
|
||||
/**
|
||||
* Disconnects after all pending reads have completed.
|
||||
* After calling this, the read and write methods will do nothing.
|
||||
* The socket will disconnect even if there are still pending writes.
|
||||
**/
|
||||
- (void)disconnectAfterReading;
|
||||
|
||||
/**
|
||||
* Disconnects after all pending writes have completed.
|
||||
* After calling this, the read and write methods will do nothing.
|
||||
* The socket will disconnect even if there are still pending reads.
|
||||
**/
|
||||
- (void)disconnectAfterWriting;
|
||||
|
||||
/**
|
||||
* Disconnects after all pending reads and writes have completed.
|
||||
* After calling this, the read and write methods will do nothing.
|
||||
**/
|
||||
- (void)disconnectAfterReadingAndWriting;
|
||||
|
||||
/* Returns YES if the socket and streams are open, connected, and ready for reading and writing. */
|
||||
- (BOOL)isConnected;
|
||||
|
||||
/**
|
||||
* Returns the local or remote host and port to which this socket is connected, or nil and 0 if not connected.
|
||||
* The host will be an IP address.
|
||||
**/
|
||||
- (NSString *)connectedHost;
|
||||
- (UInt16)connectedPort;
|
||||
|
||||
- (NSString *)localHost;
|
||||
- (UInt16)localPort;
|
||||
|
||||
/**
|
||||
* Returns the local or remote address to which this socket is connected,
|
||||
* specified as a sockaddr structure wrapped in a NSData object.
|
||||
*
|
||||
* See also the connectedHost, connectedPort, localHost and localPort methods.
|
||||
**/
|
||||
- (NSData *)connectedAddress;
|
||||
- (NSData *)localAddress;
|
||||
|
||||
/**
|
||||
* Returns whether the socket is IPv4 or IPv6.
|
||||
* An accepting socket may be both.
|
||||
**/
|
||||
- (BOOL)isIPv4;
|
||||
- (BOOL)isIPv6;
|
||||
|
||||
// The readData and writeData methods won't block (they are asynchronous).
|
||||
//
|
||||
// When a read is complete the onSocket:didReadData:withTag: delegate method is called.
|
||||
// When a write is complete the onSocket:didWriteDataWithTag: delegate method is called.
|
||||
//
|
||||
// You may optionally set a timeout for any read/write operation. (To not timeout, use a negative time interval.)
|
||||
// If a read/write opertion times out, the corresponding "onSocket:shouldTimeout..." delegate method
|
||||
// is called to optionally allow you to extend the timeout.
|
||||
// Upon a timeout, the "onSocket:willDisconnectWithError:" method is called, followed by "onSocketDidDisconnect".
|
||||
//
|
||||
// The tag is for your convenience.
|
||||
// You can use it as an array index, step number, state id, pointer, etc.
|
||||
|
||||
/**
|
||||
* Reads the first available bytes that become available on the socket.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
**/
|
||||
- (void)readDataWithTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads the first available bytes that become available on the socket.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, the socket will create a buffer for you.
|
||||
*
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
**/
|
||||
- (void)readDataWithTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads the first available bytes that become available on the socket.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
* A maximum of length bytes will be read.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, a buffer will automatically be created for you.
|
||||
* If maxLength is zero, no length restriction is enforced.
|
||||
*
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
**/
|
||||
- (void)readDataWithTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
maxLength:(NSUInteger)length
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads the given number of bytes.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
*
|
||||
* If the length is 0, this method does nothing and the delegate is not called.
|
||||
**/
|
||||
- (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads the given number of bytes.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, a buffer will automatically be created for you.
|
||||
*
|
||||
* If the length is 0, this method does nothing and the delegate is not called.
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
**/
|
||||
- (void)readDataToLength:(NSUInteger)length
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads bytes until (and including) the passed "data" parameter, which acts as a separator.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
*
|
||||
* If you pass nil or zero-length data as the "data" parameter,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
|
||||
* Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
|
||||
* a character, the read will prematurely end.
|
||||
**/
|
||||
- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads bytes until (and including) the passed "data" parameter, which acts as a separator.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, a buffer will automatically be created for you.
|
||||
*
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
*
|
||||
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
|
||||
* Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
|
||||
* a character, the read will prematurely end.
|
||||
**/
|
||||
- (void)readDataToData:(NSData *)data
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads bytes until (and including) the passed "data" parameter, which acts as a separator.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
*
|
||||
* If maxLength is zero, no length restriction is enforced.
|
||||
* Otherwise if maxLength bytes are read without completing the read,
|
||||
* it is treated similarly to a timeout - the socket is closed with a AsyncSocketReadMaxedOutError.
|
||||
* The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end.
|
||||
*
|
||||
* If you pass nil or zero-length data as the "data" parameter,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
* If you pass a maxLength parameter that is less than the length of the data parameter,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
|
||||
* Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
|
||||
* a character, the read will prematurely end.
|
||||
**/
|
||||
- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads bytes until (and including) the passed "data" parameter, which acts as a separator.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
* A maximum of length bytes will be read.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, a buffer will automatically be created for you.
|
||||
*
|
||||
* If maxLength is zero, no length restriction is enforced.
|
||||
* Otherwise if maxLength bytes are read without completing the read,
|
||||
* it is treated similarly to a timeout - the socket is closed with a AsyncSocketReadMaxedOutError.
|
||||
* The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end.
|
||||
*
|
||||
* If you pass a maxLength parameter that is less than the length of the data parameter,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
*
|
||||
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
|
||||
* Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
|
||||
* a character, the read will prematurely end.
|
||||
**/
|
||||
- (void)readDataToData:(NSData *)data
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
maxLength:(NSUInteger)length
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Writes data to the socket, and calls the delegate when finished.
|
||||
*
|
||||
* If you pass in nil or zero-length data, this method does nothing and the delegate will not be called.
|
||||
* If the timeout value is negative, the write operation will not use a timeout.
|
||||
**/
|
||||
- (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Returns progress of current read or write, from 0.0 to 1.0, or NaN if no read/write (use isnan() to check).
|
||||
* "tag", "done" and "total" will be filled in if they aren't NULL.
|
||||
**/
|
||||
- (float)progressOfReadReturningTag:(long *)tag bytesDone:(NSUInteger *)done total:(NSUInteger *)total;
|
||||
- (float)progressOfWriteReturningTag:(long *)tag bytesDone:(NSUInteger *)done total:(NSUInteger *)total;
|
||||
|
||||
/**
|
||||
* Secures the connection using SSL/TLS.
|
||||
*
|
||||
* This method may be called at any time, and the TLS handshake will occur after all pending reads and writes
|
||||
* are finished. This allows one the option of sending a protocol dependent StartTLS message, and queuing
|
||||
* the upgrade to TLS at the same time, without having to wait for the write to finish.
|
||||
* Any reads or writes scheduled after this method is called will occur over the secured connection.
|
||||
*
|
||||
* The possible keys and values for the TLS settings are well documented.
|
||||
* Some possible keys are:
|
||||
* - kCFStreamSSLLevel
|
||||
* - kCFStreamSSLAllowsExpiredCertificates
|
||||
* - kCFStreamSSLAllowsExpiredRoots
|
||||
* - kCFStreamSSLAllowsAnyRoot
|
||||
* - kCFStreamSSLValidatesCertificateChain
|
||||
* - kCFStreamSSLPeerName
|
||||
* - kCFStreamSSLCertificates
|
||||
* - kCFStreamSSLIsServer
|
||||
*
|
||||
* Please refer to Apple's documentation for associated values, as well as other possible keys.
|
||||
*
|
||||
* If you pass in nil or an empty dictionary, the default settings will be used.
|
||||
*
|
||||
* The default settings will check to make sure the remote party's certificate is signed by a
|
||||
* trusted 3rd party certificate agency (e.g. verisign) and that the certificate is not expired.
|
||||
* However it will not verify the name on the certificate unless you
|
||||
* give it a name to verify against via the kCFStreamSSLPeerName key.
|
||||
* The security implications of this are important to understand.
|
||||
* Imagine you are attempting to create a secure connection to MySecureServer.com,
|
||||
* but your socket gets directed to MaliciousServer.com because of a hacked DNS server.
|
||||
* If you simply use the default settings, and MaliciousServer.com has a valid certificate,
|
||||
* the default settings will not detect any problems since the certificate is valid.
|
||||
* To properly secure your connection in this particular scenario you
|
||||
* should set the kCFStreamSSLPeerName property to "MySecureServer.com".
|
||||
* If you do not know the peer name of the remote host in advance (for example, you're not sure
|
||||
* if it will be "domain.com" or "www.domain.com"), then you can use the default settings to validate the
|
||||
* certificate, and then use the X509Certificate class to verify the issuer after the socket has been secured.
|
||||
* The X509Certificate class is part of the CocoaAsyncSocket open source project.
|
||||
**/
|
||||
- (void)startTLS:(NSDictionary *)tlsSettings;
|
||||
|
||||
/**
|
||||
* For handling readDataToData requests, data is necessarily read from the socket in small increments.
|
||||
* The performance can be much improved by allowing AsyncSocket to read larger chunks at a time and
|
||||
* store any overflow in a small internal buffer.
|
||||
* This is termed pre-buffering, as some data may be read for you before you ask for it.
|
||||
* If you use readDataToData a lot, enabling pre-buffering will result in better performance, especially on the iPhone.
|
||||
*
|
||||
* The default pre-buffering state is controlled by the DEFAULT_PREBUFFERING definition.
|
||||
* It is highly recommended one leave this set to YES.
|
||||
*
|
||||
* This method exists in case pre-buffering needs to be disabled by default for some unforeseen reason.
|
||||
* In that case, this method exists to allow one to easily enable pre-buffering when ready.
|
||||
**/
|
||||
- (void)enablePreBuffering;
|
||||
|
||||
/**
|
||||
* When you create an AsyncSocket, it is added to the runloop of the current thread.
|
||||
* So for manually created sockets, it is easiest to simply create the socket on the thread you intend to use it.
|
||||
*
|
||||
* If a new socket is accepted, the delegate method onSocket:wantsRunLoopForNewSocket: is called to
|
||||
* allow you to place the socket on a separate thread. This works best in conjunction with a thread pool design.
|
||||
*
|
||||
* If, however, you need to move the socket to a separate thread at a later time, this
|
||||
* method may be used to accomplish the task.
|
||||
*
|
||||
* This method must be called from the thread/runloop the socket is currently running on.
|
||||
*
|
||||
* Note: After calling this method, all further method calls to this object should be done from the given runloop.
|
||||
* Also, all delegate calls will be sent on the given runloop.
|
||||
**/
|
||||
- (BOOL)moveToRunLoop:(NSRunLoop *)runLoop;
|
||||
|
||||
/**
|
||||
* Allows you to configure which run loop modes the socket uses.
|
||||
* The default set of run loop modes is NSDefaultRunLoopMode.
|
||||
*
|
||||
* If you'd like your socket to continue operation during other modes, you may want to add modes such as
|
||||
* NSModalPanelRunLoopMode or NSEventTrackingRunLoopMode. Or you may simply want to use NSRunLoopCommonModes.
|
||||
*
|
||||
* Accepted sockets will automatically inherit the same run loop modes as the listening socket.
|
||||
*
|
||||
* Note: NSRunLoopCommonModes is defined in 10.5. For previous versions one can use kCFRunLoopCommonModes.
|
||||
**/
|
||||
- (BOOL)setRunLoopModes:(NSArray *)runLoopModes;
|
||||
- (BOOL)addRunLoopMode:(NSString *)runLoopMode;
|
||||
- (BOOL)removeRunLoopMode:(NSString *)runLoopMode;
|
||||
|
||||
/**
|
||||
* Returns the current run loop modes the AsyncSocket instance is operating in.
|
||||
* The default set of run loop modes is NSDefaultRunLoopMode.
|
||||
**/
|
||||
- (NSArray *)runLoopModes;
|
||||
|
||||
/**
|
||||
* In the event of an error, this method may be called during onSocket:willDisconnectWithError: to read
|
||||
* any data that's left on the socket.
|
||||
**/
|
||||
- (NSData *)unreadData;
|
||||
|
||||
/* A few common line separators, for use with the readDataToData:... methods. */
|
||||
+ (NSData *)CRLFData; // 0x0D0A
|
||||
+ (NSData *)CRData; // 0x0D
|
||||
+ (NSData *)LFData; // 0x0A
|
||||
+ (NSData *)ZeroData; // 0x00
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,368 @@
|
|||
//
|
||||
// AsyncUdpSocket.h
|
||||
//
|
||||
// This class is in the public domain.
|
||||
// Originally created by Robbie Hanson on Wed Oct 01 2008.
|
||||
// Updated and maintained by Deusty Designs and the Mac development community.
|
||||
//
|
||||
// http://code.google.com/p/cocoaasyncsocket/
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class AsyncSendPacket;
|
||||
@class AsyncReceivePacket;
|
||||
|
||||
extern NSString *const AsyncUdpSocketException;
|
||||
extern NSString *const AsyncUdpSocketErrorDomain;
|
||||
|
||||
typedef NS_ENUM(NSInteger, AsyncUdpSocketError) {
|
||||
AsyncUdpSocketCFSocketError = kCFSocketError, // From CFSocketError enum
|
||||
AsyncUdpSocketNoError = 0, // Never used
|
||||
AsyncUdpSocketBadParameter, // Used if given a bad parameter (such as an improper address)
|
||||
AsyncUdpSocketIPv4Unavailable, // Used if you bind/connect using IPv6 only
|
||||
AsyncUdpSocketIPv6Unavailable, // Used if you bind/connect using IPv4 only (or iPhone)
|
||||
AsyncUdpSocketSendTimeoutError,
|
||||
AsyncUdpSocketReceiveTimeoutError
|
||||
};
|
||||
|
||||
@interface AsyncUdpSocket : NSObject
|
||||
{
|
||||
CFSocketRef theSocket4; // IPv4 socket
|
||||
CFSocketRef theSocket6; // IPv6 socket
|
||||
|
||||
CFRunLoopSourceRef theSource4; // For theSocket4
|
||||
CFRunLoopSourceRef theSource6; // For theSocket6
|
||||
CFRunLoopRef theRunLoop;
|
||||
CFSocketContext theContext;
|
||||
NSArray *theRunLoopModes;
|
||||
|
||||
NSMutableArray *theSendQueue;
|
||||
AsyncSendPacket *theCurrentSend;
|
||||
NSTimer *theSendTimer;
|
||||
|
||||
NSMutableArray *theReceiveQueue;
|
||||
AsyncReceivePacket *theCurrentReceive;
|
||||
NSTimer *theReceiveTimer;
|
||||
|
||||
id theDelegate;
|
||||
UInt16 theFlags;
|
||||
|
||||
long theUserData;
|
||||
|
||||
NSString *cachedLocalHost;
|
||||
UInt16 cachedLocalPort;
|
||||
|
||||
NSString *cachedConnectedHost;
|
||||
UInt16 cachedConnectedPort;
|
||||
|
||||
UInt32 maxReceiveBufferSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new instances of AsyncUdpSocket.
|
||||
**/
|
||||
- (id)init;
|
||||
- (id)initWithDelegate:(id)delegate;
|
||||
- (id)initWithDelegate:(id)delegate userData:(long)userData;
|
||||
|
||||
/**
|
||||
* Creates new instances of AsyncUdpSocket that support only IPv4 or IPv6.
|
||||
* The other init methods will support both, unless specifically binded or connected to one protocol.
|
||||
* If you know you'll only be using one protocol, these init methods may be a bit more efficient.
|
||||
**/
|
||||
- (id)initIPv4;
|
||||
- (id)initIPv6;
|
||||
|
||||
- (id)delegate;
|
||||
- (void)setDelegate:(id)delegate;
|
||||
|
||||
- (long)userData;
|
||||
- (void)setUserData:(long)userData;
|
||||
|
||||
/**
|
||||
* Returns the local address info for the socket.
|
||||
*
|
||||
* Note: Address info may not be available until after the socket has been bind'ed,
|
||||
* or until after data has been sent.
|
||||
**/
|
||||
- (NSString *)localHost;
|
||||
- (UInt16)localPort;
|
||||
|
||||
/**
|
||||
* Returns the remote address info for the socket.
|
||||
*
|
||||
* Note: Since UDP is connectionless by design, connected address info
|
||||
* will not be available unless the socket is explicitly connected to a remote host/port
|
||||
**/
|
||||
- (NSString *)connectedHost;
|
||||
- (UInt16)connectedPort;
|
||||
|
||||
/**
|
||||
* Returns whether or not this socket has been connected to a single host.
|
||||
* By design, UDP is a connectionless protocol, and connecting is not needed.
|
||||
* If connected, the socket will only be able to send/receive data to/from the connected host.
|
||||
**/
|
||||
- (BOOL)isConnected;
|
||||
|
||||
/**
|
||||
* Returns whether or not this socket has been closed.
|
||||
* The only way a socket can be closed is if you explicitly call one of the close methods.
|
||||
**/
|
||||
- (BOOL)isClosed;
|
||||
|
||||
/**
|
||||
* Returns whether or not this socket supports IPv4.
|
||||
* By default this will be true, unless the socket is specifically initialized as IPv6 only,
|
||||
* or is binded or connected to an IPv6 address.
|
||||
**/
|
||||
- (BOOL)isIPv4;
|
||||
|
||||
/**
|
||||
* Returns whether or not this socket supports IPv6.
|
||||
* By default this will be true, unless the socket is specifically initialized as IPv4 only,
|
||||
* or is binded or connected to an IPv4 address.
|
||||
*
|
||||
* This method will also return false on platforms that do not support IPv6.
|
||||
* Note: The iPhone does not currently support IPv6.
|
||||
**/
|
||||
- (BOOL)isIPv6;
|
||||
|
||||
/**
|
||||
* Returns the mtu of the socket.
|
||||
* If unknown, returns zero.
|
||||
*
|
||||
* Sending data larger than this may result in an error.
|
||||
* This is an advanced topic, and one should understand the wide range of mtu's on networks and the internet.
|
||||
* Therefore this method is only for reference and may be of little use in many situations.
|
||||
**/
|
||||
- (unsigned int)maximumTransmissionUnit;
|
||||
|
||||
/**
|
||||
* Binds the UDP socket to the given port and optional address.
|
||||
* Binding should be done for server sockets that receive data prior to sending it.
|
||||
* Client sockets can skip binding,
|
||||
* as the OS will automatically assign the socket an available port when it starts sending data.
|
||||
*
|
||||
* You cannot bind a socket after its been connected.
|
||||
* You can only bind a socket once.
|
||||
* You can still connect a socket (if desired) after binding.
|
||||
*
|
||||
* On success, returns YES.
|
||||
* Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr.
|
||||
**/
|
||||
- (BOOL)bindToPort:(UInt16)port error:(NSError **)errPtr;
|
||||
- (BOOL)bindToAddress:(NSString *)localAddr port:(UInt16)port error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* Connects the UDP socket to the given host and port.
|
||||
* By design, UDP is a connectionless protocol, and connecting is not needed.
|
||||
*
|
||||
* Choosing to connect to a specific host/port has the following effect:
|
||||
* - You will only be able to send data to the connected host/port.
|
||||
* - You will only be able to receive data from the connected host/port.
|
||||
* - You will receive ICMP messages that come from the connected host/port, such as "connection refused".
|
||||
*
|
||||
* Connecting a UDP socket does not result in any communication on the socket.
|
||||
* It simply changes the internal state of the socket.
|
||||
*
|
||||
* You cannot bind a socket after its been connected.
|
||||
* You can only connect a socket once.
|
||||
*
|
||||
* On success, returns YES.
|
||||
* Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr.
|
||||
**/
|
||||
- (BOOL)connectToHost:(NSString *)host onPort:(UInt16)port error:(NSError **)errPtr;
|
||||
- (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* Join multicast group
|
||||
*
|
||||
* Group should be an IP address (eg @"225.228.0.1")
|
||||
**/
|
||||
- (BOOL)joinMulticastGroup:(NSString *)group error:(NSError **)errPtr;
|
||||
- (BOOL)joinMulticastGroup:(NSString *)group withAddress:(NSString *)interface error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* By default, the underlying socket in the OS will not allow you to send broadcast messages.
|
||||
* In order to send broadcast messages, you need to enable this functionality in the socket.
|
||||
*
|
||||
* A broadcast is a UDP message to addresses like "192.168.255.255" or "255.255.255.255" that is
|
||||
* delivered to every host on the network.
|
||||
* The reason this is generally disabled by default is to prevent
|
||||
* accidental broadcast messages from flooding the network.
|
||||
**/
|
||||
- (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* Asynchronously sends the given data, with the given timeout and tag.
|
||||
*
|
||||
* This method may only be used with a connected socket.
|
||||
*
|
||||
* If data is nil or zero-length, this method does nothing and immediately returns NO.
|
||||
* If the socket is not connected, this method does nothing and immediately returns NO.
|
||||
**/
|
||||
- (BOOL)sendData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Asynchronously sends the given data, with the given timeout and tag, to the given host and port.
|
||||
*
|
||||
* This method cannot be used with a connected socket.
|
||||
*
|
||||
* If data is nil or zero-length, this method does nothing and immediately returns NO.
|
||||
* If the socket is connected, this method does nothing and immediately returns NO.
|
||||
* If unable to resolve host to a valid IPv4 or IPv6 address, this method returns NO.
|
||||
**/
|
||||
- (BOOL)sendData:(NSData *)data toHost:(NSString *)host port:(UInt16)port withTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Asynchronously sends the given data, with the given timeout and tag, to the given address.
|
||||
*
|
||||
* This method cannot be used with a connected socket.
|
||||
*
|
||||
* If data is nil or zero-length, this method does nothing and immediately returns NO.
|
||||
* If the socket is connected, this method does nothing and immediately returns NO.
|
||||
**/
|
||||
- (BOOL)sendData:(NSData *)data toAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Asynchronously receives a single datagram packet.
|
||||
*
|
||||
* If the receive succeeds, the onUdpSocket:didReceiveData:fromHost:port:tag delegate method will be called.
|
||||
* Otherwise, a timeout will occur, and the onUdpSocket:didNotReceiveDataWithTag: delegate method will be called.
|
||||
**/
|
||||
- (void)receiveWithTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Closes the socket immediately. Any pending send or receive operations are dropped.
|
||||
**/
|
||||
- (void)close;
|
||||
|
||||
/**
|
||||
* Closes after all pending send operations have completed.
|
||||
* After calling this, the sendData: and receive: methods will do nothing.
|
||||
* In other words, you won't be able to add any more send or receive operations to the queue.
|
||||
* The socket will close even if there are still pending receive operations.
|
||||
**/
|
||||
- (void)closeAfterSending;
|
||||
|
||||
/**
|
||||
* Closes after all pending receive operations have completed.
|
||||
* After calling this, the sendData: and receive: methods will do nothing.
|
||||
* In other words, you won't be able to add any more send or receive operations to the queue.
|
||||
* The socket will close even if there are still pending send operations.
|
||||
**/
|
||||
- (void)closeAfterReceiving;
|
||||
|
||||
/**
|
||||
* Closes after all pending send and receive operations have completed.
|
||||
* After calling this, the sendData: and receive: methods will do nothing.
|
||||
* In other words, you won't be able to add any more send or receive operations to the queue.
|
||||
**/
|
||||
- (void)closeAfterSendingAndReceiving;
|
||||
|
||||
/**
|
||||
* Gets/Sets the maximum size of the buffer that will be allocated for receive operations.
|
||||
* The default size is 9216 bytes.
|
||||
*
|
||||
* The theoretical maximum size of any IPv4 UDP packet is UINT16_MAX = 65535.
|
||||
* The theoretical maximum size of any IPv6 UDP packet is UINT32_MAX = 4294967295.
|
||||
*
|
||||
* In practice, however, the size of UDP packets will be much smaller.
|
||||
* Indeed most protocols will send and receive packets of only a few bytes,
|
||||
* or will set a limit on the size of packets to prevent fragmentation in the IP layer.
|
||||
*
|
||||
* If you set the buffer size too small, the sockets API in the OS will silently discard
|
||||
* any extra data, and you will not be notified of the error.
|
||||
**/
|
||||
- (UInt32)maxReceiveBufferSize;
|
||||
- (void)setMaxReceiveBufferSize:(UInt32)max;
|
||||
|
||||
/**
|
||||
* When you create an AsyncUdpSocket, it is added to the runloop of the current thread.
|
||||
* So it is easiest to simply create the socket on the thread you intend to use it.
|
||||
*
|
||||
* If, however, you need to move the socket to a separate thread at a later time, this
|
||||
* method may be used to accomplish the task.
|
||||
*
|
||||
* This method must be called from the thread/runloop the socket is currently running on.
|
||||
*
|
||||
* Note: After calling this method, all further method calls to this object should be done from the given runloop.
|
||||
* Also, all delegate calls will be sent on the given runloop.
|
||||
**/
|
||||
- (BOOL)moveToRunLoop:(NSRunLoop *)runLoop;
|
||||
|
||||
/**
|
||||
* Allows you to configure which run loop modes the socket uses.
|
||||
* The default set of run loop modes is NSDefaultRunLoopMode.
|
||||
*
|
||||
* If you'd like your socket to continue operation during other modes, you may want to add modes such as
|
||||
* NSModalPanelRunLoopMode or NSEventTrackingRunLoopMode. Or you may simply want to use NSRunLoopCommonModes.
|
||||
*
|
||||
* Note: NSRunLoopCommonModes is defined in 10.5. For previous versions one can use kCFRunLoopCommonModes.
|
||||
**/
|
||||
- (BOOL)setRunLoopModes:(NSArray *)runLoopModes;
|
||||
|
||||
/**
|
||||
* Returns the current run loop modes the AsyncSocket instance is operating in.
|
||||
* The default set of run loop modes is NSDefaultRunLoopMode.
|
||||
**/
|
||||
- (NSArray *)runLoopModes;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@protocol AsyncUdpSocketDelegate
|
||||
@optional
|
||||
|
||||
/**
|
||||
* Called when the datagram with the given tag has been sent.
|
||||
**/
|
||||
- (void)onUdpSocket:(AsyncUdpSocket *)sock didSendDataWithTag:(long)tag;
|
||||
|
||||
/**
|
||||
* Called if an error occurs while trying to send a datagram.
|
||||
* This could be due to a timeout, or something more serious such as the data being too large to fit in a sigle packet.
|
||||
**/
|
||||
- (void)onUdpSocket:(AsyncUdpSocket *)sock didNotSendDataWithTag:(long)tag dueToError:(NSError *)error;
|
||||
|
||||
/**
|
||||
* Called when the socket has received the requested datagram.
|
||||
*
|
||||
* Due to the nature of UDP, you may occasionally receive undesired packets.
|
||||
* These may be rogue UDP packets from unknown hosts,
|
||||
* or they may be delayed packets arriving after retransmissions have already occurred.
|
||||
* It's important these packets are properly ignored, while not interfering with the flow of your implementation.
|
||||
* As an aid, this delegate method has a boolean return value.
|
||||
* If you ever need to ignore a received packet, simply return NO,
|
||||
* and AsyncUdpSocket will continue as if the packet never arrived.
|
||||
* That is, the original receive request will still be queued, and will still timeout as usual if a timeout was set.
|
||||
* For example, say you requested to receive data, and you set a timeout of 500 milliseconds, using a tag of 15.
|
||||
* If rogue data arrives after 250 milliseconds, this delegate method would be invoked, and you could simply return NO.
|
||||
* If the expected data then arrives within the next 250 milliseconds,
|
||||
* this delegate method will be invoked, with a tag of 15, just as if the rogue data never appeared.
|
||||
*
|
||||
* Under normal circumstances, you simply return YES from this method.
|
||||
**/
|
||||
- (BOOL)onUdpSocket:(AsyncUdpSocket *)sock
|
||||
didReceiveData:(NSData *)data
|
||||
withTag:(long)tag
|
||||
fromHost:(NSString *)host
|
||||
port:(UInt16)port;
|
||||
|
||||
/**
|
||||
* Called if an error occurs while trying to receive a requested datagram.
|
||||
* This is generally due to a timeout, but could potentially be something else if some kind of OS error occurred.
|
||||
**/
|
||||
- (void)onUdpSocket:(AsyncUdpSocket *)sock didNotReceiveDataWithTag:(long)tag dueToError:(NSError *)error;
|
||||
|
||||
/**
|
||||
* Called when the socket is closed.
|
||||
* A socket is only closed if you explicitly call one of the close methods.
|
||||
**/
|
||||
- (void)onUdpSocketDidClose:(AsyncUdpSocket *)sock;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// CocoaAsyncSocket.h
|
||||
// CocoaAsyncSocket
|
||||
//
|
||||
// Created by Derek Clarkson on 10/08/2015.
|
||||
// Copyright © 2015 Robbie Hanson. All rights reserved.
|
||||
//
|
||||
|
||||
@import Foundation;
|
||||
|
||||
//! Project version number for CocoaAsyncSocket.
|
||||
FOUNDATION_EXPORT double cocoaAsyncSocketVersionNumber;
|
||||
|
||||
//! Project version string for CocoaAsyncSocket.
|
||||
FOUNDATION_EXPORT const unsigned char cocoaAsyncSocketVersionString[];
|
||||
|
||||
#import <CocoaAsyncSocket/AsyncSocket.h>
|
||||
#import <CocoaAsyncSocket/AsyncUdpSocket.h>
|
||||
#import <CocoaAsyncSocket/GCDAsyncSocket.h>
|
||||
#import <CocoaAsyncSocket/GCDAsyncUdpSocket.h>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
framework module CocoaAsyncSocket {
|
||||
umbrella header "CocoaAsyncSocket.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
<?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>files</key>
|
||||
<dict>
|
||||
<key>Headers/AsyncSocket.h</key>
|
||||
<data>
|
||||
GyStCmhuxAWLghA+fHLwPiSbVNI=
|
||||
</data>
|
||||
<key>Headers/AsyncUdpSocket.h</key>
|
||||
<data>
|
||||
oqLPl3ROAyiOqTaqhuupNjuxVU0=
|
||||
</data>
|
||||
<key>Headers/CocoaAsyncSocket.h</key>
|
||||
<data>
|
||||
fwx/DHzHzUQhtlfC9ffKAK+SFx0=
|
||||
</data>
|
||||
<key>Headers/GCDAsyncSocket.h</key>
|
||||
<data>
|
||||
epdhmCIMokKCqjy5t9gOnzDF1FA=
|
||||
</data>
|
||||
<key>Headers/GCDAsyncUdpSocket.h</key>
|
||||
<data>
|
||||
LH5V3wgNYRH1dy/fNu8r4lu8puI=
|
||||
</data>
|
||||
<key>Info.plist</key>
|
||||
<data>
|
||||
fufWkrOArtjBazvt+HY0gYMiRvw=
|
||||
</data>
|
||||
<key>Modules/module.modulemap</key>
|
||||
<data>
|
||||
+n94rYTWDjekX3imyh+PSyA9vgA=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Headers/AsyncSocket.h</key>
|
||||
<data>
|
||||
GyStCmhuxAWLghA+fHLwPiSbVNI=
|
||||
</data>
|
||||
<key>Headers/AsyncUdpSocket.h</key>
|
||||
<data>
|
||||
oqLPl3ROAyiOqTaqhuupNjuxVU0=
|
||||
</data>
|
||||
<key>Headers/CocoaAsyncSocket.h</key>
|
||||
<data>
|
||||
fwx/DHzHzUQhtlfC9ffKAK+SFx0=
|
||||
</data>
|
||||
<key>Headers/GCDAsyncSocket.h</key>
|
||||
<data>
|
||||
epdhmCIMokKCqjy5t9gOnzDF1FA=
|
||||
</data>
|
||||
<key>Headers/GCDAsyncUdpSocket.h</key>
|
||||
<data>
|
||||
LH5V3wgNYRH1dy/fNu8r4lu8puI=
|
||||
</data>
|
||||
<key>Modules/module.modulemap</key>
|
||||
<data>
|
||||
+n94rYTWDjekX3imyh+PSyA9vgA=
|
||||
</data>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^[^/]+$</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,767 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
118846D11C8FBE9B0018652B /* CocoaAsyncSocket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 118846D01C8FBE9B0018652B /* CocoaAsyncSocket.framework */; };
|
||||
118846D21C8FBE9B0018652B /* CocoaAsyncSocket.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 118846D01C8FBE9B0018652B /* CocoaAsyncSocket.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
401776C5194EBBEE00961E62 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 401776C4194EBBEE00961E62 /* Foundation.framework */; };
|
||||
401776C7194EBBEE00961E62 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 401776C6194EBBEE00961E62 /* CoreGraphics.framework */; };
|
||||
401776C9194EBBEE00961E62 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 401776C8194EBBEE00961E62 /* UIKit.framework */; };
|
||||
401776CF194EBBEE00961E62 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 401776CD194EBBEE00961E62 /* InfoPlist.strings */; };
|
||||
401776D1194EBBEE00961E62 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 401776D0194EBBEE00961E62 /* main.m */; };
|
||||
401776D5194EBBEE00961E62 /* RTKAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 401776D4194EBBEE00961E62 /* RTKAppDelegate.m */; };
|
||||
401776D8194EBBEE00961E62 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 401776D6194EBBEE00961E62 /* Main_iPhone.storyboard */; };
|
||||
401776DB194EBBEE00961E62 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 401776D9194EBBEE00961E62 /* Main_iPad.storyboard */; };
|
||||
401776DE194EBBEE00961E62 /* RTKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 401776DD194EBBEE00961E62 /* RTKViewController.m */; };
|
||||
401776E0194EBBEE00961E62 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 401776DF194EBBEE00961E62 /* Images.xcassets */; };
|
||||
401776E7194EBBEE00961E62 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 401776E6194EBBEE00961E62 /* XCTest.framework */; };
|
||||
401776E8194EBBEE00961E62 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 401776C4194EBBEE00961E62 /* Foundation.framework */; };
|
||||
401776E9194EBBEE00961E62 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 401776C8194EBBEE00961E62 /* UIKit.framework */; };
|
||||
401776F1194EBBEE00961E62 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 401776EF194EBBEE00961E62 /* InfoPlist.strings */; };
|
||||
401776F3194EBBEE00961E62 /* SimpleConfigTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 401776F2194EBBEE00961E62 /* SimpleConfigTests.m */; };
|
||||
401777081950681800961E62 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 401777071950681800961E62 /* SystemConfiguration.framework */; };
|
||||
401777171951720500961E62 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 401777161951720500961E62 /* Reachability.m */; };
|
||||
4017772D1952C45300961E62 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4017772C1952C45300961E62 /* CFNetwork.framework */; };
|
||||
4017772F1952C46D00961E62 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4017772E1952C46D00961E62 /* AVFoundation.framework */; };
|
||||
401777311952C47C00961E62 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 401777301952C47C00961E62 /* QuartzCore.framework */; };
|
||||
4017776F1952D6D700961E62 /* ic_dialog_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 401777681952D6D700961E62 /* ic_dialog_icon.png */; };
|
||||
401777701952D6D700961E62 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 401777691952D6D700961E62 /* icon.png */; };
|
||||
401777711952D6D700961E62 /* imagebtn_bg_up.png in Resources */ = {isa = PBXBuildFile; fileRef = 4017776A1952D6D700961E62 /* imagebtn_bg_up.png */; };
|
||||
401777721952D6D700961E62 /* imagebtn_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 4017776B1952D6D700961E62 /* imagebtn_bg.png */; };
|
||||
401777731952D6D700961E62 /* qrcode_img.png in Resources */ = {isa = PBXBuildFile; fileRef = 4017776C1952D6D700961E62 /* qrcode_img.png */; };
|
||||
401777741952D6D700961E62 /* refresh.png in Resources */ = {isa = PBXBuildFile; fileRef = 4017776D1952D6D700961E62 /* refresh.png */; };
|
||||
401777751952D6D700961E62 /* settings.png in Resources */ = {isa = PBXBuildFile; fileRef = 4017776E1952D6D700961E62 /* settings.png */; };
|
||||
40B78F6319644FB9001DF6AC /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 401777071950681800961E62 /* SystemConfiguration.framework */; };
|
||||
40B78F6519644FC7001DF6AC /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40B78F6419644FC7001DF6AC /* CoreVideo.framework */; };
|
||||
40B78F6719644FD2001DF6AC /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40B78F6619644FD2001DF6AC /* CoreMedia.framework */; };
|
||||
40B7E2631998605D00A99737 /* libLibSimpleConfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40B7E25E1998605D00A99737 /* libLibSimpleConfig.a */; };
|
||||
40B7E2841998609200A99737 /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40B7E27D1998609200A99737 /* libzbar.a */; };
|
||||
40B7E2851998609200A99737 /* Thumbs.db in Resources */ = {isa = PBXBuildFile; fileRef = 40B7E27F1998609200A99737 /* Thumbs.db */; };
|
||||
40B7E2861998609200A99737 /* zbar-back.png in Resources */ = {isa = PBXBuildFile; fileRef = 40B7E2801998609200A99737 /* zbar-back.png */; };
|
||||
40B7E2871998609200A99737 /* zbar-help.html in Resources */ = {isa = PBXBuildFile; fileRef = 40B7E2811998609200A99737 /* zbar-help.html */; };
|
||||
40B7E2881998609200A99737 /* zbar-helpicons.png in Resources */ = {isa = PBXBuildFile; fileRef = 40B7E2821998609200A99737 /* zbar-helpicons.png */; };
|
||||
40B7E2891998609200A99737 /* zbar-samples.png in Resources */ = {isa = PBXBuildFile; fileRef = 40B7E2831998609200A99737 /* zbar-samples.png */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
401776EA194EBBEE00961E62 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 401776B9194EBBEE00961E62 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 401776C0194EBBEE00961E62;
|
||||
remoteInfo = SimpleConfig;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
118846CF1C8F00380018652B /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
118846D21C8FBE9B0018652B /* CocoaAsyncSocket.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
118846D01C8FBE9B0018652B /* CocoaAsyncSocket.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CocoaAsyncSocket.framework; sourceTree = "<group>"; };
|
||||
401776C1194EBBEE00961E62 /* SimpleConfig.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimpleConfig.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
401776C4194EBBEE00961E62 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
401776C6194EBBEE00961E62 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
401776C8194EBBEE00961E62 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
401776CC194EBBEE00961E62 /* SimpleConfig-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SimpleConfig-Info.plist"; sourceTree = "<group>"; };
|
||||
401776CE194EBBEE00961E62 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
401776D0194EBBEE00961E62 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
401776D2194EBBEE00961E62 /* SimpleConfig-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SimpleConfig-Prefix.pch"; sourceTree = "<group>"; };
|
||||
401776D3194EBBEE00961E62 /* RTKAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTKAppDelegate.h; sourceTree = "<group>"; };
|
||||
401776D4194EBBEE00961E62 /* RTKAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RTKAppDelegate.m; sourceTree = "<group>"; };
|
||||
401776D7194EBBEE00961E62 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = "<group>"; };
|
||||
401776DA194EBBEE00961E62 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = "<group>"; };
|
||||
401776DC194EBBEE00961E62 /* RTKViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTKViewController.h; sourceTree = "<group>"; };
|
||||
401776DD194EBBEE00961E62 /* RTKViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = RTKViewController.m; sourceTree = "<group>"; };
|
||||
401776DF194EBBEE00961E62 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
401776E5194EBBEE00961E62 /* SimpleConfigTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimpleConfigTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
401776E6194EBBEE00961E62 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
|
||||
401776EE194EBBEE00961E62 /* SimpleConfigTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SimpleConfigTests-Info.plist"; sourceTree = "<group>"; };
|
||||
401776F0194EBBEE00961E62 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
401776F2194EBBEE00961E62 /* SimpleConfigTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SimpleConfigTests.m; sourceTree = "<group>"; };
|
||||
401777071950681800961E62 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
|
||||
401777151951720500961E62 /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = "<group>"; };
|
||||
401777161951720500961E62 /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = "<group>"; };
|
||||
4017772C1952C45300961E62 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
|
||||
4017772E1952C46D00961E62 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
|
||||
401777301952C47C00961E62 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
401777681952D6D700961E62 /* ic_dialog_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_dialog_icon.png; path = image/ic_dialog_icon.png; sourceTree = "<group>"; };
|
||||
401777691952D6D700961E62 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = icon.png; path = image/icon.png; sourceTree = "<group>"; };
|
||||
4017776A1952D6D700961E62 /* imagebtn_bg_up.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = imagebtn_bg_up.png; path = image/imagebtn_bg_up.png; sourceTree = "<group>"; };
|
||||
4017776B1952D6D700961E62 /* imagebtn_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = imagebtn_bg.png; path = image/imagebtn_bg.png; sourceTree = "<group>"; };
|
||||
4017776C1952D6D700961E62 /* qrcode_img.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = qrcode_img.png; path = image/qrcode_img.png; sourceTree = "<group>"; };
|
||||
4017776D1952D6D700961E62 /* refresh.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = refresh.png; path = image/refresh.png; sourceTree = "<group>"; };
|
||||
4017776E1952D6D700961E62 /* settings.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = settings.png; path = image/settings.png; sourceTree = "<group>"; };
|
||||
40B78F5F19644DB6001DF6AC /* libLibSimpleConfig.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libLibSimpleConfig.a; path = SimpleConfig/include/LibSimpleConfig/libLibSimpleConfig.a; sourceTree = "<group>"; };
|
||||
40B78F6119644DC0001DF6AC /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libzbar.a; path = SimpleConfig/include/ZBarSDK/libzbar.a; sourceTree = "<group>"; };
|
||||
40B78F6419644FC7001DF6AC /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
|
||||
40B78F6619644FD2001DF6AC /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
|
||||
40B7E25E1998605D00A99737 /* libLibSimpleConfig.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libLibSimpleConfig.a; sourceTree = "<group>"; };
|
||||
40B7E2601998605D00A99737 /* LibSimpleConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LibSimpleConfig.h; sourceTree = "<group>"; };
|
||||
40B7E2621998605D00A99737 /* SimpleConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleConfig.h; sourceTree = "<group>"; };
|
||||
40B7E2691998609200A99737 /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = "<group>"; };
|
||||
40B7E26A1998609200A99737 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; };
|
||||
40B7E26B1998609200A99737 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = "<group>"; };
|
||||
40B7E26C1998609200A99737 /* ImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageScanner.h; sourceTree = "<group>"; };
|
||||
40B7E26D1998609200A99737 /* Processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Processor.h; sourceTree = "<group>"; };
|
||||
40B7E26E1998609200A99737 /* Scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scanner.h; sourceTree = "<group>"; };
|
||||
40B7E26F1998609200A99737 /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Symbol.h; sourceTree = "<group>"; };
|
||||
40B7E2701998609200A99737 /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = "<group>"; };
|
||||
40B7E2711998609200A99737 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Window.h; sourceTree = "<group>"; };
|
||||
40B7E2721998609200A99737 /* zbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zbar.h; sourceTree = "<group>"; };
|
||||
40B7E2731998609200A99737 /* ZBarCameraSimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCameraSimulator.h; sourceTree = "<group>"; };
|
||||
40B7E2741998609200A99737 /* ZBarCaptureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCaptureReader.h; sourceTree = "<group>"; };
|
||||
40B7E2751998609200A99737 /* ZBarHelpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarHelpController.h; sourceTree = "<group>"; };
|
||||
40B7E2761998609200A99737 /* ZBarImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImage.h; sourceTree = "<group>"; };
|
||||
40B7E2771998609200A99737 /* ZBarImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImageScanner.h; sourceTree = "<group>"; };
|
||||
40B7E2781998609200A99737 /* ZBarReaderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderController.h; sourceTree = "<group>"; };
|
||||
40B7E2791998609200A99737 /* ZBarReaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderView.h; sourceTree = "<group>"; };
|
||||
40B7E27A1998609200A99737 /* ZBarReaderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderViewController.h; sourceTree = "<group>"; };
|
||||
40B7E27B1998609200A99737 /* ZBarSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSDK.h; sourceTree = "<group>"; };
|
||||
40B7E27C1998609200A99737 /* ZBarSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSymbol.h; sourceTree = "<group>"; };
|
||||
40B7E27D1998609200A99737 /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libzbar.a; sourceTree = "<group>"; };
|
||||
40B7E27F1998609200A99737 /* Thumbs.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = Thumbs.db; sourceTree = "<group>"; };
|
||||
40B7E2801998609200A99737 /* zbar-back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-back.png"; sourceTree = "<group>"; };
|
||||
40B7E2811998609200A99737 /* zbar-help.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "zbar-help.html"; sourceTree = "<group>"; };
|
||||
40B7E2821998609200A99737 /* zbar-helpicons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-helpicons.png"; sourceTree = "<group>"; };
|
||||
40B7E2831998609200A99737 /* zbar-samples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-samples.png"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
401776BE194EBBEE00961E62 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
40B78F6719644FD2001DF6AC /* CoreMedia.framework in Frameworks */,
|
||||
40B78F6519644FC7001DF6AC /* CoreVideo.framework in Frameworks */,
|
||||
40B7E2841998609200A99737 /* libzbar.a in Frameworks */,
|
||||
40B78F6319644FB9001DF6AC /* SystemConfiguration.framework in Frameworks */,
|
||||
401776C5194EBBEE00961E62 /* Foundation.framework in Frameworks */,
|
||||
401777311952C47C00961E62 /* QuartzCore.framework in Frameworks */,
|
||||
118846D11C8FBE9B0018652B /* CocoaAsyncSocket.framework in Frameworks */,
|
||||
4017772F1952C46D00961E62 /* AVFoundation.framework in Frameworks */,
|
||||
4017772D1952C45300961E62 /* CFNetwork.framework in Frameworks */,
|
||||
40B7E2631998605D00A99737 /* libLibSimpleConfig.a in Frameworks */,
|
||||
401776C7194EBBEE00961E62 /* CoreGraphics.framework in Frameworks */,
|
||||
401776C9194EBBEE00961E62 /* UIKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
401776E2194EBBEE00961E62 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
401777081950681800961E62 /* SystemConfiguration.framework in Frameworks */,
|
||||
401776E7194EBBEE00961E62 /* XCTest.framework in Frameworks */,
|
||||
401776E9194EBBEE00961E62 /* UIKit.framework in Frameworks */,
|
||||
401776E8194EBBEE00961E62 /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
401776B8194EBBEE00961E62 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
118846D01C8FBE9B0018652B /* CocoaAsyncSocket.framework */,
|
||||
401776CA194EBBEE00961E62 /* SimpleConfig */,
|
||||
401776EC194EBBEE00961E62 /* SimpleConfigTests */,
|
||||
401776C3194EBBEE00961E62 /* Frameworks */,
|
||||
401776C2194EBBEE00961E62 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776C2194EBBEE00961E62 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
401776C1194EBBEE00961E62 /* SimpleConfig.app */,
|
||||
401776E5194EBBEE00961E62 /* SimpleConfigTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776C3194EBBEE00961E62 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40B78F6619644FD2001DF6AC /* CoreMedia.framework */,
|
||||
40B78F6419644FC7001DF6AC /* CoreVideo.framework */,
|
||||
40B78F6119644DC0001DF6AC /* libzbar.a */,
|
||||
40B78F5F19644DB6001DF6AC /* libLibSimpleConfig.a */,
|
||||
401777301952C47C00961E62 /* QuartzCore.framework */,
|
||||
4017772E1952C46D00961E62 /* AVFoundation.framework */,
|
||||
4017772C1952C45300961E62 /* CFNetwork.framework */,
|
||||
401777071950681800961E62 /* SystemConfiguration.framework */,
|
||||
401776C4194EBBEE00961E62 /* Foundation.framework */,
|
||||
401776C6194EBBEE00961E62 /* CoreGraphics.framework */,
|
||||
401776C8194EBBEE00961E62 /* UIKit.framework */,
|
||||
401776E6194EBBEE00961E62 /* XCTest.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776CA194EBBEE00961E62 /* SimpleConfig */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4017773A1952CAE500961E62 /* include */,
|
||||
401776FC194EBE6E00961E62 /* image */,
|
||||
401776D3194EBBEE00961E62 /* RTKAppDelegate.h */,
|
||||
401776D4194EBBEE00961E62 /* RTKAppDelegate.m */,
|
||||
401776D6194EBBEE00961E62 /* Main_iPhone.storyboard */,
|
||||
401776D9194EBBEE00961E62 /* Main_iPad.storyboard */,
|
||||
401776DC194EBBEE00961E62 /* RTKViewController.h */,
|
||||
401776DD194EBBEE00961E62 /* RTKViewController.m */,
|
||||
401777151951720500961E62 /* Reachability.h */,
|
||||
401777161951720500961E62 /* Reachability.m */,
|
||||
401776DF194EBBEE00961E62 /* Images.xcassets */,
|
||||
401776CB194EBBEE00961E62 /* Supporting Files */,
|
||||
);
|
||||
path = SimpleConfig;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776CB194EBBEE00961E62 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
401776CC194EBBEE00961E62 /* SimpleConfig-Info.plist */,
|
||||
401776CD194EBBEE00961E62 /* InfoPlist.strings */,
|
||||
401776D0194EBBEE00961E62 /* main.m */,
|
||||
401776D2194EBBEE00961E62 /* SimpleConfig-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776EC194EBBEE00961E62 /* SimpleConfigTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
401776F2194EBBEE00961E62 /* SimpleConfigTests.m */,
|
||||
401776ED194EBBEE00961E62 /* Supporting Files */,
|
||||
);
|
||||
path = SimpleConfigTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776ED194EBBEE00961E62 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
401776EE194EBBEE00961E62 /* SimpleConfigTests-Info.plist */,
|
||||
401776EF194EBBEE00961E62 /* InfoPlist.strings */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776FC194EBE6E00961E62 /* image */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
401777681952D6D700961E62 /* ic_dialog_icon.png */,
|
||||
401777691952D6D700961E62 /* icon.png */,
|
||||
4017776A1952D6D700961E62 /* imagebtn_bg_up.png */,
|
||||
4017776B1952D6D700961E62 /* imagebtn_bg.png */,
|
||||
4017776C1952D6D700961E62 /* qrcode_img.png */,
|
||||
4017776D1952D6D700961E62 /* refresh.png */,
|
||||
4017776E1952D6D700961E62 /* settings.png */,
|
||||
);
|
||||
name = image;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4017773A1952CAE500961E62 /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40B7E2651998609200A99737 /* ZBarSDK */,
|
||||
40B7E25B1998605D00A99737 /* LibSimpleConfig */,
|
||||
);
|
||||
name = include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
40B7E25B1998605D00A99737 /* LibSimpleConfig */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40B7E25E1998605D00A99737 /* libLibSimpleConfig.a */,
|
||||
40B7E2601998605D00A99737 /* LibSimpleConfig.h */,
|
||||
40B7E2621998605D00A99737 /* SimpleConfig.h */,
|
||||
);
|
||||
name = LibSimpleConfig;
|
||||
path = include/LibSimpleConfig;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
40B7E2651998609200A99737 /* ZBarSDK */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40B7E2661998609200A99737 /* Headers */,
|
||||
40B7E27D1998609200A99737 /* libzbar.a */,
|
||||
40B7E27E1998609200A99737 /* Resources */,
|
||||
);
|
||||
name = ZBarSDK;
|
||||
path = include/ZBarSDK;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
40B7E2661998609200A99737 /* Headers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40B7E2671998609200A99737 /* ZBarSDK */,
|
||||
);
|
||||
path = Headers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
40B7E2671998609200A99737 /* ZBarSDK */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40B7E2681998609200A99737 /* zbar */,
|
||||
40B7E2721998609200A99737 /* zbar.h */,
|
||||
40B7E2731998609200A99737 /* ZBarCameraSimulator.h */,
|
||||
40B7E2741998609200A99737 /* ZBarCaptureReader.h */,
|
||||
40B7E2751998609200A99737 /* ZBarHelpController.h */,
|
||||
40B7E2761998609200A99737 /* ZBarImage.h */,
|
||||
40B7E2771998609200A99737 /* ZBarImageScanner.h */,
|
||||
40B7E2781998609200A99737 /* ZBarReaderController.h */,
|
||||
40B7E2791998609200A99737 /* ZBarReaderView.h */,
|
||||
40B7E27A1998609200A99737 /* ZBarReaderViewController.h */,
|
||||
40B7E27B1998609200A99737 /* ZBarSDK.h */,
|
||||
40B7E27C1998609200A99737 /* ZBarSymbol.h */,
|
||||
);
|
||||
path = ZBarSDK;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
40B7E2681998609200A99737 /* zbar */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40B7E2691998609200A99737 /* Decoder.h */,
|
||||
40B7E26A1998609200A99737 /* Exception.h */,
|
||||
40B7E26B1998609200A99737 /* Image.h */,
|
||||
40B7E26C1998609200A99737 /* ImageScanner.h */,
|
||||
40B7E26D1998609200A99737 /* Processor.h */,
|
||||
40B7E26E1998609200A99737 /* Scanner.h */,
|
||||
40B7E26F1998609200A99737 /* Symbol.h */,
|
||||
40B7E2701998609200A99737 /* Video.h */,
|
||||
40B7E2711998609200A99737 /* Window.h */,
|
||||
);
|
||||
path = zbar;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
40B7E27E1998609200A99737 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
40B7E27F1998609200A99737 /* Thumbs.db */,
|
||||
40B7E2801998609200A99737 /* zbar-back.png */,
|
||||
40B7E2811998609200A99737 /* zbar-help.html */,
|
||||
40B7E2821998609200A99737 /* zbar-helpicons.png */,
|
||||
40B7E2831998609200A99737 /* zbar-samples.png */,
|
||||
);
|
||||
path = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
401776C0194EBBEE00961E62 /* SimpleConfig */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 401776F6194EBBEE00961E62 /* Build configuration list for PBXNativeTarget "SimpleConfig" */;
|
||||
buildPhases = (
|
||||
401776BD194EBBEE00961E62 /* Sources */,
|
||||
401776BE194EBBEE00961E62 /* Frameworks */,
|
||||
401776BF194EBBEE00961E62 /* Resources */,
|
||||
118846CF1C8F00380018652B /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = SimpleConfig;
|
||||
productName = SimpleConfig;
|
||||
productReference = 401776C1194EBBEE00961E62 /* SimpleConfig.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
401776E4194EBBEE00961E62 /* SimpleConfigTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 401776F9194EBBEE00961E62 /* Build configuration list for PBXNativeTarget "SimpleConfigTests" */;
|
||||
buildPhases = (
|
||||
401776E1194EBBEE00961E62 /* Sources */,
|
||||
401776E2194EBBEE00961E62 /* Frameworks */,
|
||||
401776E3194EBBEE00961E62 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
401776EB194EBBEE00961E62 /* PBXTargetDependency */,
|
||||
);
|
||||
name = SimpleConfigTests;
|
||||
productName = SimpleConfigTests;
|
||||
productReference = 401776E5194EBBEE00961E62 /* SimpleConfigTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
401776B9194EBBEE00961E62 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
CLASSPREFIX = RTK;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "___FULLUSERNAME___";
|
||||
TargetAttributes = {
|
||||
401776C0194EBBEE00961E62 = {
|
||||
DevelopmentTeam = ZYM2ETK3E7;
|
||||
};
|
||||
401776E4194EBBEE00961E62 = {
|
||||
TestTargetID = 401776C0194EBBEE00961E62;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 401776BC194EBBEE00961E62 /* Build configuration list for PBXProject "SimpleConfig" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 401776B8194EBBEE00961E62;
|
||||
productRefGroup = 401776C2194EBBEE00961E62 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
401776C0194EBBEE00961E62 /* SimpleConfig */,
|
||||
401776E4194EBBEE00961E62 /* SimpleConfigTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
401776BF194EBBEE00961E62 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
40B7E2851998609200A99737 /* Thumbs.db in Resources */,
|
||||
401776DB194EBBEE00961E62 /* Main_iPad.storyboard in Resources */,
|
||||
401777711952D6D700961E62 /* imagebtn_bg_up.png in Resources */,
|
||||
40B7E2871998609200A99737 /* zbar-help.html in Resources */,
|
||||
401777741952D6D700961E62 /* refresh.png in Resources */,
|
||||
401776E0194EBBEE00961E62 /* Images.xcassets in Resources */,
|
||||
40B7E2881998609200A99737 /* zbar-helpicons.png in Resources */,
|
||||
401777751952D6D700961E62 /* settings.png in Resources */,
|
||||
40B7E2861998609200A99737 /* zbar-back.png in Resources */,
|
||||
401777731952D6D700961E62 /* qrcode_img.png in Resources */,
|
||||
401777721952D6D700961E62 /* imagebtn_bg.png in Resources */,
|
||||
4017776F1952D6D700961E62 /* ic_dialog_icon.png in Resources */,
|
||||
401777701952D6D700961E62 /* icon.png in Resources */,
|
||||
40B7E2891998609200A99737 /* zbar-samples.png in Resources */,
|
||||
401776D8194EBBEE00961E62 /* Main_iPhone.storyboard in Resources */,
|
||||
401776CF194EBBEE00961E62 /* InfoPlist.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
401776E3194EBBEE00961E62 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
401776F1194EBBEE00961E62 /* InfoPlist.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
401776BD194EBBEE00961E62 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
401776D5194EBBEE00961E62 /* RTKAppDelegate.m in Sources */,
|
||||
401776D1194EBBEE00961E62 /* main.m in Sources */,
|
||||
401777171951720500961E62 /* Reachability.m in Sources */,
|
||||
401776DE194EBBEE00961E62 /* RTKViewController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
401776E1194EBBEE00961E62 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
401776F3194EBBEE00961E62 /* SimpleConfigTests.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
401776EB194EBBEE00961E62 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 401776C0194EBBEE00961E62 /* SimpleConfig */;
|
||||
targetProxy = 401776EA194EBBEE00961E62 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
401776CD194EBBEE00961E62 /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
401776CE194EBBEE00961E62 /* en */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776D6194EBBEE00961E62 /* Main_iPhone.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
401776D7194EBBEE00961E62 /* Base */,
|
||||
);
|
||||
name = Main_iPhone.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776D9194EBBEE00961E62 /* Main_iPad.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
401776DA194EBBEE00961E62 /* Base */,
|
||||
);
|
||||
name = Main_iPad.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
401776EF194EBBEE00961E62 /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
401776F0194EBBEE00961E62 /* en */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
401776F4194EBBEE00961E62 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
401776F5194EBBEE00961E62 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
401776F7194EBBEE00961E62 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/SimpleConfig/include/LibSimpleConfig",
|
||||
"$(PROJECT_DIR)/SimpleConfig/include",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "SimpleConfig/SimpleConfig-Prefix.pch";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
);
|
||||
INFOPLIST_FILE = "SimpleConfig/SimpleConfig-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/SimpleConfig",
|
||||
"$(PROJECT_DIR)/SimpleConfig/include/ZBarSDK",
|
||||
"$(PROJECT_DIR)/SimpleConfig/include/LibSimpleConfig",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.realtek.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
TARGETED_DEVICE_FAMILY = 1;
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
401776F8194EBBEE00961E62 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/SimpleConfig/include/LibSimpleConfig",
|
||||
"$(PROJECT_DIR)/SimpleConfig/include",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "SimpleConfig/SimpleConfig-Prefix.pch";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
);
|
||||
INFOPLIST_FILE = "SimpleConfig/SimpleConfig-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/SimpleConfig",
|
||||
"$(PROJECT_DIR)/SimpleConfig/include/ZBarSDK",
|
||||
"$(PROJECT_DIR)/SimpleConfig/include/LibSimpleConfig",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.realtek.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
TARGETED_DEVICE_FAMILY = 1;
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
401776FA194EBBEE00961E62 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SimpleConfig.app/SimpleConfig";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "SimpleConfig/SimpleConfig-Prefix.pch";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = "SimpleConfigTests/SimpleConfigTests-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.realtek.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
401776FB194EBBEE00961E62 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SimpleConfig.app/SimpleConfig";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "SimpleConfig/SimpleConfig-Prefix.pch";
|
||||
INFOPLIST_FILE = "SimpleConfigTests/SimpleConfigTests-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.realtek.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
401776BC194EBBEE00961E62 /* Build configuration list for PBXProject "SimpleConfig" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
401776F4194EBBEE00961E62 /* Debug */,
|
||||
401776F5194EBBEE00961E62 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
401776F6194EBBEE00961E62 /* Build configuration list for PBXNativeTarget "SimpleConfig" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
401776F7194EBBEE00961E62 /* Debug */,
|
||||
401776F8194EBBEE00961E62 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
401776F9194EBBEE00961E62 /* Build configuration list for PBXNativeTarget "SimpleConfigTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
401776FA194EBBEE00961E62 /* Debug */,
|
||||
401776FB194EBBEE00961E62 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 401776B9194EBBEE00961E62 /* Project object */;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:SimpleConfig.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776C0194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfig.app"
|
||||
BlueprintName = "SimpleConfig"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776E4194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfigTests.xctest"
|
||||
BlueprintName = "SimpleConfigTests"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776C0194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfig.app"
|
||||
BlueprintName = "SimpleConfig"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776C0194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfig.app"
|
||||
BlueprintName = "SimpleConfig"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776C0194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfig.app"
|
||||
BlueprintName = "SimpleConfig"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?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>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>SimpleConfig.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>401776C0194EBBEE00961E62</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>401776E4194EBBEE00961E62</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776C0194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfig.app"
|
||||
BlueprintName = "SimpleConfig"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776E4194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfigTests.xctest"
|
||||
BlueprintName = "SimpleConfigTests"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776C0194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfig.app"
|
||||
BlueprintName = "SimpleConfig"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776C0194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfig.app"
|
||||
BlueprintName = "SimpleConfig"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "401776C0194EBBEE00961E62"
|
||||
BuildableName = "SimpleConfig.app"
|
||||
BlueprintName = "SimpleConfig"
|
||||
ReferencedContainer = "container:SimpleConfig.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?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>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>SimpleConfig.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>401776C0194EBBEE00961E62</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>401776E4194EBBEE00961E62</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
tools/simple_config_wizard/iOS/SimpleConfigWizard_v109/SimpleConfig/.DS_Store
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13B42" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment defaultVersion="1792" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="RTKViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text=" Configured Device" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ed7-Zm-L9f">
|
||||
<rect key="frame" x="0.0" y="0.0" width="768" height="93"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" red="0.45098039220000002" green="0.45098039220000002" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="22"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" alpha="0.74999999999999978" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vby-oh-Ec7">
|
||||
<rect key="frame" x="674" y="20" width="74" height="73"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<inset key="contentEdgeInsets" minX="5" minY="5" maxX="5" maxY="5"/>
|
||||
<state key="normal" image="refresh.png" backgroundImage="imagebtn_bg.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="Discovery_btnClik:" destination="BYZ-38-t0r" eventType="touchUpInside" id="gPp-Xh-sUa"/>
|
||||
</connections>
|
||||
</button>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="9p0-ab-Cxv">
|
||||
<rect key="frame" x="0.0" y="92" width="768" height="844"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="BYZ-38-t0r" id="D2d-wq-HMg"/>
|
||||
<outlet property="delegate" destination="BYZ-38-t0r" id="fHd-da-S5C"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Cv-x3-LtZ">
|
||||
<rect key="frame" x="0.0" y="944" width="768" height="80"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="24"/>
|
||||
<state key="normal" title="Configure New Device">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="ConfigDevice_btnClik:" destination="BYZ-38-t0r" eventType="touchUpInside" id="AgE-25-G7v"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="tableDeviceList" destination="9p0-ab-Cxv" id="zgg-hr-boY"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-314" y="-546"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="imagebtn_bg.png" width="178" height="214"/>
|
||||
<image name="refresh.png" width="128" height="128"/>
|
||||
</resources>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar"/>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination"/>
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="vXZ-lx-hvc">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="ufC-wZ-h7g">
|
||||
<objects>
|
||||
<viewController id="vXZ-lx-hvc" customClass="RTKViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Configured Device" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="hBI-gx-Rgd">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="63"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" alpha="0.74999999999999978" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="agl-ZI-njk">
|
||||
<rect key="frame" x="280" y="25" width="35" height="35"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" red="0.45098039220000002" green="0.45098039220000002" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<state key="normal" title="Button" image="refresh.png" backgroundImage="imagebtn_bg.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="Discovery_btnClik:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="CBq-fP-aC3"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="Q0U-HQ-6EQ">
|
||||
<rect key="frame" x="0.0" y="523" width="320" height="45"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<state key="normal" title="Configure New Device">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="ConfigDevice_btnClik:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="pzr-nQ-U9n"/>
|
||||
</connections>
|
||||
</button>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="Ly9-mT-rMi">
|
||||
<rect key="frame" x="0.0" y="63" width="320" height="460"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="vXZ-lx-hvc" id="62S-aj-jwf"/>
|
||||
<outlet property="delegate" destination="vXZ-lx-hvc" id="DgZ-zE-sXF"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
</view>
|
||||
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
|
||||
<connections>
|
||||
<outlet property="tableDeviceList" destination="Ly9-mT-rMi" id="aMQ-YS-pD6"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="imagebtn_bg.png" width="178" height="214"/>
|
||||
<image name="refresh.png" width="128" height="128"/>
|
||||
</resources>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar"/>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination"/>
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
||||
|
After Width: | Height: | Size: 2 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "29_2_icon-1.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "29_3_icon-1.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "40_2_icon-1.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "40_3_icon-1.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "60_2_icon.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "60_3icon.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "29_1_icon.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "29_2_icon.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "40_1_icon.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "40_2_icon.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "76_1_icon.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "76_2_icon.png",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "7.0",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"extent" : "full-screen",
|
||||
"idiom" : "iphone",
|
||||
"subtype" : "retina4",
|
||||
"filename" : "Default-568h@2x.png",
|
||||
"minimum-system-version" : "7.0",
|
||||
"orientation" : "portrait",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "ipad",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "7.0",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"orientation" : "landscape",
|
||||
"idiom" : "ipad",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "7.0",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "ipad",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "7.0",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "landscape",
|
||||
"idiom" : "ipad",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "7.0",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// RTKAppDelegate.h
|
||||
// SimpleConfig
|
||||
//
|
||||
// Created by realtek on 6/16/14.
|
||||
// Copyright (c) 2014 Realtek. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#define USE_ORIGIN_VIEW_METHOD 0
|
||||
|
||||
@class RTKViewController;
|
||||
|
||||
@interface RTKAppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
@property (strong, nonatomic) RTKViewController *viewController;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
//
|
||||
// RTKAppDelegate.m
|
||||
// SimpleConfig
|
||||
//
|
||||
// Created by realtek on 6/16/14.
|
||||
// Copyright (c) 2014 Realtek. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RTKAppDelegate.h"
|
||||
#import "RTKViewController.h"
|
||||
|
||||
@implementation RTKAppDelegate
|
||||
|
||||
|
||||
|
||||
@synthesize window = _window;
|
||||
@synthesize viewController = _viewController;
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
// Override point for customization after application launch.
|
||||
|
||||
#if USE_ORIGIN_VIEW_METHOD
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
|
||||
self.viewController = [[RTKViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
|
||||
} else {
|
||||
self.viewController = [[RTKViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
|
||||
}
|
||||
self.window.rootViewController = self.viewController;
|
||||
[self.window makeKeyAndVisible];
|
||||
#endif
|
||||
|
||||
float sysVersion=[[UIDevice currentDevice]systemVersion].floatValue;
|
||||
if (sysVersion>=8.0) {
|
||||
UIUserNotificationType type=UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound;
|
||||
UIUserNotificationSettings *setting=[UIUserNotificationSettings settingsForTypes:type categories:nil];
|
||||
[[UIApplication sharedApplication]registerUserNotificationSettings:setting];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application
|
||||
{
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application
|
||||
{
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
|
||||
|
||||
NSLog(@"enter background!");
|
||||
|
||||
__block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
|
||||
[application endBackgroundTask:bgTask];
|
||||
bgTask = UIBackgroundTaskInvalid;
|
||||
}];
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
|
||||
// run something background
|
||||
while (YES) {
|
||||
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
|
||||
[NSThread sleepForTimeInterval:1.0f];
|
||||
}
|
||||
|
||||
// when finish, call this method
|
||||
[application endBackgroundTask:bgTask];
|
||||
bgTask = UIBackgroundTaskInvalid;
|
||||
});
|
||||
|
||||
[self.viewController.mySimpleConfig.pattern.udpSocket close];
|
||||
|
||||
NSLog(@"enter background! Done");
|
||||
//exit(0);
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application
|
||||
{
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
|
||||
NSError *err = nil;
|
||||
self.viewController.mySimpleConfig.pattern.udpSocket = [[AsyncUdpSocket alloc]initWithDelegate:self];
|
||||
[self.viewController.mySimpleConfig.pattern.udpSocket bindToPort:MCAST_PORT_NUM error:&err];
|
||||
[self.viewController.mySimpleConfig.pattern.udpSocket enableBroadcast:YES error:&err];
|
||||
|
||||
#if USE_AUTO_SSID
|
||||
NSDictionary *ifs = [self.viewController.mySimpleConfig.pattern fetchSSIDInfo];
|
||||
NSString *auto_ssid = [ifs objectForKey:@"SSID"];
|
||||
if (auto_ssid == nil) {
|
||||
auto_ssid = @"";
|
||||
}
|
||||
self.viewController.mySSID.text = auto_ssid;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||
{
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application
|
||||
{
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// RTKViewController.h
|
||||
// SimpleConfig
|
||||
//
|
||||
// Created by realtek on 6/16/14.
|
||||
// Copyright (c) 2014 Realtek. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "Reachability.h"
|
||||
|
||||
#include "SimpleConfig.h"
|
||||
#include "ZBarSDK.h"
|
||||
#define NEW_UI_Y_DELTA (120)
|
||||
#define ENABLE_QRCODE 1
|
||||
|
||||
#ifdef DEBUG
|
||||
#define NSLog(...) NSLog(__VA_ARGS__)
|
||||
#else
|
||||
#define NSLog(...) {}
|
||||
#endif
|
||||
|
||||
@interface RTKViewController : UIViewController <UIAlertViewDelegate, UITableViewDelegate, UITableViewDataSource, ZBarReaderDelegate>
|
||||
{
|
||||
int num ;
|
||||
BOOL upOrdown;
|
||||
}
|
||||
//----------- origin member variables -----------
|
||||
@property (nonatomic, strong) SimpleConfig *mySimpleConfig;
|
||||
@property (nonatomic, strong) UITextField *mySSID;
|
||||
@property (nonatomic, strong) UITextView *myAESKey;
|
||||
@property (nonatomic, strong) NSTimer *myTimer;
|
||||
@property (nonatomic, strong) NSString *myDevType;
|
||||
@property (nonatomic, strong) UIImageView *line;
|
||||
|
||||
|
||||
//----------- add member variables -----------
|
||||
- (void)checkForWIFIConnection;
|
||||
@property (strong, nonatomic) IBOutlet UIAlertView *waitingAlert;
|
||||
|
||||
//table controller
|
||||
@property (strong, nonatomic) IBOutlet UITableView *tableDeviceList;
|
||||
|
||||
//QR Code
|
||||
//@property (nonatomic, strong) NSString *m_pin_code;
|
||||
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
File: Reachability.h
|
||||
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
|
||||
Version: 3.5
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
||||
Software, with or without modifications, in source and/or binary forms;
|
||||
provided that if you redistribute the Apple Software in its entirety and
|
||||
without modifications, you must retain this notice and the following
|
||||
text and disclaimers in all such redistributions of the Apple Software.
|
||||
Neither the name, trademarks, service marks or logos of Apple Inc. may
|
||||
be used to endorse or promote products derived from the Apple Software
|
||||
without specific prior written permission from Apple. Except as
|
||||
expressly stated in this notice, no other rights or licenses, express or
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
||||
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
#import <netinet/in.h>
|
||||
|
||||
|
||||
typedef enum : NSInteger {
|
||||
NotReachable = 0,
|
||||
ReachableViaWiFi,
|
||||
ReachableViaWWAN
|
||||
} NetworkStatus;
|
||||
|
||||
|
||||
extern NSString *kReachabilityChangedNotification;
|
||||
|
||||
|
||||
@interface Reachability : NSObject
|
||||
|
||||
/*!
|
||||
* Use to check the reachability of a given host name.
|
||||
*/
|
||||
+ (instancetype)reachabilityWithHostName:(NSString *)hostName;
|
||||
|
||||
/*!
|
||||
* Use to check the reachability of a given IP address.
|
||||
*/
|
||||
+ (instancetype)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress;
|
||||
|
||||
/*!
|
||||
* Checks whether the default route is available. Should be used by applications that do not connect to a particular host.
|
||||
*/
|
||||
+ (instancetype)reachabilityForInternetConnection;
|
||||
|
||||
/*!
|
||||
* Checks whether a local WiFi connection is available.
|
||||
*/
|
||||
+ (instancetype)reachabilityForLocalWiFi;
|
||||
|
||||
/*!
|
||||
* Start listening for reachability notifications on the current run loop.
|
||||
*/
|
||||
- (BOOL)startNotifier;
|
||||
- (void)stopNotifier;
|
||||
|
||||
- (NetworkStatus)currentReachabilityStatus;
|
||||
|
||||
/*!
|
||||
* WWAN may be available, but not active until a connection has been established. WiFi may require a connection for VPN on Demand.
|
||||
*/
|
||||
- (BOOL)connectionRequired;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,312 @@
|
|||
/*
|
||||
File: Reachability.m
|
||||
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
|
||||
Version: 3.5
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
||||
Software, with or without modifications, in source and/or binary forms;
|
||||
provided that if you redistribute the Apple Software in its entirety and
|
||||
without modifications, you must retain this notice and the following
|
||||
text and disclaimers in all such redistributions of the Apple Software.
|
||||
Neither the name, trademarks, service marks or logos of Apple Inc. may
|
||||
be used to endorse or promote products derived from the Apple Software
|
||||
without specific prior written permission from Apple. Except as
|
||||
expressly stated in this notice, no other rights or licenses, express or
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
||||
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
*/
|
||||
|
||||
#import <arpa/inet.h>
|
||||
#import <ifaddrs.h>
|
||||
#import <netdb.h>
|
||||
#import <sys/socket.h>
|
||||
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#import "Reachability.h"
|
||||
|
||||
|
||||
NSString *kReachabilityChangedNotification = @"kNetworkReachabilityChangedNotification";
|
||||
|
||||
|
||||
#pragma mark - Supporting functions
|
||||
|
||||
#define kShouldPrintReachabilityFlags 1
|
||||
|
||||
static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment)
|
||||
{
|
||||
#if kShouldPrintReachabilityFlags
|
||||
/*
|
||||
NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
|
||||
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
|
||||
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
|
||||
|
||||
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
|
||||
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
|
||||
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
|
||||
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
|
||||
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
|
||||
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
|
||||
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-',
|
||||
comment
|
||||
);
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
|
||||
{
|
||||
#pragma unused (target, flags)
|
||||
NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
|
||||
NSCAssert([(__bridge NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
|
||||
|
||||
Reachability* noteObject = (__bridge Reachability *)info;
|
||||
// Post a notification to notify the client that the network reachability changed.
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Reachability implementation
|
||||
|
||||
@implementation Reachability
|
||||
{
|
||||
BOOL _alwaysReturnLocalWiFiStatus; //default is NO
|
||||
SCNetworkReachabilityRef _reachabilityRef;
|
||||
}
|
||||
|
||||
+ (instancetype)reachabilityWithHostName:(NSString *)hostName
|
||||
{
|
||||
Reachability* returnValue = NULL;
|
||||
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
|
||||
if (reachability != NULL)
|
||||
{
|
||||
returnValue= [[self alloc] init];
|
||||
if (returnValue != NULL)
|
||||
{
|
||||
returnValue->_reachabilityRef = reachability;
|
||||
returnValue->_alwaysReturnLocalWiFiStatus = NO;
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
+ (instancetype)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
|
||||
{
|
||||
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)hostAddress);
|
||||
|
||||
Reachability* returnValue = NULL;
|
||||
|
||||
if (reachability != NULL)
|
||||
{
|
||||
returnValue = [[self alloc] init];
|
||||
if (returnValue != NULL)
|
||||
{
|
||||
returnValue->_reachabilityRef = reachability;
|
||||
returnValue->_alwaysReturnLocalWiFiStatus = NO;
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+ (instancetype)reachabilityForInternetConnection
|
||||
{
|
||||
struct sockaddr_in zeroAddress;
|
||||
bzero(&zeroAddress, sizeof(zeroAddress));
|
||||
zeroAddress.sin_len = sizeof(zeroAddress);
|
||||
zeroAddress.sin_family = AF_INET;
|
||||
|
||||
return [self reachabilityWithAddress:&zeroAddress];
|
||||
}
|
||||
|
||||
|
||||
+ (instancetype)reachabilityForLocalWiFi
|
||||
{
|
||||
struct sockaddr_in localWifiAddress;
|
||||
bzero(&localWifiAddress, sizeof(localWifiAddress));
|
||||
localWifiAddress.sin_len = sizeof(localWifiAddress);
|
||||
localWifiAddress.sin_family = AF_INET;
|
||||
|
||||
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0.
|
||||
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
|
||||
|
||||
Reachability* returnValue = [self reachabilityWithAddress: &localWifiAddress];
|
||||
if (returnValue != NULL)
|
||||
{
|
||||
returnValue->_alwaysReturnLocalWiFiStatus = YES;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Start and stop notifier
|
||||
|
||||
- (BOOL)startNotifier
|
||||
{
|
||||
BOOL returnValue = NO;
|
||||
SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL};
|
||||
|
||||
if (SCNetworkReachabilitySetCallback(_reachabilityRef, ReachabilityCallback, &context))
|
||||
{
|
||||
if (SCNetworkReachabilityScheduleWithRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
|
||||
{
|
||||
returnValue = YES;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
- (void)stopNotifier
|
||||
{
|
||||
if (_reachabilityRef != NULL)
|
||||
{
|
||||
SCNetworkReachabilityUnscheduleFromRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self stopNotifier];
|
||||
if (_reachabilityRef != NULL)
|
||||
{
|
||||
CFRelease(_reachabilityRef);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Network Flag Handling
|
||||
|
||||
- (NetworkStatus)localWiFiStatusForFlags:(SCNetworkReachabilityFlags)flags
|
||||
{
|
||||
PrintReachabilityFlags(flags, "localWiFiStatusForFlags");
|
||||
NetworkStatus returnValue = NotReachable;
|
||||
|
||||
if ((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect))
|
||||
{
|
||||
returnValue = ReachableViaWiFi;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
- (NetworkStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags
|
||||
{
|
||||
PrintReachabilityFlags(flags, "networkStatusForFlags");
|
||||
if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
|
||||
{
|
||||
// The target host is not reachable.
|
||||
return NotReachable;
|
||||
}
|
||||
|
||||
NetworkStatus returnValue = NotReachable;
|
||||
|
||||
if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
|
||||
{
|
||||
/*
|
||||
If the target host is reachable and no connection is required then we'll assume (for now) that you're on Wi-Fi...
|
||||
*/
|
||||
returnValue = ReachableViaWiFi;
|
||||
}
|
||||
|
||||
if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
|
||||
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
|
||||
{
|
||||
/*
|
||||
... and the connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs...
|
||||
*/
|
||||
|
||||
if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
|
||||
{
|
||||
/*
|
||||
... and no [user] intervention is needed...
|
||||
*/
|
||||
returnValue = ReachableViaWiFi;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
|
||||
{
|
||||
/*
|
||||
... but WWAN connections are OK if the calling application is using the CFNetwork APIs.
|
||||
*/
|
||||
returnValue = ReachableViaWWAN;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)connectionRequired
|
||||
{
|
||||
NSAssert(_reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
|
||||
SCNetworkReachabilityFlags flags;
|
||||
|
||||
if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags))
|
||||
{
|
||||
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (NetworkStatus)currentReachabilityStatus
|
||||
{
|
||||
NSAssert(_reachabilityRef != NULL, @"currentNetworkStatus called with NULL SCNetworkReachabilityRef");
|
||||
NetworkStatus returnValue = NotReachable;
|
||||
SCNetworkReachabilityFlags flags;
|
||||
|
||||
if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags))
|
||||
{
|
||||
if (_alwaysReturnLocalWiFiStatus)
|
||||
{
|
||||
returnValue = [self localWiFiStatusForFlags:flags];
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = [self networkStatusForFlags:flags];
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?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>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</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>1.0.9.20160307</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.9.20160307</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main_iPhone</string>
|
||||
<key>UIMainStoryboardFile~ipad</key>
|
||||
<string>Main_iPad</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UIRequiresFullScreen</key>
|
||||
<true/>
|
||||
<key>UIRequiresPersistentWiFi</key>
|
||||
<true/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
<key>UIStatusBarHidden~ipad</key>
|
||||
<false/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/* Localized versions of Info.plist keys */
|
||||
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
BIN
tools/simple_config_wizard/iOS/SimpleConfigWizard_v109/SimpleConfig/image/.DS_Store
vendored
Normal file
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 3 KiB |
BIN
tools/simple_config_wizard/iOS/SimpleConfigWizard_v109/SimpleConfig/include/.DS_Store
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// LibSimpleConfig.h
|
||||
// LibSimpleConfig
|
||||
//
|
||||
// Created by pcbeta on 14-3-19.
|
||||
// Copyright (c) 2014年 realsil. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface LibSimpleConfig : NSObject
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,246 @@
|
|||
//
|
||||
// SimpleConfig.h
|
||||
// test3
|
||||
//
|
||||
// Created by patrick_cai on 12-1-2.
|
||||
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#import <CommonCrypto/CommonCryptor.h>
|
||||
#import <CommonCrypto/CommonHMAC.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <SystemConfiguration/CaptiveNetwork.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
#include <dlfcn.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#import <CocoaAsyncSocket/AsyncUdpSocket.h>
|
||||
|
||||
|
||||
#define USE_AUTO_SSID 1
|
||||
|
||||
#define SC_NAME_LEN (32)
|
||||
#define MCAST_ADDR_PREFIX (239)
|
||||
#define MCAST_PORT_NUM (18864)
|
||||
#define UNICAST_PORT_NUM (8864)
|
||||
#define LOCAL_PORT_NUM (8864)
|
||||
#define MAX_AES_KEY_BUF_LEN (32)
|
||||
#define MAX_PROFILE_BUF_LEN (256)
|
||||
#define MAX_PIN_LEN (64)
|
||||
#define MIN_PIN_LEN (8)
|
||||
|
||||
#define PATTERN_TWO_SYNC_PKT_NUM 9
|
||||
#define PATTERN_TWO_SEQ_IDX 3
|
||||
#define PATTERN_TWO_ID_IDX 5
|
||||
#define PATTERN_TWO_DATA_IDX 5
|
||||
#define PATTERN_TWO_RANDOM_IDX 5
|
||||
#define PATTERN_TWO_CKSUM_IDX 4
|
||||
#define PATTERN_TWO_MAGIC_IDX0 3
|
||||
#define PATTERN_TWO_MAGIC_IDX1 4
|
||||
#define PATTERN_TWO_MAGIC_IDX2 5
|
||||
#define PATTERN_TWO_MAGIC_IDX3 5
|
||||
#define PATTERN_TWO_SEND_TIME 10
|
||||
#define PATTERN_TWO_RECEIVE_TIMEOUT 120
|
||||
|
||||
#define BIT(x) (1<<(x))
|
||||
#define PATTERN_VALID BIT(1)
|
||||
#define PATTERN_HAS_END BIT(2)
|
||||
#define PATTERN_USING_UDP_SOCKET BIT(3)
|
||||
#define PATTERN_USING_PLAIN BIT(4)
|
||||
|
||||
#define TLV_T_BYTES (1)
|
||||
#define TLV_L_BYTES (1)
|
||||
#define TLV_T_L_BYTES (TLV_T_BYTES + TLV_L_BYTES)
|
||||
#define TAG_SSID 1
|
||||
#define TAG_PSW 2
|
||||
#define TAG_IP 3
|
||||
|
||||
#define SCAN_DATA_LEN (1+1+2+64+16+6+2)
|
||||
#define CONTROL_DATA_LEN (1+1+2+64+16+16)
|
||||
#define ACK_TO_CONTROL_DATA_LEN (1+1+2+64+16+16+1)
|
||||
|
||||
#define REQ_SCAN (0)
|
||||
#define REQ_DEL_PROFILE (BIT(1))
|
||||
#define REQ_RENAME_DEV (BIT(0) | BIT(1))
|
||||
#define REQ_ACK (BIT(2));
|
||||
|
||||
#define RSP_CONFIG (BIT(5))
|
||||
#define RSP_SCAN (BIT(5) | BIT(0))
|
||||
#define RSP_DEL_PROFILE (BIT(5) | BIT(1) | BIT(0))
|
||||
#define RSP_RENAME_DEV (BIT(5) | BIT(2))
|
||||
|
||||
#define BLKSIZE8 (8)
|
||||
#define BLKSIZE (16)
|
||||
#define AES_WRAP_TIME (6)
|
||||
|
||||
#define ENCRYPT_TEST 0
|
||||
typedef union _block{
|
||||
unsigned int x[BLKSIZE/4];
|
||||
unsigned char b[BLKSIZE];
|
||||
}block;
|
||||
|
||||
typedef struct _dev
|
||||
{
|
||||
__unsafe_unretained NSString *macAddress;
|
||||
unsigned char type[2];
|
||||
unsigned int ip;
|
||||
__unsafe_unretained NSString *dev_name;
|
||||
}dev_info;
|
||||
|
||||
typedef enum{
|
||||
PATTERN_ZERO= 0,
|
||||
PATTERN_ONE = 1,
|
||||
PATTERN_TWO = 2,
|
||||
PATTERN_THREE=3,
|
||||
}PATTERN_LIST;
|
||||
|
||||
typedef enum{
|
||||
SC_DELETE_PROFILE=1,
|
||||
SC_RENAME_DEV=2,
|
||||
}SC_CONTROL_TYPE;
|
||||
|
||||
@class ViewController;
|
||||
|
||||
@interface PatternFactory : AsyncUdpSocket {
|
||||
@public
|
||||
unsigned int m_index; //index number of Pattern
|
||||
unsigned int m_flag; //flag of this Pattern
|
||||
NSString *m_name; //name of Pattern
|
||||
|
||||
unsigned int m_key_len; //length of AES Key
|
||||
unsigned int m_crypt_len;//length of crypted profile
|
||||
unsigned int m_plain_len;//length of plain profile
|
||||
unsigned char m_aes_key_buf[MAX_AES_KEY_BUF_LEN]; //store Key for AES
|
||||
unsigned char m_crypt_buf[MAX_PROFILE_BUF_LEN]; //store crytped profile
|
||||
unsigned char m_plain_buf[MAX_PROFILE_BUF_LEN]; //store plain profile
|
||||
unsigned char m_scan_buf[MAX_PROFILE_BUF_LEN]; //store udp data for device discovery
|
||||
|
||||
unsigned char m_security_level;
|
||||
}
|
||||
|
||||
@property (nonatomic,strong) AsyncUdpSocket *udpSocket;
|
||||
@property (nonatomic,strong) AsyncUdpSocket *controlSocket;
|
||||
@property (nonatomic) unsigned int have_pin;
|
||||
@property (nonatomic,strong) NSString *m_pin;
|
||||
@property (nonatomic,strong) NSString *m_ssid;
|
||||
@property (nonatomic,strong) NSString *m_psw;
|
||||
@property (nonatomic) int send_times;
|
||||
@property (nonatomic,strong) NSMutableArray *ack_host;
|
||||
@property (nonatomic,strong) NSMutableArray *dev_connected_list;
|
||||
@property (atomic,strong) NSMutableArray *extend_ack_host;
|
||||
@property (nonatomic, strong) NSData *m_control_data;
|
||||
@property (nonatomic, strong) NSData *m_discover_data;
|
||||
@property (nonatomic, strong) NSString *default_pin;
|
||||
@property (nonatomic, strong) NSData *m_ack_data;
|
||||
@property (nonatomic, strong) NSString *m_control_pin;
|
||||
|
||||
- (id)init: (unsigned int)index flag:(unsigned int)flag name:(NSString *)name;
|
||||
- (void)dealloc;
|
||||
- (void)init_buffer;
|
||||
- (void)get_random_pattern_2;
|
||||
- (unsigned char)CKSUM:(unsigned char *)data len:(int)len;
|
||||
- (int)CKSUM_OK:(unsigned char *)data len:(int)len;
|
||||
//- (unsigned int)get_index;
|
||||
- (void)set_index: (unsigned int)index;
|
||||
- (NSString *)localIPAddress;
|
||||
#if USE_AUTO_SSID
|
||||
- (id)fetchSSIDInfo;
|
||||
#endif
|
||||
- (NSString *)getMACAddress: (char *)if_name;
|
||||
- (int)add_tlv_string: (unsigned int)offset tag:(unsigned char)tag len:(int)len value:(const char *)value;
|
||||
- (int)add_tlv_int: (unsigned int)offset tag:(unsigned char)tag value:(unsigned int)value;
|
||||
|
||||
- (void)get_len: (unsigned int *)plain_len key_len:(unsigned int*)key_len crypt_len:(unsigned int *)crypt_len;
|
||||
- (unsigned char *)get_plain_buf;
|
||||
- (unsigned char *)get_key_buf;
|
||||
- (unsigned char *)get_crypt_buf;
|
||||
- (int)encrypt_profile;
|
||||
|
||||
- (int)key_gen_pattern_2;
|
||||
|
||||
- (int)gen_scan_data: (NSString *)key;
|
||||
- (int)send_scan_data: (NSData *)data ip:(unsigned int)ip;
|
||||
- (NSData *)gen_control_data: (unsigned char)flag length: (unsigned int)length psw: (NSString *)psw dev_pin:(NSString *)dev_pin;
|
||||
//- (void)gen_save_profile_data: (NSString *)psw pin:(NSString *)pin;
|
||||
- (void)gen_delete_profile_data: (NSString *)psw pin:(NSString *)pin;
|
||||
- (void)gen_rename_dev_data: (NSString *)psw pin:(NSString *)pin name: (NSString *)name;
|
||||
- (int)send_control_data: (NSData *)data ip:(unsigned int)ip;
|
||||
- (NSData *)gen_ack_data;
|
||||
|
||||
// security level
|
||||
- (void) rtk_sc_set_security_level: (unsigned char)level;
|
||||
- (unsigned char) rtk_sc_get_security_level;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
@interface SimpleConfig : PatternFactory
|
||||
{
|
||||
@private
|
||||
unsigned int m_profile_total_len; //total profile length BEFORE encryption
|
||||
//NSString *m_control_pin;
|
||||
}
|
||||
@property (nonatomic, strong) PatternFactory *pattern;
|
||||
|
||||
/* Externel API for simple config */
|
||||
// init
|
||||
- (id)initWithPattern: (unsigned int)index flag:(unsigned int)flag name:(NSString *)name;
|
||||
- (void)dealloc;
|
||||
// simple config
|
||||
- (void)rtk_sc_set_pin: (NSString *)pin;
|
||||
- (void)rtk_sc_set_ssid: (NSString *)ssid;
|
||||
- (void)rtk_sc_set_password: (NSString *)psw;
|
||||
- (void)rtk_sc_set_ip: (unsigned int)ip;
|
||||
- (void)rtk_sc_gen_random;
|
||||
- (void)rtk_sc_build_profile;
|
||||
- (void)rtk_sc_send;
|
||||
- (void)rtk_sc_start;
|
||||
- (Boolean)rtk_sc_get_cfgACK_state;
|
||||
- (int) rtk_get_connected_sta_num;
|
||||
- (NSMutableArray *) rtk_get_connected_sta_mac;
|
||||
- (void)rtk_sc_stop;
|
||||
- (void)rtk_sc_exit;
|
||||
|
||||
- (void)rtk_sc_set_profileSendInterval:(unsigned int)msTime;
|
||||
- (void)rtk_sc_set_packetSendInterval:(unsigned int)msTime;
|
||||
- (void)rtk_sc_set_eachPacketCounts:(unsigned int)counts;
|
||||
|
||||
// device control
|
||||
- (void) rtk_sc_clear_device_list;
|
||||
- (NSData *)rtk_sc_gen_discover_packet;
|
||||
- (void) rtk_sc_send_discover_packet: (NSData *)data ip:(unsigned int)ip;
|
||||
- (NSMutableArray *)rtk_sc_get_discovered_devices;
|
||||
- (NSData *)rtk_sc_gen_control_packet: (unsigned int)control_type;
|
||||
- (void) rtk_sc_send_control_packet: (NSData *)data ip:(unsigned int)ip;
|
||||
- (NSData *)rtk_sc_gen_rename_dev_packet: (NSString *)dev_name;
|
||||
- (void) rtk_sc_send_rename_dev_packet: (NSData *)data ip:(unsigned int)ip;
|
||||
- (void) rtk_sc_set_control_pin: (NSString *)pin;
|
||||
- (void) rtk_sc_reset_control_pin;
|
||||
- (int) rtk_sc_get_control_result;
|
||||
- (void) rtk_sc_reset_control_result;
|
||||
|
||||
// default pin
|
||||
- (NSString *) rtk_sc_get_default_pin;
|
||||
- (void) rtk_sc_set_default_pin:(NSString *)pin;
|
||||
#if 0
|
||||
// ack to ack
|
||||
- (NSData *)rtk_sc_gen_ack_packets;
|
||||
- (void)rtk_sc_send_ack_packets: (NSData *)data ip:(unsigned int)ip;
|
||||
#endif
|
||||
@end
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2010-2011 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
@class ZBarReaderView;
|
||||
|
||||
// hack around missing simulator support for AVCapture interfaces
|
||||
|
||||
@interface ZBarCameraSimulator
|
||||
: NSObject
|
||||
< UINavigationControllerDelegate,
|
||||
UIImagePickerControllerDelegate,
|
||||
UIPopoverControllerDelegate >
|
||||
{
|
||||
UIViewController *viewController;
|
||||
ZBarReaderView *readerView;
|
||||
UIImagePickerController *picker;
|
||||
UIPopoverController *pickerPopover;
|
||||
}
|
||||
|
||||
- (id) initWithViewController: (UIViewController*) viewController;
|
||||
- (void) takePicture;
|
||||
|
||||
@property (nonatomic, assign) ZBarReaderView *readerView;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import "ZBarImageScanner.h"
|
||||
|
||||
@class AVCaptureVideoDataOutput, AVCaptureOutput;
|
||||
@class ZBarCaptureReader, ZBarCVImage;
|
||||
|
||||
@protocol ZBarCaptureDelegate <NSObject>
|
||||
|
||||
// called when a new barcode is detected. the image refers to the
|
||||
// video buffer and must not be retained for long
|
||||
- (void) captureReader: (ZBarCaptureReader*) captureReader
|
||||
didReadNewSymbolsFromImage: (ZBarImage*) image;
|
||||
|
||||
@optional
|
||||
// called when a potential/uncertain barcode is detected. will also
|
||||
// be called *after* captureReader:didReadNewSymbolsFromImage:
|
||||
// when good barcodes are detected
|
||||
- (void) captureReader: (ZBarCaptureReader*) captureReader
|
||||
didTrackSymbols: (ZBarSymbolSet*) symbols;
|
||||
|
||||
@end
|
||||
|
||||
@interface ZBarCaptureReader
|
||||
: NSObject
|
||||
{
|
||||
#if !TARGET_IPHONE_SIMULATOR
|
||||
AVCaptureVideoDataOutput *captureOutput;
|
||||
id<ZBarCaptureDelegate> captureDelegate;
|
||||
ZBarImageScanner *scanner;
|
||||
CGRect scanCrop;
|
||||
CGSize size;
|
||||
CGFloat framesPerSecond;
|
||||
BOOL enableCache;
|
||||
|
||||
dispatch_queue_t queue;
|
||||
ZBarImage *image;
|
||||
ZBarCVImage *result;
|
||||
volatile uint32_t state;
|
||||
int framecnt;
|
||||
unsigned width, height;
|
||||
uint64_t t_frame, t_fps, t_scan;
|
||||
CGFloat dt_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
// supply a pre-configured image scanner
|
||||
- (id) initWithImageScanner: (ZBarImageScanner*) imageScanner;
|
||||
|
||||
// this must be called before the session is started
|
||||
- (void) willStartRunning;
|
||||
|
||||
// this must be called *before* the session is stopped
|
||||
- (void) willStopRunning;
|
||||
|
||||
// clear the internal result cache
|
||||
- (void) flushCache;
|
||||
|
||||
// capture the next frame after processing. the captured image will
|
||||
// follow the same delegate path as an image with decoded symbols.
|
||||
- (void) captureFrame;
|
||||
|
||||
// the capture output. add this to an instance of AVCaptureSession
|
||||
@property (nonatomic, readonly) AVCaptureOutput *captureOutput;
|
||||
|
||||
// delegate is notified of decode results and symbol tracking.
|
||||
@property (nonatomic, assign) id<ZBarCaptureDelegate> captureDelegate;
|
||||
|
||||
// access to image scanner for configuration.
|
||||
@property (nonatomic, readonly) ZBarImageScanner *scanner;
|
||||
|
||||
// region of image to scan in normalized coordinates.
|
||||
// NB horizontal crop currently ignored...
|
||||
@property (nonatomic, assign) CGRect scanCrop;
|
||||
|
||||
// size of video frames.
|
||||
@property (nonatomic, readonly) CGSize size;
|
||||
|
||||
// (quickly) gate the reader function without interrupting the video
|
||||
// stream. also flushes the cache when enabled. defaults to *NO*
|
||||
@property (nonatomic) BOOL enableReader;
|
||||
|
||||
// current frame rate (for debug/optimization).
|
||||
// only valid when running
|
||||
@property (nonatomic, readonly) CGFloat framesPerSecond;
|
||||
|
||||
@property (nonatomic) BOOL enableCache;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2009-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@class ZBarHelpController;
|
||||
|
||||
@protocol ZBarHelpDelegate
|
||||
@optional
|
||||
|
||||
- (void) helpControllerDidFinish: (ZBarHelpController*) help;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// failure dialog w/a few useful tips
|
||||
|
||||
@interface ZBarHelpController : UIViewController
|
||||
< UIWebViewDelegate,
|
||||
UIAlertViewDelegate >
|
||||
{
|
||||
NSString *reason;
|
||||
id delegate;
|
||||
UIWebView *webView;
|
||||
UIToolbar *toolbar;
|
||||
UIBarButtonItem *doneBtn, *backBtn, *space;
|
||||
NSURL *linkURL;
|
||||
NSUInteger orientations;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) id<ZBarHelpDelegate> delegate;
|
||||
|
||||
// designated initializer
|
||||
- (id) initWithReason: (NSString*) reason;
|
||||
|
||||
- (BOOL) isInterfaceOrientationSupported: (UIInterfaceOrientation) orientation;
|
||||
- (void) setInterfaceOrientation: (UIInterfaceOrientation) orientation
|
||||
supported: (BOOL) supported;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2009 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "zbar.h"
|
||||
#import "ZBarSymbol.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
using namespace zbar;
|
||||
#endif
|
||||
|
||||
// Obj-C wrapper for ZBar image
|
||||
|
||||
@interface ZBarImage : NSObject
|
||||
{
|
||||
zbar_image_t *zimg;
|
||||
double t_convert;
|
||||
}
|
||||
|
||||
@property (nonatomic) unsigned long format;
|
||||
@property (nonatomic) unsigned sequence;
|
||||
@property (nonatomic) CGSize size;
|
||||
@property (nonatomic) CGRect crop;
|
||||
@property (readonly, nonatomic) const void *data;
|
||||
@property (readonly, nonatomic) unsigned long dataLength;
|
||||
@property (copy, nonatomic) ZBarSymbolSet *symbols;
|
||||
@property (readonly, nonatomic) zbar_image_t *zbarImage;
|
||||
@property (readonly, nonatomic) UIImage *UIImage;
|
||||
|
||||
- (id) initWithImage: (zbar_image_t*) image;
|
||||
- (id) initWithCGImage: (CGImageRef) image;
|
||||
- (id) initWithCGImage: (CGImageRef) image
|
||||
size: (CGSize) size;
|
||||
- (id) initWithCGImage: (CGImageRef) image
|
||||
crop: (CGRect) crop
|
||||
size: (CGSize) size;
|
||||
|
||||
- (void) setData: (const void*) data
|
||||
withLength: (unsigned long) length;
|
||||
- (UIImage*) UIImageWithOrientation: (UIImageOrientation) imageOrientation;
|
||||
- (void) cleanup;
|
||||
|
||||
+ (unsigned long) fourcc: (NSString*) format;
|
||||
|
||||
#if 0
|
||||
- convertToFormat: (unsigned long) format;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2009 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "zbar.h"
|
||||
#import "ZBarImage.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
using namespace zbar;
|
||||
#endif
|
||||
|
||||
// Obj-C wrapper for ZBar image scanner
|
||||
|
||||
@interface ZBarImageScanner : NSObject
|
||||
{
|
||||
zbar_image_scanner_t *scanner;
|
||||
}
|
||||
|
||||
@property (nonatomic) BOOL enableCache;
|
||||
@property (readonly, nonatomic) ZBarSymbolSet *results;
|
||||
|
||||
// decoder configuration
|
||||
- (void) parseConfig: (NSString*) configStr;
|
||||
- (void) setSymbology: (zbar_symbol_type_t) symbology
|
||||
config: (zbar_config_t) config
|
||||
to: (int) value;
|
||||
|
||||
// image scanning interface
|
||||
- (NSInteger) scanImage: (ZBarImage*) image;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2009-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ZBarImageScanner.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
using namespace zbar;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
// default interface provided by UIImagePickerController - user manually
|
||||
// captures an image by pressing a button
|
||||
ZBarReaderControllerCameraModeDefault = 0,
|
||||
|
||||
// automatically scan by taking screenshots with UIGetScreenImage().
|
||||
// resolution is limited by the screen, so this is inappropriate for
|
||||
// longer codes
|
||||
ZBarReaderControllerCameraModeSampling,
|
||||
|
||||
// automatically scan by rapidly taking pictures with takePicture.
|
||||
// tradeoff resolution with frame rate by adjusting the crop, and size
|
||||
// properties of the reader along with the density configs of the image
|
||||
// scanner
|
||||
ZBarReaderControllerCameraModeSequence,
|
||||
|
||||
} ZBarReaderControllerCameraMode;
|
||||
|
||||
|
||||
@class ZBarReaderController, ZBarHelpController;
|
||||
|
||||
@protocol ZBarReaderDelegate <UIImagePickerControllerDelegate>
|
||||
@optional
|
||||
|
||||
// called when no barcode is found in an image selected by the user.
|
||||
// if retry is NO, the delegate *must* dismiss the controller
|
||||
- (void) readerControllerDidFailToRead: (ZBarReaderController*) reader
|
||||
withRetry: (BOOL) retry;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface ZBarReaderController
|
||||
: UIImagePickerController
|
||||
< UINavigationControllerDelegate,
|
||||
UIImagePickerControllerDelegate >
|
||||
{
|
||||
ZBarImageScanner *scanner;
|
||||
ZBarHelpController *help;
|
||||
UIView *overlay, *boxView;
|
||||
CALayer *boxLayer;
|
||||
|
||||
UIToolbar *toolbar;
|
||||
UIBarButtonItem *cancelBtn, *scanBtn, *space[3];
|
||||
UIButton *infoBtn;
|
||||
|
||||
id <ZBarReaderDelegate> readerDelegate;
|
||||
BOOL showsZBarControls, showsHelpOnFail, takesPicture, enableCache;
|
||||
ZBarReaderControllerCameraMode cameraMode;
|
||||
CGRect scanCrop;
|
||||
NSInteger maxScanDimension;
|
||||
|
||||
BOOL hasOverlay, sampling;
|
||||
uint64_t t_frame;
|
||||
double dt_frame;
|
||||
|
||||
ZBarSymbol *symbol;
|
||||
}
|
||||
|
||||
// access to configure image scanner
|
||||
@property (readonly, nonatomic) ZBarImageScanner *scanner;
|
||||
|
||||
// barcode result recipient (NB don't use delegate)
|
||||
@property (nonatomic, assign) id <ZBarReaderDelegate> readerDelegate;
|
||||
|
||||
// whether to use alternate control set
|
||||
@property (nonatomic) BOOL showsZBarControls;
|
||||
|
||||
// whether to display helpful information when decoding fails
|
||||
@property (nonatomic) BOOL showsHelpOnFail;
|
||||
|
||||
// how to use the camera (when sourceType == Camera)
|
||||
@property (nonatomic) ZBarReaderControllerCameraMode cameraMode;
|
||||
|
||||
// whether to outline symbols with the green tracking box.
|
||||
@property (nonatomic) BOOL tracksSymbols;
|
||||
|
||||
// whether to automatically take a full picture when a barcode is detected
|
||||
// (when cameraMode == Sampling)
|
||||
@property (nonatomic) BOOL takesPicture;
|
||||
|
||||
// whether to use the "cache" for realtime modes (default YES). this can be
|
||||
// used to safely disable the inter-frame consistency and duplicate checks,
|
||||
// speeding up recognition, iff:
|
||||
// 1. the controller is dismissed when a barcode is read and
|
||||
// 2. unreliable symbologies are disabled (all EAN/UPC variants and I2/5)
|
||||
@property (nonatomic) BOOL enableCache;
|
||||
|
||||
// crop images for scanning. the original image will be cropped to this
|
||||
// rectangle before scanning. the rectangle is normalized to the image size
|
||||
// and aspect ratio; useful values will place the rectangle between 0 and 1
|
||||
// on each axis, where the x-axis corresponds to the image major axis.
|
||||
// defaults to the full image (0, 0, 1, 1).
|
||||
@property (nonatomic) CGRect scanCrop;
|
||||
|
||||
// scale image to scan. after cropping, the image will be scaled if
|
||||
// necessary, such that neither of its dimensions exceed this value.
|
||||
// defaults to 640.
|
||||
@property (nonatomic) NSInteger maxScanDimension;
|
||||
|
||||
// display the built-in help browser. for use with custom overlays if
|
||||
// you don't also want to create your own help view. only send this
|
||||
// message when the reader is displayed. the argument will be passed
|
||||
// to the onZBarHelp() javascript function.
|
||||
- (void) showHelpWithReason: (NSString*) reason;
|
||||
|
||||
// direct scanner interface - scan UIImage and return something enumerable
|
||||
- (id <NSFastEnumeration>) scanImage: (CGImageRef) image;
|
||||
|
||||
@end
|
||||
|
||||
extern NSString* const ZBarReaderControllerResults;
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ZBarImageScanner.h"
|
||||
|
||||
@class AVCaptureSession, AVCaptureDevice;
|
||||
@class CALayer;
|
||||
@class ZBarImageScanner, ZBarCaptureReader, ZBarReaderView;
|
||||
|
||||
// delegate is notified of decode results.
|
||||
|
||||
@protocol ZBarReaderViewDelegate < NSObject >
|
||||
|
||||
- (void) readerView: (ZBarReaderView*) readerView
|
||||
didReadSymbols: (ZBarSymbolSet*) symbols
|
||||
fromImage: (UIImage*) image;
|
||||
|
||||
@end
|
||||
|
||||
// read barcodes from the displayed video preview. the view maintains
|
||||
// a complete video capture session feeding a ZBarCaptureReader and
|
||||
// presents the associated preview with symbol tracking annotations.
|
||||
|
||||
@interface ZBarReaderView
|
||||
: UIView
|
||||
{
|
||||
id<ZBarReaderViewDelegate> readerDelegate;
|
||||
ZBarCaptureReader *captureReader;
|
||||
CGRect scanCrop, effectiveCrop;
|
||||
CGAffineTransform previewTransform;
|
||||
CGFloat zoom, zoom0, maxZoom;
|
||||
UIColor *trackingColor;
|
||||
BOOL tracksSymbols, showsFPS;
|
||||
NSInteger torchMode;
|
||||
UIInterfaceOrientation interfaceOrientation;
|
||||
NSTimeInterval animationDuration;
|
||||
|
||||
CALayer *preview, *overlay, *tracking, *cropLayer;
|
||||
UIView *fpsView;
|
||||
UILabel *fpsLabel;
|
||||
UIPinchGestureRecognizer *pinch;
|
||||
CGFloat imageScale;
|
||||
CGSize imageSize;
|
||||
BOOL started, running;
|
||||
}
|
||||
|
||||
// supply a pre-configured image scanner.
|
||||
- (id) initWithImageScanner: (ZBarImageScanner*) imageScanner;
|
||||
|
||||
// start the video stream and barcode reader.
|
||||
- (void) start;
|
||||
|
||||
// stop the video stream and barcode reader.
|
||||
- (void) stop;
|
||||
|
||||
// clear the internal result cache
|
||||
- (void) flushCache;
|
||||
|
||||
// compensate for device/camera/interface orientation
|
||||
- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) orient
|
||||
duration: (NSTimeInterval) duration;
|
||||
|
||||
// delegate is notified of decode results.
|
||||
@property (nonatomic, assign) id<ZBarReaderViewDelegate> readerDelegate;
|
||||
|
||||
// access to image scanner for configuration.
|
||||
@property (nonatomic, readonly) ZBarImageScanner *scanner;
|
||||
|
||||
// whether to display the tracking annotation for uncertain barcodes
|
||||
// (default YES).
|
||||
@property (nonatomic) BOOL tracksSymbols;
|
||||
|
||||
// color of the tracking box (default green)
|
||||
@property (nonatomic, retain) UIColor *trackingColor;
|
||||
|
||||
// enable pinch gesture recognition for zooming the preview/decode
|
||||
// (default YES).
|
||||
@property (nonatomic) BOOL allowsPinchZoom;
|
||||
|
||||
// torch mode to set automatically (default Auto).
|
||||
@property (nonatomic) NSInteger torchMode;
|
||||
|
||||
// whether to display the frame rate for debug/configuration
|
||||
// (default NO).
|
||||
@property (nonatomic) BOOL showsFPS;
|
||||
|
||||
// zoom scale factor applied to video preview *and* scanCrop.
|
||||
// also updated by pinch-zoom gesture. clipped to range [1,maxZoom],
|
||||
// defaults to 1.25
|
||||
@property (nonatomic) CGFloat zoom;
|
||||
- (void) setZoom: (CGFloat) zoom
|
||||
animated: (BOOL) animated;
|
||||
|
||||
// maximum settable zoom factor.
|
||||
@property (nonatomic) CGFloat maxZoom;
|
||||
|
||||
// the region of the image that will be scanned. normalized coordinates.
|
||||
@property (nonatomic) CGRect scanCrop;
|
||||
|
||||
// additional transform applied to video preview.
|
||||
// (NB *not* applied to scan crop)
|
||||
@property (nonatomic) CGAffineTransform previewTransform;
|
||||
|
||||
// specify an alternate capture device.
|
||||
@property (nonatomic, retain) AVCaptureDevice *device;
|
||||
|
||||
// direct access to the capture session. warranty void if opened...
|
||||
@property (nonatomic, readonly) AVCaptureSession *session;
|
||||
@property (nonatomic, readonly) ZBarCaptureReader *captureReader;
|
||||
|
||||
// this flag still works, but its use is deprecated
|
||||
@property (nonatomic) BOOL enableCache;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ZBarReaderController.h"
|
||||
|
||||
// orientation set support
|
||||
#define ZBarOrientationMask(orient) (1 << orient)
|
||||
#define ZBarOrientationMaskAll \
|
||||
(ZBarOrientationMask(UIInterfaceOrientationPortrait) | \
|
||||
ZBarOrientationMask(UIInterfaceOrientationPortraitUpsideDown) | \
|
||||
ZBarOrientationMask(UIInterfaceOrientationLandscapeLeft) | \
|
||||
ZBarOrientationMask(UIInterfaceOrientationLandscapeRight))
|
||||
|
||||
@class ZBarReaderView, ZBarCameraSimulator;
|
||||
|
||||
// drop in video scanning replacement for ZBarReaderController.
|
||||
// this is a thin controller around a ZBarReaderView that adds the UI
|
||||
// controls and select functionality offered by ZBarReaderController.
|
||||
// Automatically falls back to a ZBarReaderController if video APIs
|
||||
// are unavailable (eg for OS < 4.0)
|
||||
|
||||
@interface ZBarReaderViewController
|
||||
: UIViewController
|
||||
{
|
||||
ZBarImageScanner *scanner;
|
||||
id <ZBarReaderDelegate> readerDelegate;
|
||||
ZBarReaderView *readerView;
|
||||
UIView *cameraOverlayView;
|
||||
CGAffineTransform cameraViewTransform;
|
||||
CGRect scanCrop;
|
||||
NSUInteger supportedOrientationsMask;
|
||||
UIImagePickerControllerCameraDevice cameraDevice;
|
||||
UIImagePickerControllerCameraFlashMode cameraFlashMode;
|
||||
UIImagePickerControllerQualityType videoQuality;
|
||||
BOOL showsZBarControls, tracksSymbols, enableCache;
|
||||
|
||||
ZBarHelpController *helpController;
|
||||
UIView *controls;
|
||||
BOOL didHideStatusBar, rotating;
|
||||
ZBarCameraSimulator *cameraSim;
|
||||
}
|
||||
|
||||
// access to configure image scanner
|
||||
@property (nonatomic, readonly) ZBarImageScanner *scanner;
|
||||
|
||||
// barcode result recipient
|
||||
@property (nonatomic, assign) id <ZBarReaderDelegate> readerDelegate;
|
||||
|
||||
// whether to use alternate control set
|
||||
@property (nonatomic) BOOL showsZBarControls;
|
||||
|
||||
// whether to show the green tracking box. note that, even when
|
||||
// enabled, the box will only be visible when scanning EAN and I2/5.
|
||||
@property (nonatomic) BOOL tracksSymbols;
|
||||
|
||||
// interface orientation support. bit-mask of accepted orientations.
|
||||
// see eg ZBarOrientationMask() and ZBarOrientationMaskAll
|
||||
@property (nonatomic) NSUInteger supportedOrientationsMask;
|
||||
|
||||
// crop images for scanning. the image will be cropped to this
|
||||
// rectangle before scanning. the rectangle is normalized to the
|
||||
// image size and aspect ratio; useful values will place the rectangle
|
||||
// between 0 and 1 on each axis, where the x-axis corresponds to the
|
||||
// image major axis. defaults to the full image (0, 0, 1, 1).
|
||||
@property (nonatomic) CGRect scanCrop;
|
||||
|
||||
// provide a custom overlay. note that this can be used with
|
||||
// showsZBarControls enabled (but not if you want backward compatibility)
|
||||
@property (nonatomic, retain) UIView *cameraOverlayView;
|
||||
|
||||
// transform applied to the preview image.
|
||||
@property (nonatomic) CGAffineTransform cameraViewTransform;
|
||||
|
||||
// display the built-in help browser. the argument will be passed to
|
||||
// the onZBarHelp() javascript function.
|
||||
- (void) showHelpWithReason: (NSString*) reason;
|
||||
|
||||
// capture the next frame and send it over the usual delegate path.
|
||||
- (void) takePicture;
|
||||
|
||||
// these attempt to emulate UIImagePickerController
|
||||
+ (BOOL) isCameraDeviceAvailable: (UIImagePickerControllerCameraDevice) cameraDevice;
|
||||
+ (BOOL) isFlashAvailableForCameraDevice: (UIImagePickerControllerCameraDevice) cameraDevice;
|
||||
+ (NSArray*) availableCaptureModesForCameraDevice: (UIImagePickerControllerCameraDevice) cameraDevice;
|
||||
@property(nonatomic) UIImagePickerControllerCameraDevice cameraDevice;
|
||||
@property(nonatomic) UIImagePickerControllerCameraFlashMode cameraFlashMode;
|
||||
@property(nonatomic) UIImagePickerControllerCameraCaptureMode cameraCaptureMode;
|
||||
@property(nonatomic) UIImagePickerControllerQualityType videoQuality;
|
||||
|
||||
// direct access to the ZBarReaderView
|
||||
@property (nonatomic, readonly) ZBarReaderView *readerView;
|
||||
|
||||
// this flag still works, but its use is deprecated
|
||||
@property (nonatomic) BOOL enableCache;
|
||||
|
||||
// these are present only for backward compatibility.
|
||||
// they will error if inappropriate/unsupported values are set
|
||||
@property (nonatomic) UIImagePickerControllerSourceType sourceType; // Camera
|
||||
@property (nonatomic) BOOL allowsEditing; // NO
|
||||
@property (nonatomic) BOOL allowsImageEditing; // NO
|
||||
@property (nonatomic) BOOL showsCameraControls; // NO
|
||||
@property (nonatomic) BOOL showsHelpOnFail; // ignored
|
||||
@property (nonatomic) ZBarReaderControllerCameraMode cameraMode; // Sampling
|
||||
@property (nonatomic) BOOL takesPicture; // NO
|
||||
@property (nonatomic) NSInteger maxScanDimension; // ignored
|
||||
|
||||
+ (BOOL) isSourceTypeAvailable: (UIImagePickerControllerSourceType) sourceType;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*------------------------------------------------------------------------
|
||||
* Copyright 2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
*
|
||||
* This file is part of the ZBar Bar Code Reader.
|
||||
*
|
||||
* The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU Lesser Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser Public License
|
||||
* along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
* http://sourceforge.net/projects/zbar
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
#import "zbar.h"
|
||||
|
||||
#import "ZBarSymbol.h"
|
||||
#import "ZBarImage.h"
|
||||
#import "ZBarImageScanner.h"
|
||||
#import "ZBarReaderView.h"
|
||||
#import "ZBarReaderViewController.h"
|
||||
#import "ZBarReaderController.h"
|
||||
#import "ZBarCaptureReader.h"
|
||||
#import "ZBarHelpController.h"
|
||||
#import "ZBarCameraSimulator.h"
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2009-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import "zbar.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
using namespace zbar;
|
||||
#endif
|
||||
|
||||
// Obj-C wrapper for ZBar result types
|
||||
|
||||
@interface ZBarSymbolSet
|
||||
: NSObject <NSFastEnumeration>
|
||||
{
|
||||
const zbar_symbol_set_t *set;
|
||||
BOOL filterSymbols;
|
||||
}
|
||||
|
||||
@property (readonly, nonatomic) int count;
|
||||
@property (readonly, nonatomic) const zbar_symbol_set_t *zbarSymbolSet;
|
||||
@property (nonatomic) BOOL filterSymbols;
|
||||
|
||||
- (id) initWithSymbolSet: (const zbar_symbol_set_t*) set;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface ZBarSymbol : NSObject
|
||||
{
|
||||
const zbar_symbol_t *symbol;
|
||||
}
|
||||
|
||||
@property (readonly, nonatomic) zbar_symbol_type_t type;
|
||||
@property (readonly, nonatomic) NSString *typeName;
|
||||
@property (readonly, nonatomic) NSUInteger configMask;
|
||||
@property (readonly, nonatomic) NSUInteger modifierMask;
|
||||
@property (readonly, nonatomic) NSString *data;
|
||||
@property (readonly, nonatomic) int quality;
|
||||
@property (readonly, nonatomic) int count;
|
||||
@property (readonly, nonatomic) zbar_orientation_t orientation;
|
||||
@property (readonly, nonatomic) ZBarSymbolSet *components;
|
||||
@property (readonly, nonatomic) const zbar_symbol_t *zbarSymbol;
|
||||
@property (readonly, nonatomic) CGRect bounds;
|
||||
|
||||
- (id) initWithSymbol: (const zbar_symbol_t*) symbol;
|
||||
|
||||
+ (NSString*) nameForType: (zbar_symbol_type_t) type;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef _ZBAR_DECODER_H_
|
||||
#define _ZBAR_DECODER_H_
|
||||
|
||||
/// @file
|
||||
/// Decoder C++ wrapper
|
||||
|
||||
#ifndef _ZBAR_H_
|
||||
# error "include zbar.h in your application, **not** zbar/Decoder.h"
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace zbar {
|
||||
|
||||
/// low-level bar width stream decoder interface.
|
||||
/// identifies symbols and extracts encoded data
|
||||
|
||||
class Decoder {
|
||||
public:
|
||||
|
||||
/// Decoder result handler.
|
||||
/// applications should subtype this and pass an instance to
|
||||
/// set_handler() to implement result processing
|
||||
class Handler {
|
||||
public:
|
||||
virtual ~Handler() { }
|
||||
|
||||
/// invoked by the Decoder as decode results become available.
|
||||
virtual void decode_callback(Decoder &decoder) = 0;
|
||||
};
|
||||
|
||||
/// constructor.
|
||||
Decoder ()
|
||||
: _handler(NULL)
|
||||
{
|
||||
_decoder = zbar_decoder_create();
|
||||
}
|
||||
|
||||
~Decoder ()
|
||||
{
|
||||
zbar_decoder_destroy(_decoder);
|
||||
}
|
||||
|
||||
/// clear all decoder state.
|
||||
/// see zbar_decoder_reset()
|
||||
void reset ()
|
||||
{
|
||||
zbar_decoder_reset(_decoder);
|
||||
}
|
||||
|
||||
/// mark start of a new scan pass.
|
||||
/// see zbar_decoder_new_scan()
|
||||
void new_scan ()
|
||||
{
|
||||
zbar_decoder_new_scan(_decoder);
|
||||
}
|
||||
|
||||
/// process next bar/space width from input stream.
|
||||
/// see zbar_decode_width()
|
||||
zbar_symbol_type_t decode_width (unsigned width)
|
||||
{
|
||||
return(zbar_decode_width(_decoder, width));
|
||||
}
|
||||
|
||||
/// process next bar/space width from input stream.
|
||||
/// see zbar_decode_width()
|
||||
Decoder& operator<< (unsigned width)
|
||||
{
|
||||
zbar_decode_width(_decoder, width);
|
||||
return(*this);
|
||||
}
|
||||
|
||||
/// retrieve color of @em next element passed to Decoder.
|
||||
/// see zbar_decoder_get_color()
|
||||
zbar_color_t get_color () const
|
||||
{
|
||||
return(zbar_decoder_get_color(_decoder));
|
||||
}
|
||||
|
||||
/// retrieve last decoded symbol type.
|
||||
/// see zbar_decoder_get_type()
|
||||
zbar_symbol_type_t get_type () const
|
||||
{
|
||||
return(zbar_decoder_get_type(_decoder));
|
||||
}
|
||||
|
||||
/// retrieve string name of last decoded symbol type.
|
||||
/// see zbar_get_symbol_name()
|
||||
const char *get_symbol_name () const
|
||||
{
|
||||
return(zbar_get_symbol_name(zbar_decoder_get_type(_decoder)));
|
||||
}
|
||||
|
||||
/// retrieve string name for last decode addon.
|
||||
/// see zbar_get_addon_name()
|
||||
/// @deprecated in 0.11
|
||||
const char *get_addon_name () const
|
||||
{
|
||||
return(zbar_get_addon_name(zbar_decoder_get_type(_decoder)));
|
||||
}
|
||||
|
||||
/// retrieve last decoded data in ASCII format as a char array.
|
||||
/// see zbar_decoder_get_data()
|
||||
const char *get_data_chars() const
|
||||
{
|
||||
return(zbar_decoder_get_data(_decoder));
|
||||
}
|
||||
|
||||
/// retrieve last decoded data as a std::string.
|
||||
/// see zbar_decoder_get_data()
|
||||
const std::string get_data_string() const
|
||||
{
|
||||
return(std::string(zbar_decoder_get_data(_decoder),
|
||||
zbar_decoder_get_data_length(_decoder)));
|
||||
}
|
||||
|
||||
/// retrieve last decoded data as a std::string.
|
||||
/// see zbar_decoder_get_data()
|
||||
const std::string get_data() const
|
||||
{
|
||||
return(get_data_string());
|
||||
}
|
||||
|
||||
/// retrieve length of decoded binary data.
|
||||
/// see zbar_decoder_get_data_length()
|
||||
int get_data_length() const
|
||||
{
|
||||
return(zbar_decoder_get_data_length(_decoder));
|
||||
}
|
||||
|
||||
/// retrieve last decode direction.
|
||||
/// see zbar_decoder_get_direction()
|
||||
/// @since 0.11
|
||||
int get_direction() const
|
||||
{
|
||||
return(zbar_decoder_get_direction(_decoder));
|
||||
}
|
||||
|
||||
/// setup callback to handle result data.
|
||||
void set_handler (Handler &handler)
|
||||
{
|
||||
_handler = &handler;
|
||||
zbar_decoder_set_handler(_decoder, _cb);
|
||||
zbar_decoder_set_userdata(_decoder, this);
|
||||
}
|
||||
|
||||
/// set config for indicated symbology (0 for all) to specified value.
|
||||
/// @see zbar_decoder_set_config()
|
||||
/// @since 0.4
|
||||
int set_config (zbar_symbol_type_t symbology,
|
||||
zbar_config_t config,
|
||||
int value)
|
||||
{
|
||||
return(zbar_decoder_set_config(_decoder, symbology, config, value));
|
||||
}
|
||||
|
||||
/// set config parsed from configuration string.
|
||||
/// @see zbar_decoder_parse_config()
|
||||
/// @since 0.4
|
||||
int set_config (std::string cfgstr)
|
||||
{
|
||||
return(zbar_decoder_parse_config(_decoder, cfgstr.c_str()));
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Scanner;
|
||||
zbar_decoder_t *_decoder;
|
||||
Handler *_handler;
|
||||
|
||||
static void _cb (zbar_decoder_t *cdcode)
|
||||
{
|
||||
Decoder *dcode = (Decoder*)zbar_decoder_get_userdata(cdcode);
|
||||
if(dcode && dcode->_handler)
|
||||
dcode->_handler->decode_callback(*dcode);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef _ZBAR_EXCEPTION_H_
|
||||
#define _ZBAR_EXCEPTION_H_
|
||||
|
||||
/// @file
|
||||
/// C++ Exception definitions
|
||||
|
||||
#ifndef _ZBAR_H_
|
||||
# error "include zbar.h in your application, **not** zbar/Exception.h"
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
#include <new>
|
||||
|
||||
namespace zbar {
|
||||
|
||||
/// base class for exceptions defined by this API.
|
||||
class Exception : public std::exception {
|
||||
|
||||
public:
|
||||
/// create exception from C library error
|
||||
Exception (const void *obj = NULL)
|
||||
: std::exception(),
|
||||
_obj(obj)
|
||||
{ }
|
||||
|
||||
~Exception () throw() { }
|
||||
|
||||
/// retrieve error message
|
||||
virtual const char* what () const throw()
|
||||
{
|
||||
if(!_obj)
|
||||
return("zbar library unspecified generic error");
|
||||
return(_zbar_error_string(_obj, 0));
|
||||
}
|
||||
|
||||
private:
|
||||
const void *_obj;
|
||||
};
|
||||
|
||||
/// internal library error.
|
||||
class InternalError : public Exception {
|
||||
public:
|
||||
/// create exception from C library error
|
||||
InternalError (const void *obj)
|
||||
: Exception(obj)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// unsupported request.
|
||||
class UnsupportedError : public Exception {
|
||||
public:
|
||||
/// create exception from C library error
|
||||
UnsupportedError (const void *obj)
|
||||
: Exception(obj)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// invalid request.
|
||||
class InvalidError : public Exception {
|
||||
public:
|
||||
/// create exception from C library error
|
||||
InvalidError (const void *obj)
|
||||
: Exception(obj)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// failed system call.
|
||||
class SystemError : public Exception {
|
||||
public:
|
||||
/// create exception from C library error
|
||||
SystemError (const void *obj)
|
||||
: Exception(obj)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// locking error.
|
||||
class LockingError : public Exception {
|
||||
public:
|
||||
/// create exception from C library error
|
||||
LockingError (const void *obj)
|
||||
: Exception(obj)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// all resources busy.
|
||||
class BusyError : public Exception {
|
||||
public:
|
||||
/// create exception from C library error
|
||||
BusyError (const void *obj)
|
||||
: Exception(obj)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// X11 display error.
|
||||
class XDisplayError : public Exception {
|
||||
public:
|
||||
/// create exception from C library error
|
||||
XDisplayError (const void *obj)
|
||||
: Exception(obj)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// X11 protocol error.
|
||||
class XProtoError : public Exception {
|
||||
public:
|
||||
/// create exception from C library error
|
||||
XProtoError (const void *obj)
|
||||
: Exception(obj)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// output window is closed.
|
||||
class ClosedError : public Exception {
|
||||
public:
|
||||
/// create exception from C library error
|
||||
ClosedError (const void *obj)
|
||||
: Exception(obj)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// image format error
|
||||
class FormatError : public Exception {
|
||||
// FIXME needs c equivalent
|
||||
|
||||
virtual const char* what () const throw()
|
||||
{
|
||||
// FIXME what format?
|
||||
return("unsupported format");
|
||||
}
|
||||
};
|
||||
|
||||
/// @internal
|
||||
|
||||
/// extract error information and create exception.
|
||||
static inline std::exception throw_exception (const void *obj)
|
||||
{
|
||||
switch(_zbar_get_error_code(obj)) {
|
||||
case ZBAR_ERR_NOMEM:
|
||||
throw std::bad_alloc();
|
||||
case ZBAR_ERR_INTERNAL:
|
||||
throw InternalError(obj);
|
||||
case ZBAR_ERR_UNSUPPORTED:
|
||||
throw UnsupportedError(obj);
|
||||
case ZBAR_ERR_INVALID:
|
||||
throw InvalidError(obj);
|
||||
case ZBAR_ERR_SYSTEM:
|
||||
throw SystemError(obj);
|
||||
case ZBAR_ERR_LOCKING:
|
||||
throw LockingError(obj);
|
||||
case ZBAR_ERR_BUSY:
|
||||
throw BusyError(obj);
|
||||
case ZBAR_ERR_XDISPLAY:
|
||||
throw XDisplayError(obj);
|
||||
case ZBAR_ERR_XPROTO:
|
||||
throw XProtoError(obj);
|
||||
case ZBAR_ERR_CLOSED:
|
||||
throw ClosedError(obj);
|
||||
default:
|
||||
throw Exception(obj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,321 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef _ZBAR_IMAGE_H_
|
||||
#define _ZBAR_IMAGE_H_
|
||||
|
||||
/// @file
|
||||
/// Image C++ wrapper
|
||||
|
||||
#ifndef _ZBAR_H_
|
||||
# error "include zbar.h in your application, **not** zbar/Image.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <iterator>
|
||||
#include "Symbol.h"
|
||||
#include "Exception.h"
|
||||
|
||||
namespace zbar {
|
||||
|
||||
class Video;
|
||||
|
||||
/// stores image data samples along with associated format and size
|
||||
/// metadata
|
||||
|
||||
class Image {
|
||||
public:
|
||||
|
||||
/// general Image result handler.
|
||||
/// applications should subtype this and pass an instance to
|
||||
/// eg. ImageScanner::set_handler() to implement result processing
|
||||
class Handler {
|
||||
public:
|
||||
virtual ~Handler() { }
|
||||
|
||||
/// invoked by library when Image should be processed
|
||||
virtual void image_callback(Image &image) = 0;
|
||||
|
||||
/// cast this handler to the C handler
|
||||
operator zbar_image_data_handler_t* () const
|
||||
{
|
||||
return(_cb);
|
||||
}
|
||||
|
||||
private:
|
||||
static void _cb (zbar_image_t *zimg,
|
||||
const void *userdata)
|
||||
{
|
||||
if(userdata) {
|
||||
Image *image = (Image*)zbar_image_get_userdata(zimg);
|
||||
if(image)
|
||||
((Handler*)userdata)->image_callback(*image);
|
||||
else {
|
||||
Image tmp(zimg, 1);
|
||||
((Handler*)userdata)->image_callback(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class SymbolIterator : public zbar::SymbolIterator {
|
||||
public:
|
||||
/// default constructor.
|
||||
SymbolIterator ()
|
||||
: zbar::SymbolIterator()
|
||||
{ }
|
||||
|
||||
/// constructor.
|
||||
SymbolIterator (const SymbolSet &syms)
|
||||
: zbar::SymbolIterator(syms)
|
||||
{ }
|
||||
|
||||
/// copy constructor.
|
||||
SymbolIterator (const SymbolIterator& iter)
|
||||
: zbar::SymbolIterator(iter)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// constructor.
|
||||
/// create a new Image with the specified parameters
|
||||
Image (unsigned width = 0,
|
||||
unsigned height = 0,
|
||||
const std::string& format = "",
|
||||
const void *data = NULL,
|
||||
unsigned long length = 0)
|
||||
: _img(zbar_image_create())
|
||||
{
|
||||
zbar_image_set_userdata(_img, this);
|
||||
if(width && height)
|
||||
set_size(width, height);
|
||||
if(format.length())
|
||||
set_format(format);
|
||||
if(data && length)
|
||||
set_data(data, length);
|
||||
}
|
||||
|
||||
~Image ()
|
||||
{
|
||||
set_data(NULL, 0);
|
||||
zbar_image_set_userdata(_img, NULL);
|
||||
zbar_image_ref(_img, -1);
|
||||
}
|
||||
|
||||
/// cast to C image object
|
||||
operator const zbar_image_t* () const
|
||||
{
|
||||
return(_img);
|
||||
}
|
||||
|
||||
/// cast to C image object
|
||||
operator zbar_image_t* ()
|
||||
{
|
||||
return(_img);
|
||||
}
|
||||
|
||||
/// retrieve the image format.
|
||||
/// see zbar_image_get_format()
|
||||
unsigned long get_format () const
|
||||
{
|
||||
return(zbar_image_get_format(_img));
|
||||
}
|
||||
|
||||
/// specify the fourcc image format code for image sample data.
|
||||
/// see zbar_image_set_format()
|
||||
void set_format (unsigned long format)
|
||||
{
|
||||
zbar_image_set_format(_img, format);
|
||||
}
|
||||
|
||||
/// specify the fourcc image format code for image sample data.
|
||||
/// see zbar_image_set_format()
|
||||
void set_format (const std::string& format)
|
||||
{
|
||||
unsigned long fourcc = zbar_fourcc_parse(format.c_str());
|
||||
zbar_image_set_format(_img, fourcc);
|
||||
}
|
||||
|
||||
/// retrieve a "sequence" (page/frame) number associated with this
|
||||
/// image.
|
||||
/// see zbar_image_get_sequence()
|
||||
/// @since 0.6
|
||||
unsigned get_sequence () const
|
||||
{
|
||||
return(zbar_image_get_sequence(_img));
|
||||
}
|
||||
|
||||
/// associate a "sequence" (page/frame) number with this image.
|
||||
/// see zbar_image_set_sequence()
|
||||
/// @since 0.6
|
||||
void set_sequence (unsigned sequence_num)
|
||||
{
|
||||
zbar_image_set_sequence(_img, sequence_num);
|
||||
}
|
||||
|
||||
/// retrieve the width of the image.
|
||||
/// see zbar_image_get_width()
|
||||
unsigned get_width () const
|
||||
{
|
||||
return(zbar_image_get_width(_img));
|
||||
}
|
||||
|
||||
/// retrieve the height of the image.
|
||||
/// see zbar_image_get_height()
|
||||
unsigned get_height () const
|
||||
{
|
||||
return(zbar_image_get_height(_img));
|
||||
}
|
||||
|
||||
/// retrieve both dimensions of the image.
|
||||
/// see zbar_image_get_size()
|
||||
/// @since 0.11
|
||||
void get_size (unsigned &width,
|
||||
unsigned &height) const
|
||||
{
|
||||
zbar_image_get_size(_img, &width, &height);
|
||||
}
|
||||
|
||||
/// specify the pixel size of the image.
|
||||
/// see zbar_image_set_size()
|
||||
void set_size (unsigned width,
|
||||
unsigned height)
|
||||
{
|
||||
zbar_image_set_size(_img, width, height);
|
||||
}
|
||||
|
||||
/// retrieve the scan crop rectangle.
|
||||
/// see zbar_image_get_crop()
|
||||
void get_crop (unsigned &x,
|
||||
unsigned &y,
|
||||
unsigned &width,
|
||||
unsigned &height) const
|
||||
{
|
||||
zbar_image_get_crop(_img, &x, &y, &width, &height);
|
||||
}
|
||||
|
||||
/// set the scan crop rectangle.
|
||||
/// see zbar_image_set_crop()
|
||||
void set_crop (unsigned x,
|
||||
unsigned y,
|
||||
unsigned width,
|
||||
unsigned height)
|
||||
{
|
||||
zbar_image_set_crop(_img, x, y, width, height);
|
||||
}
|
||||
|
||||
/// return the image sample data.
|
||||
/// see zbar_image_get_data()
|
||||
const void *get_data () const
|
||||
{
|
||||
return(zbar_image_get_data(_img));
|
||||
}
|
||||
|
||||
/// return the size of the image sample data.
|
||||
/// see zbar_image_get_data_length()
|
||||
/// @since 0.6
|
||||
unsigned long get_data_length () const
|
||||
{
|
||||
return(zbar_image_get_data_length(_img));
|
||||
}
|
||||
|
||||
/// specify image sample data.
|
||||
/// see zbar_image_set_data()
|
||||
void set_data (const void *data,
|
||||
unsigned long length)
|
||||
{
|
||||
zbar_image_set_data(_img, data, length, _cleanup);
|
||||
}
|
||||
|
||||
/// image format conversion.
|
||||
/// see zbar_image_convert()
|
||||
Image convert (unsigned long format) const
|
||||
{
|
||||
zbar_image_t *img = zbar_image_convert(_img, format);
|
||||
if(img)
|
||||
return(Image(img));
|
||||
throw FormatError();
|
||||
}
|
||||
|
||||
/// image format conversion with crop/pad.
|
||||
/// see zbar_image_convert_resize()
|
||||
/// @since 0.4
|
||||
Image convert (unsigned long format,
|
||||
unsigned width,
|
||||
unsigned height) const
|
||||
{
|
||||
zbar_image_t *img =
|
||||
zbar_image_convert_resize(_img, format, width, height);
|
||||
if(img)
|
||||
return(Image(img));
|
||||
throw FormatError();
|
||||
}
|
||||
|
||||
const SymbolSet get_symbols () const {
|
||||
return(SymbolSet(zbar_image_get_symbols(_img)));
|
||||
}
|
||||
|
||||
void set_symbols (const SymbolSet &syms) {
|
||||
zbar_image_set_symbols(_img, syms);
|
||||
}
|
||||
|
||||
/// create a new SymbolIterator over decoded results.
|
||||
SymbolIterator symbol_begin () const {
|
||||
return(SymbolIterator(get_symbols()));
|
||||
}
|
||||
|
||||
/// return a SymbolIterator suitable for ending iteration.
|
||||
SymbolIterator symbol_end () const {
|
||||
return(SymbolIterator());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
friend class Video;
|
||||
|
||||
/// constructor.
|
||||
/// @internal
|
||||
/// create a new Image from a zbar_image_t C object
|
||||
Image (zbar_image_t *src,
|
||||
int refs = 0)
|
||||
: _img(src)
|
||||
{
|
||||
if(refs)
|
||||
zbar_image_ref(_img, refs);
|
||||
zbar_image_set_userdata(_img, this);
|
||||
}
|
||||
|
||||
/// default data cleanup (noop)
|
||||
/// @internal
|
||||
static void _cleanup (zbar_image_t *img)
|
||||
{
|
||||
// by default nothing is cleaned
|
||||
assert(img);
|
||||
assert(zbar_image_get_userdata(img));
|
||||
}
|
||||
|
||||
private:
|
||||
zbar_image_t *_img;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef _ZBAR_IMAGE_SCANNER_H_
|
||||
#define _ZBAR_IMAGE_SCANNER_H_
|
||||
|
||||
/// @file
|
||||
/// Image Scanner C++ wrapper
|
||||
|
||||
#ifndef _ZBAR_H_
|
||||
# error "include zbar.h in your application, **not** zbar/ImageScanner.h"
|
||||
#endif
|
||||
|
||||
#include "Image.h"
|
||||
|
||||
namespace zbar {
|
||||
|
||||
/// mid-level image scanner interface.
|
||||
/// reads barcodes from a 2-D Image
|
||||
|
||||
class ImageScanner {
|
||||
public:
|
||||
/// constructor.
|
||||
ImageScanner (zbar_image_scanner_t *scanner = NULL)
|
||||
{
|
||||
if(scanner)
|
||||
_scanner = scanner;
|
||||
else
|
||||
_scanner = zbar_image_scanner_create();
|
||||
}
|
||||
|
||||
~ImageScanner ()
|
||||
{
|
||||
zbar_image_scanner_destroy(_scanner);
|
||||
}
|
||||
|
||||
/// cast to C image_scanner object
|
||||
operator zbar_image_scanner_t* () const
|
||||
{
|
||||
return(_scanner);
|
||||
}
|
||||
|
||||
/// setup result handler callback.
|
||||
void set_handler (Image::Handler &handler)
|
||||
{
|
||||
zbar_image_scanner_set_data_handler(_scanner, handler, &handler);
|
||||
}
|
||||
|
||||
/// set config for indicated symbology (0 for all) to specified value.
|
||||
/// @see zbar_image_scanner_set_config()
|
||||
/// @since 0.4
|
||||
int set_config (zbar_symbol_type_t symbology,
|
||||
zbar_config_t config,
|
||||
int value)
|
||||
{
|
||||
return(zbar_image_scanner_set_config(_scanner, symbology,
|
||||
config, value));
|
||||
}
|
||||
|
||||
/// set config parsed from configuration string.
|
||||
/// @see zbar_image_scanner_parse_config()
|
||||
/// @since 0.4
|
||||
int set_config (std::string cfgstr)
|
||||
{
|
||||
return(zbar_image_scanner_parse_config(_scanner, cfgstr.c_str()));
|
||||
}
|
||||
|
||||
/// enable or disable the inter-image result cache.
|
||||
/// see zbar_image_scanner_enable_cache()
|
||||
void enable_cache (bool enable = true)
|
||||
{
|
||||
zbar_image_scanner_enable_cache(_scanner, enable);
|
||||
}
|
||||
|
||||
/// remove previous results from scanner and image.
|
||||
/// @see zbar_image_scanner_recycle_image()
|
||||
/// @since 0.10
|
||||
void recycle_image (Image &image)
|
||||
{
|
||||
zbar_image_scanner_recycle_image(_scanner, image);
|
||||
}
|
||||
|
||||
/// retrieve decode results for last scanned image.
|
||||
/// @see zbar_image_scanner_get_results()
|
||||
/// @since 0.10
|
||||
const SymbolSet get_results () const {
|
||||
return(SymbolSet(zbar_image_scanner_get_results(_scanner)));
|
||||
}
|
||||
|
||||
/// scan for symbols in provided image.
|
||||
/// see zbar_scan_image()
|
||||
int scan (Image& image)
|
||||
{
|
||||
return(zbar_scan_image(_scanner, image));
|
||||
}
|
||||
|
||||
/// scan for symbols in provided image.
|
||||
/// see zbar_scan_image()
|
||||
ImageScanner& operator<< (Image& image)
|
||||
{
|
||||
scan(image);
|
||||
return(*this);
|
||||
}
|
||||
|
||||
private:
|
||||
zbar_image_scanner_t *_scanner;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,223 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef _ZBAR_PROCESSOR_H_
|
||||
#define _ZBAR_PROCESSOR_H_
|
||||
|
||||
/// @file
|
||||
/// Processor C++ wrapper
|
||||
|
||||
#ifndef _ZBAR_H_
|
||||
# error "include zbar.h in your application, **not** zbar/Processor.h"
|
||||
#endif
|
||||
|
||||
#include "Exception.h"
|
||||
#include "Image.h"
|
||||
|
||||
namespace zbar {
|
||||
|
||||
/// high-level self-contained image processor.
|
||||
/// processes video and images for barcodes, optionally displaying
|
||||
/// images to a library owned output window
|
||||
|
||||
class Processor {
|
||||
public:
|
||||
/// value to pass for no timeout.
|
||||
static const int FOREVER = -1;
|
||||
|
||||
/// constructor.
|
||||
Processor (bool threaded = true,
|
||||
const char *video_device = "",
|
||||
bool enable_display = true)
|
||||
{
|
||||
_processor = zbar_processor_create(threaded);
|
||||
if(!_processor)
|
||||
throw std::bad_alloc();
|
||||
init(video_device, enable_display);
|
||||
}
|
||||
|
||||
~Processor ()
|
||||
{
|
||||
zbar_processor_destroy(_processor);
|
||||
}
|
||||
|
||||
/// cast to C processor object.
|
||||
operator zbar_processor_t* ()
|
||||
{
|
||||
return(_processor);
|
||||
}
|
||||
|
||||
/// opens a video input device and/or prepares to display output.
|
||||
/// see zbar_processor_init()
|
||||
void init (const char *video_device = "",
|
||||
bool enable_display = true)
|
||||
{
|
||||
if(zbar_processor_init(_processor, video_device, enable_display))
|
||||
throw_exception(_processor);
|
||||
}
|
||||
|
||||
/// setup result handler callback.
|
||||
/// see zbar_processor_set_data_handler()
|
||||
void set_handler (Image::Handler& handler)
|
||||
{
|
||||
zbar_processor_set_data_handler(_processor, handler, &handler);
|
||||
}
|
||||
|
||||
/// set config for indicated symbology (0 for all) to specified value.
|
||||
/// @see zbar_processor_set_config()
|
||||
/// @since 0.4
|
||||
int set_config (zbar_symbol_type_t symbology,
|
||||
zbar_config_t config,
|
||||
int value)
|
||||
{
|
||||
return(zbar_processor_set_config(_processor, symbology,
|
||||
config, value));
|
||||
}
|
||||
|
||||
/// set config parsed from configuration string.
|
||||
/// @see zbar_processor_parse_config()
|
||||
/// @since 0.4
|
||||
int set_config (std::string cfgstr)
|
||||
{
|
||||
return(zbar_processor_parse_config(_processor, cfgstr.c_str()));
|
||||
}
|
||||
|
||||
/// retrieve the current state of the ouput window.
|
||||
/// see zbar_processor_is_visible()
|
||||
bool is_visible ()
|
||||
{
|
||||
int rc = zbar_processor_is_visible(_processor);
|
||||
if(rc < 0)
|
||||
throw_exception(_processor);
|
||||
return(rc != 0);
|
||||
}
|
||||
|
||||
/// show or hide the display window owned by the library.
|
||||
/// see zbar_processor_set_visible()
|
||||
void set_visible (bool visible = true)
|
||||
{
|
||||
if(zbar_processor_set_visible(_processor, visible) < 0)
|
||||
throw_exception(_processor);
|
||||
}
|
||||
|
||||
/// control the processor in free running video mode.
|
||||
/// see zbar_processor_set_active()
|
||||
void set_active (bool active = true)
|
||||
{
|
||||
if(zbar_processor_set_active(_processor, active) < 0)
|
||||
throw_exception(_processor);
|
||||
}
|
||||
|
||||
/// retrieve decode results for last scanned image.
|
||||
/// @see zbar_processor_get_results()
|
||||
/// @since 0.10
|
||||
const SymbolSet get_results () const {
|
||||
return(SymbolSet(zbar_processor_get_results(_processor)));
|
||||
}
|
||||
|
||||
/// wait for input to the display window from the user.
|
||||
/// see zbar_processor_user_wait()
|
||||
int user_wait (int timeout = FOREVER)
|
||||
{
|
||||
int rc = zbar_processor_user_wait(_processor, timeout);
|
||||
if(rc < 0)
|
||||
throw_exception(_processor);
|
||||
return(rc);
|
||||
}
|
||||
|
||||
/// process from the video stream until a result is available.
|
||||
/// see zbar_process_one()
|
||||
void process_one (int timeout = FOREVER)
|
||||
{
|
||||
if(zbar_process_one(_processor, timeout) < 0)
|
||||
throw_exception(_processor);
|
||||
}
|
||||
|
||||
/// process the provided image for barcodes.
|
||||
/// see zbar_process_image()
|
||||
void process_image (Image& image)
|
||||
{
|
||||
if(zbar_process_image(_processor, image) < 0)
|
||||
throw_exception(_processor);
|
||||
}
|
||||
|
||||
/// process the provided image for barcodes.
|
||||
/// see zbar_process_image()
|
||||
Processor& operator<< (Image& image)
|
||||
{
|
||||
process_image(image);
|
||||
return(*this);
|
||||
}
|
||||
|
||||
/// force specific input and output formats for debug/testing.
|
||||
/// see zbar_processor_force_format()
|
||||
void force_format (unsigned long input_format,
|
||||
unsigned long output_format)
|
||||
{
|
||||
if(zbar_processor_force_format(_processor, input_format,
|
||||
output_format))
|
||||
throw_exception(_processor);
|
||||
}
|
||||
|
||||
/// force specific input and output formats for debug/testing.
|
||||
/// see zbar_processor_force_format()
|
||||
void force_format (std::string& input_format,
|
||||
std::string& output_format)
|
||||
{
|
||||
unsigned long ifourcc = zbar_fourcc_parse(input_format.c_str());
|
||||
unsigned long ofourcc = zbar_fourcc_parse(output_format.c_str());
|
||||
if(zbar_processor_force_format(_processor, ifourcc, ofourcc))
|
||||
throw_exception(_processor);
|
||||
}
|
||||
|
||||
/// request a preferred size for the video image from the device.
|
||||
/// see zbar_processor_request_size()
|
||||
/// @since 0.6
|
||||
void request_size (int width, int height)
|
||||
{
|
||||
zbar_processor_request_size(_processor, width, height);
|
||||
}
|
||||
|
||||
/// request a preferred driver interface version for debug/testing.
|
||||
/// see zbar_processor_request_interface()
|
||||
/// @since 0.6
|
||||
void request_interface (int version)
|
||||
{
|
||||
zbar_processor_request_interface(_processor, version);
|
||||
}
|
||||
|
||||
/// request a preferred I/O mode for debug/testing.
|
||||
/// see zbar_processor_request_iomode()
|
||||
/// @since 0.7
|
||||
void request_iomode (int iomode)
|
||||
{
|
||||
if(zbar_processor_request_iomode(_processor, iomode))
|
||||
throw_exception(_processor);
|
||||
}
|
||||
|
||||
private:
|
||||
zbar_processor_t *_processor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef _ZBAR_SCANNER_H_
|
||||
#define _ZBAR_SCANNER_H_
|
||||
|
||||
/// @file
|
||||
/// Scanner C++ wrapper
|
||||
|
||||
#ifndef _ZBAR_H_
|
||||
# error "include zbar.h in your application, **not** zbar/Scanner.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace zbar {
|
||||
|
||||
/// low-level linear intensity sample stream scanner interface.
|
||||
/// identifies "bar" edges and measures width between them.
|
||||
/// optionally passes to bar width Decoder
|
||||
|
||||
class Scanner {
|
||||
public:
|
||||
|
||||
/// constructor.
|
||||
/// @param decoder reference to a Decoder instance which will
|
||||
/// be passed scan results automatically
|
||||
Scanner (Decoder& decoder)
|
||||
{
|
||||
_scanner = zbar_scanner_create(decoder._decoder);
|
||||
}
|
||||
|
||||
/// constructor.
|
||||
/// @param decoder pointer to a Decoder instance which will
|
||||
/// be passed scan results automatically
|
||||
Scanner (Decoder* decoder = NULL)
|
||||
{
|
||||
zbar_decoder_t *zdcode = NULL;
|
||||
if(decoder)
|
||||
zdcode = decoder->_decoder;
|
||||
_scanner = zbar_scanner_create(zdcode);
|
||||
}
|
||||
|
||||
~Scanner ()
|
||||
{
|
||||
zbar_scanner_destroy(_scanner);
|
||||
}
|
||||
|
||||
/// clear all scanner state.
|
||||
/// see zbar_scanner_reset()
|
||||
void reset ()
|
||||
{
|
||||
zbar_scanner_reset(_scanner);
|
||||
}
|
||||
|
||||
/// mark start of a new scan pass.
|
||||
/// see zbar_scanner_new_scan()
|
||||
zbar_symbol_type_t new_scan ()
|
||||
{
|
||||
_type = zbar_scanner_new_scan(_scanner);
|
||||
return(_type);
|
||||
}
|
||||
|
||||
/// flush scanner pipeline.
|
||||
/// see zbar_scanner_flush()
|
||||
zbar_symbol_type_t flush ()
|
||||
{
|
||||
_type = zbar_scanner_flush(_scanner);
|
||||
return(_type);
|
||||
}
|
||||
|
||||
/// process next sample intensity value.
|
||||
/// see zbar_scan_y()
|
||||
zbar_symbol_type_t scan_y (int y)
|
||||
{
|
||||
_type = zbar_scan_y(_scanner, y);
|
||||
return(_type);
|
||||
}
|
||||
|
||||
/// process next sample intensity value.
|
||||
/// see zbar_scan_y()
|
||||
Scanner& operator<< (int y)
|
||||
{
|
||||
_type = zbar_scan_y(_scanner, y);
|
||||
return(*this);
|
||||
}
|
||||
|
||||
/// process next sample from RGB (or BGR) triple.
|
||||
/// see zbar_scan_rgb24()
|
||||
zbar_symbol_type_t scan_rgb24 (unsigned char *rgb)
|
||||
{
|
||||
_type = zbar_scan_rgb24(_scanner, rgb);
|
||||
return(_type);
|
||||
}
|
||||
|
||||
/// process next sample from RGB (or BGR) triple.
|
||||
/// see zbar_scan_rgb24()
|
||||
Scanner& operator<< (unsigned char *rgb)
|
||||
{
|
||||
_type = zbar_scan_rgb24(_scanner, rgb);
|
||||
return(*this);
|
||||
}
|
||||
|
||||
/// retrieve last scanned width.
|
||||
/// see zbar_scanner_get_width()
|
||||
unsigned get_width () const
|
||||
{
|
||||
return(zbar_scanner_get_width(_scanner));
|
||||
}
|
||||
|
||||
/// retrieve last scanned color.
|
||||
/// see zbar_scanner_get_color()
|
||||
zbar_color_t get_color () const
|
||||
{
|
||||
return(zbar_scanner_get_color(_scanner));
|
||||
}
|
||||
|
||||
/// retrieve last scan result.
|
||||
zbar_symbol_type_t get_type () const
|
||||
{
|
||||
return(_type);
|
||||
}
|
||||
|
||||
/// cast to C scanner
|
||||
operator zbar_scanner_t* () const
|
||||
{
|
||||
return(_scanner);
|
||||
}
|
||||
|
||||
/// retrieve C scanner
|
||||
const zbar_scanner_t *get_c_scanner () const
|
||||
{
|
||||
return(_scanner);
|
||||
}
|
||||
|
||||
private:
|
||||
zbar_scanner_t *_scanner;
|
||||
zbar_symbol_type_t _type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,528 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef _ZBAR_SYMBOL_H_
|
||||
#define _ZBAR_SYMBOL_H_
|
||||
|
||||
/// @file
|
||||
/// Symbol C++ wrapper
|
||||
|
||||
#ifndef _ZBAR_H_
|
||||
# error "include zbar.h in your application, **not** zbar/Symbol.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <assert.h>
|
||||
|
||||
namespace zbar {
|
||||
|
||||
class SymbolIterator;
|
||||
|
||||
/// container for decoded result symbols associated with an image
|
||||
/// or a composite symbol.
|
||||
|
||||
class SymbolSet {
|
||||
public:
|
||||
/// constructor.
|
||||
SymbolSet (const zbar_symbol_set_t *syms = NULL)
|
||||
: _syms(syms)
|
||||
{
|
||||
ref();
|
||||
}
|
||||
|
||||
/// copy constructor.
|
||||
SymbolSet (const SymbolSet& syms)
|
||||
: _syms(syms._syms)
|
||||
{
|
||||
ref();
|
||||
}
|
||||
|
||||
/// destructor.
|
||||
~SymbolSet ()
|
||||
{
|
||||
ref(-1);
|
||||
}
|
||||
|
||||
/// assignment.
|
||||
SymbolSet& operator= (const SymbolSet& syms)
|
||||
{
|
||||
syms.ref();
|
||||
ref(-1);
|
||||
_syms = syms._syms;
|
||||
return(*this);
|
||||
}
|
||||
|
||||
/// truth testing.
|
||||
bool operator! () const
|
||||
{
|
||||
return(!_syms || !get_size());
|
||||
}
|
||||
|
||||
/// manipulate reference count.
|
||||
void ref (int delta = 1) const
|
||||
{
|
||||
if(_syms)
|
||||
zbar_symbol_set_ref((zbar_symbol_set_t*)_syms, delta);
|
||||
}
|
||||
|
||||
/// cast to C symbol set.
|
||||
operator const zbar_symbol_set_t* () const
|
||||
{
|
||||
return(_syms);
|
||||
}
|
||||
|
||||
int get_size () const
|
||||
{
|
||||
return((_syms) ? zbar_symbol_set_get_size(_syms) : 0);
|
||||
}
|
||||
|
||||
/// create a new SymbolIterator over decoded results.
|
||||
SymbolIterator symbol_begin() const;
|
||||
|
||||
/// return a SymbolIterator suitable for ending iteration.
|
||||
const SymbolIterator symbol_end() const;
|
||||
|
||||
private:
|
||||
const zbar_symbol_set_t *_syms;
|
||||
};
|
||||
|
||||
/// decoded barcode symbol result object. stores type, data, and
|
||||
/// image location of decoded symbol
|
||||
|
||||
class Symbol {
|
||||
public:
|
||||
|
||||
/// image pixel location (x, y) coordinate tuple.
|
||||
class Point {
|
||||
public:
|
||||
int x; ///< x-coordinate.
|
||||
int y; ///< y-coordinate.
|
||||
|
||||
Point () { }
|
||||
|
||||
Point(int x, int y)
|
||||
: x(x), y(y)
|
||||
{ }
|
||||
|
||||
/// copy constructor.
|
||||
Point (const Point& pt)
|
||||
: x(pt.x),
|
||||
y(pt.y)
|
||||
{ }
|
||||
|
||||
/// assignment.
|
||||
Point& operator= (const Point& pt)
|
||||
{
|
||||
x = pt.x;
|
||||
y = pt.y;
|
||||
return(*this);
|
||||
}
|
||||
};
|
||||
|
||||
/// iteration over Point objects in a symbol location polygon.
|
||||
class PointIterator
|
||||
: public std::iterator<std::input_iterator_tag, Point> {
|
||||
|
||||
public:
|
||||
/// constructor.
|
||||
PointIterator (const Symbol *sym = NULL,
|
||||
int index = 0)
|
||||
: _sym(sym),
|
||||
_index(index)
|
||||
{
|
||||
sym->ref(1);
|
||||
if(!sym ||
|
||||
(unsigned)_index >= zbar_symbol_get_loc_size(*_sym))
|
||||
_index = -1;
|
||||
}
|
||||
|
||||
/// copy constructor.
|
||||
PointIterator (const PointIterator& iter)
|
||||
: _sym(iter._sym),
|
||||
_index(iter._index)
|
||||
{
|
||||
_sym->ref();
|
||||
}
|
||||
|
||||
/// destructor.
|
||||
~PointIterator ()
|
||||
{
|
||||
_sym->ref(-1);
|
||||
}
|
||||
|
||||
/// assignment.
|
||||
PointIterator& operator= (const PointIterator& iter)
|
||||
{
|
||||
iter._sym->ref();
|
||||
_sym->ref(-1);
|
||||
_sym = iter._sym;
|
||||
_index = iter._index;
|
||||
return(*this);
|
||||
}
|
||||
|
||||
/// truth testing.
|
||||
bool operator! () const
|
||||
{
|
||||
return(!_sym || _index < 0);
|
||||
}
|
||||
|
||||
/// advance iterator to next Point.
|
||||
PointIterator& operator++ ()
|
||||
{
|
||||
unsigned int i = ++_index;
|
||||
if(i >= zbar_symbol_get_loc_size(*_sym))
|
||||
_index = -1;
|
||||
return(*this);
|
||||
}
|
||||
|
||||
/// retrieve currently referenced Point.
|
||||
const Point operator* () const
|
||||
{
|
||||
assert(!!*this);
|
||||
if(!*this)
|
||||
return(Point());
|
||||
return(Point(zbar_symbol_get_loc_x(*_sym, _index),
|
||||
zbar_symbol_get_loc_y(*_sym, _index)));
|
||||
}
|
||||
|
||||
/// test if two iterators refer to the same Point in the same
|
||||
/// Symbol.
|
||||
bool operator== (const PointIterator& iter) const
|
||||
{
|
||||
return(_index == iter._index &&
|
||||
((_index < 0) || _sym == iter._sym));
|
||||
}
|
||||
|
||||
/// test if two iterators refer to the same Point in the same
|
||||
/// Symbol.
|
||||
bool operator!= (const PointIterator& iter) const
|
||||
{
|
||||
return(!(*this == iter));
|
||||
}
|
||||
|
||||
private:
|
||||
const Symbol *_sym;
|
||||
int _index;
|
||||
};
|
||||
|
||||
/// constructor.
|
||||
Symbol (const zbar_symbol_t *sym = NULL)
|
||||
: _xmlbuf(NULL),
|
||||
_xmllen(0)
|
||||
{
|
||||
init(sym);
|
||||
ref();
|
||||
}
|
||||
|
||||
/// copy constructor.
|
||||
Symbol (const Symbol& sym)
|
||||
: _sym(sym._sym),
|
||||
_type(sym._type),
|
||||
_data(sym._data),
|
||||
_xmlbuf(NULL),
|
||||
_xmllen(0)
|
||||
{
|
||||
ref();
|
||||
}
|
||||
|
||||
/// destructor.
|
||||
~Symbol () {
|
||||
if(_xmlbuf)
|
||||
free(_xmlbuf);
|
||||
ref(-1);
|
||||
}
|
||||
|
||||
/// assignment.
|
||||
Symbol& operator= (const Symbol& sym)
|
||||
{
|
||||
sym.ref(1);
|
||||
ref(-1);
|
||||
_sym = sym._sym;
|
||||
_type = sym._type;
|
||||
_data = sym._data;
|
||||
return(*this);
|
||||
}
|
||||
|
||||
Symbol& operator= (const zbar_symbol_t *sym)
|
||||
{
|
||||
if(sym)
|
||||
zbar_symbol_ref(sym, 1);
|
||||
ref(-1);
|
||||
init(sym);
|
||||
return(*this);
|
||||
}
|
||||
|
||||
/// truth testing.
|
||||
bool operator! () const
|
||||
{
|
||||
return(!_sym);
|
||||
}
|
||||
|
||||
void ref (int delta = 1) const
|
||||
{
|
||||
if(_sym)
|
||||
zbar_symbol_ref((zbar_symbol_t*)_sym, delta);
|
||||
}
|
||||
|
||||
/// cast to C symbol.
|
||||
operator const zbar_symbol_t* () const
|
||||
{
|
||||
return(_sym);
|
||||
}
|
||||
|
||||
/// test if two Symbol objects refer to the same C symbol.
|
||||
bool operator== (const Symbol& sym) const
|
||||
{
|
||||
return(_sym == sym._sym);
|
||||
}
|
||||
|
||||
/// test if two Symbol objects refer to the same C symbol.
|
||||
bool operator!= (const Symbol& sym) const
|
||||
{
|
||||
return(!(*this == sym));
|
||||
}
|
||||
|
||||
/// retrieve type of decoded symbol.
|
||||
zbar_symbol_type_t get_type () const
|
||||
{
|
||||
return(_type);
|
||||
}
|
||||
|
||||
/// retrieve the string name of the symbol type.
|
||||
const std::string get_type_name () const
|
||||
{
|
||||
return(zbar_get_symbol_name(_type));
|
||||
}
|
||||
|
||||
/// retrieve the string name for any addon.
|
||||
/// @deprecated in 0.11
|
||||
const std::string get_addon_name () const
|
||||
{
|
||||
return(zbar_get_addon_name(_type));
|
||||
}
|
||||
|
||||
/// retrieve data decoded from symbol.
|
||||
const std::string get_data () const
|
||||
{
|
||||
return(_data);
|
||||
}
|
||||
|
||||
/// retrieve length of binary data
|
||||
unsigned get_data_length () const
|
||||
{
|
||||
return((_sym) ? zbar_symbol_get_data_length(_sym) : 0);
|
||||
}
|
||||
|
||||
/// retrieve inter-frame coherency count.
|
||||
/// see zbar_symbol_get_count()
|
||||
/// @since 1.5
|
||||
int get_count () const
|
||||
{
|
||||
return((_sym) ? zbar_symbol_get_count(_sym) : -1);
|
||||
}
|
||||
|
||||
SymbolSet get_components () const
|
||||
{
|
||||
return(SymbolSet((_sym) ? zbar_symbol_get_components(_sym) : NULL));
|
||||
}
|
||||
|
||||
/// create a new PointIterator at the start of the location
|
||||
/// polygon.
|
||||
PointIterator point_begin() const
|
||||
{
|
||||
return(PointIterator(this));
|
||||
}
|
||||
|
||||
/// return a PointIterator suitable for ending iteration.
|
||||
const PointIterator point_end() const
|
||||
{
|
||||
return(PointIterator());
|
||||
}
|
||||
|
||||
/// see zbar_symbol_get_loc_size().
|
||||
int get_location_size () const
|
||||
{
|
||||
return((_sym) ? zbar_symbol_get_loc_size(_sym) : 0);
|
||||
}
|
||||
|
||||
/// see zbar_symbol_get_loc_x().
|
||||
int get_location_x (unsigned index) const
|
||||
{
|
||||
return((_sym) ? zbar_symbol_get_loc_x(_sym, index) : -1);
|
||||
}
|
||||
|
||||
/// see zbar_symbol_get_loc_y().
|
||||
int get_location_y (unsigned index) const
|
||||
{
|
||||
return((_sym) ? zbar_symbol_get_loc_y(_sym, index) : -1);
|
||||
}
|
||||
|
||||
/// see zbar_symbol_get_orientation().
|
||||
/// @since 0.11
|
||||
int get_orientation () const
|
||||
{
|
||||
return(zbar_symbol_get_orientation(_sym));
|
||||
}
|
||||
|
||||
/// see zbar_symbol_xml().
|
||||
const std::string xml () const
|
||||
{
|
||||
if(!_sym)
|
||||
return("");
|
||||
return(zbar_symbol_xml(_sym, (char**)&_xmlbuf, (unsigned*)&_xmllen));
|
||||
}
|
||||
|
||||
protected:
|
||||
/// (re)initialize Symbol from C symbol object.
|
||||
void init (const zbar_symbol_t *sym = NULL)
|
||||
{
|
||||
_sym = sym;
|
||||
if(sym) {
|
||||
_type = zbar_symbol_get_type(sym);
|
||||
_data = std::string(zbar_symbol_get_data(sym),
|
||||
zbar_symbol_get_data_length(sym));
|
||||
}
|
||||
else {
|
||||
_type = ZBAR_NONE;
|
||||
_data = "";
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const zbar_symbol_t *_sym;
|
||||
zbar_symbol_type_t _type;
|
||||
std::string _data;
|
||||
char *_xmlbuf;
|
||||
unsigned _xmllen;
|
||||
};
|
||||
|
||||
/// iteration over Symbol result objects in a scanned Image or SymbolSet.
|
||||
class SymbolIterator
|
||||
: public std::iterator<std::input_iterator_tag, Symbol> {
|
||||
|
||||
public:
|
||||
/// default constructor.
|
||||
SymbolIterator ()
|
||||
{ }
|
||||
|
||||
/// constructor.
|
||||
SymbolIterator (const SymbolSet &syms)
|
||||
: _syms(syms)
|
||||
{
|
||||
const zbar_symbol_set_t *zsyms = _syms;
|
||||
if(zsyms)
|
||||
_sym = zbar_symbol_set_first_symbol(zsyms);
|
||||
}
|
||||
|
||||
/// copy constructor.
|
||||
SymbolIterator (const SymbolIterator& iter)
|
||||
: _syms(iter._syms)
|
||||
{
|
||||
const zbar_symbol_set_t *zsyms = _syms;
|
||||
if(zsyms)
|
||||
_sym = zbar_symbol_set_first_symbol(zsyms);
|
||||
}
|
||||
|
||||
~SymbolIterator ()
|
||||
{
|
||||
}
|
||||
|
||||
/// assignment.
|
||||
SymbolIterator& operator= (const SymbolIterator& iter)
|
||||
{
|
||||
_syms = iter._syms;
|
||||
_sym = iter._sym;
|
||||
return(*this);
|
||||
}
|
||||
|
||||
bool operator! () const
|
||||
{
|
||||
return(!_syms || !_sym);
|
||||
}
|
||||
|
||||
/// advance iterator to next Symbol.
|
||||
SymbolIterator& operator++ ()
|
||||
{
|
||||
if(!!_sym)
|
||||
_sym = zbar_symbol_next(_sym);
|
||||
else if(!!_syms)
|
||||
_sym = zbar_symbol_set_first_symbol(_syms);
|
||||
return(*this);
|
||||
}
|
||||
|
||||
/// retrieve currently referenced Symbol.
|
||||
const Symbol operator* () const
|
||||
{
|
||||
return(_sym);
|
||||
}
|
||||
|
||||
/// access currently referenced Symbol.
|
||||
const Symbol* operator-> () const
|
||||
{
|
||||
return(&_sym);
|
||||
}
|
||||
|
||||
/// test if two iterators refer to the same Symbol
|
||||
bool operator== (const SymbolIterator& iter) const
|
||||
{
|
||||
// it is enough to test the symbols, as they belong
|
||||
// to only one set (also simplifies invalid case)
|
||||
return(_sym == iter._sym);
|
||||
}
|
||||
|
||||
/// test if two iterators refer to the same Symbol
|
||||
bool operator!= (const SymbolIterator& iter) const
|
||||
{
|
||||
return(!(*this == iter));
|
||||
}
|
||||
|
||||
const SymbolIterator end () const {
|
||||
return(SymbolIterator());
|
||||
}
|
||||
|
||||
private:
|
||||
SymbolSet _syms;
|
||||
Symbol _sym;
|
||||
};
|
||||
|
||||
inline SymbolIterator SymbolSet::symbol_begin () const {
|
||||
return(SymbolIterator(*this));
|
||||
}
|
||||
|
||||
inline const SymbolIterator SymbolSet::symbol_end () const {
|
||||
return(SymbolIterator());
|
||||
}
|
||||
|
||||
/// @relates Symbol
|
||||
/// stream the string representation of a Symbol.
|
||||
static inline std::ostream& operator<< (std::ostream& out,
|
||||
const Symbol& sym)
|
||||
{
|
||||
out << sym.get_type_name() << ":" << sym.get_data();
|
||||
return(out);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef _ZBAR_VIDEO_H_
|
||||
#define _ZBAR_VIDEO_H_
|
||||
|
||||
/// @file
|
||||
/// Video Input C++ wrapper
|
||||
|
||||
#ifndef _ZBAR_H_
|
||||
# error "include zbar.h in your application, **not** zbar/Video.h"
|
||||
#endif
|
||||
|
||||
#include "Image.h"
|
||||
|
||||
namespace zbar {
|
||||
|
||||
/// mid-level video source abstraction.
|
||||
/// captures images from a video device
|
||||
|
||||
class Video {
|
||||
public:
|
||||
/// constructor.
|
||||
Video (zbar_video_t *video = NULL)
|
||||
{
|
||||
if(video)
|
||||
_video = video;
|
||||
else
|
||||
_video = zbar_video_create();
|
||||
}
|
||||
|
||||
/// constructor.
|
||||
Video (std::string& device)
|
||||
{
|
||||
_video = zbar_video_create();
|
||||
open(device);
|
||||
}
|
||||
|
||||
~Video ()
|
||||
{
|
||||
zbar_video_destroy(_video);
|
||||
}
|
||||
|
||||
/// cast to C video object.
|
||||
operator zbar_video_t* () const
|
||||
{
|
||||
return(_video);
|
||||
}
|
||||
|
||||
/// open and probe a video device.
|
||||
void open (std::string& device)
|
||||
{
|
||||
if(zbar_video_open(_video, device.c_str()))
|
||||
throw_exception(_video);
|
||||
}
|
||||
|
||||
/// close video device if open.
|
||||
void close ()
|
||||
{
|
||||
if(zbar_video_open(_video, NULL))
|
||||
throw_exception(_video);
|
||||
}
|
||||
|
||||
/// initialize video using a specific format for debug.
|
||||
/// see zbar_video_init()
|
||||
void init (unsigned long fourcc)
|
||||
{
|
||||
if(zbar_video_init(_video, fourcc))
|
||||
throw_exception(_video);
|
||||
}
|
||||
|
||||
/// initialize video using a specific format for debug.
|
||||
/// see zbar_video_init()
|
||||
void init (std::string& format)
|
||||
{
|
||||
unsigned int fourcc = zbar_fourcc_parse(format.c_str());
|
||||
if(zbar_video_init(_video, fourcc))
|
||||
throw_exception(_video);
|
||||
}
|
||||
|
||||
/// retrieve file descriptor associated with open *nix video device.
|
||||
/// see zbar_video_get_fd()
|
||||
int get_fd ()
|
||||
{
|
||||
return(zbar_video_get_fd(_video));
|
||||
}
|
||||
|
||||
/// retrieve current output image width.
|
||||
/// see zbar_video_get_width()
|
||||
int get_width ()
|
||||
{
|
||||
return(zbar_video_get_width(_video));
|
||||
}
|
||||
|
||||
/// retrieve current output image height.
|
||||
/// see zbar_video_get_height()
|
||||
int get_height ()
|
||||
{
|
||||
return(zbar_video_get_height(_video));
|
||||
}
|
||||
|
||||
/// start/stop video capture.
|
||||
/// see zbar_video_enable()
|
||||
void enable (bool enable = true)
|
||||
{
|
||||
if(zbar_video_enable(_video, enable))
|
||||
throw_exception(_video);
|
||||
}
|
||||
|
||||
/// retrieve next captured image.
|
||||
/// see zbar_video_next_image()
|
||||
Image next_image ()
|
||||
{
|
||||
zbar_image_t *img = zbar_video_next_image(_video);
|
||||
if(!img)
|
||||
throw_exception(_video);
|
||||
return(Image(img));
|
||||
}
|
||||
|
||||
/// request a preferred size for the video image from the device.
|
||||
/// see zbar_video_request_size()
|
||||
/// @since 0.6
|
||||
void request_size (int width, int height)
|
||||
{
|
||||
zbar_video_request_size(_video, width, height);
|
||||
}
|
||||
|
||||
/// request a preferred driver interface version for debug/testing.
|
||||
/// see zbar_video_request_interface()
|
||||
/// @since 0.6
|
||||
void request_interface (int version)
|
||||
{
|
||||
zbar_video_request_interface(_video, version);
|
||||
}
|
||||
|
||||
/// request a preferred I/O mode for debug/testing.
|
||||
/// see zbar_video_request_iomode()
|
||||
/// @since 0.7
|
||||
void request_iomode (int iomode)
|
||||
{
|
||||
if(zbar_video_request_iomode(_video, iomode))
|
||||
throw_exception(_video);
|
||||
}
|
||||
|
||||
private:
|
||||
zbar_video_t *_video;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
//------------------------------------------------------------------------
|
||||
// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
//
|
||||
// This file is part of the ZBar Bar Code Reader.
|
||||
//
|
||||
// The ZBar Bar Code Reader is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU Lesser Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The ZBar Bar Code Reader is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser Public License
|
||||
// along with the ZBar Bar Code Reader; if not, write to the Free
|
||||
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301 USA
|
||||
//
|
||||
// http://sourceforge.net/projects/zbar
|
||||
//------------------------------------------------------------------------
|
||||
#ifndef _ZBAR_WINDOW_H_
|
||||
#define _ZBAR_WINDOW_H_
|
||||
|
||||
/// @file
|
||||
/// Output Window C++ wrapper
|
||||
|
||||
#ifndef _ZBAR_H_
|
||||
# error "include zbar.h in your application, **not** zbar/Window.h"
|
||||
#endif
|
||||
|
||||
#include "Image.h"
|
||||
|
||||
namespace zbar {
|
||||
|
||||
/// mid-level output window abstraction.
|
||||
/// displays images to user-specified platform specific output window
|
||||
|
||||
class Window {
|
||||
public:
|
||||
/// constructor.
|
||||
Window (zbar_window_t *window = NULL)
|
||||
{
|
||||
if(window)
|
||||
_window = window;
|
||||
else
|
||||
_window = zbar_window_create();
|
||||
}
|
||||
|
||||
/// constructor.
|
||||
Window (void *x11_display_w32_hwnd,
|
||||
unsigned long x11_drawable)
|
||||
{
|
||||
_window = zbar_window_create();
|
||||
attach(x11_display_w32_hwnd, x11_drawable);
|
||||
}
|
||||
|
||||
~Window ()
|
||||
{
|
||||
zbar_window_destroy(_window);
|
||||
}
|
||||
|
||||
/// cast to C window object.
|
||||
operator zbar_window_t* () const
|
||||
{
|
||||
return(_window);
|
||||
}
|
||||
|
||||
/// associate reader with an existing platform window.
|
||||
/// see zbar_window_attach()
|
||||
void attach (void *x11_display_w32_hwnd,
|
||||
unsigned long x11_drawable = 0)
|
||||
{
|
||||
if(zbar_window_attach(_window,
|
||||
x11_display_w32_hwnd, x11_drawable) < 0)
|
||||
throw_exception(_window);
|
||||
}
|
||||
|
||||
/// control content level of the reader overlay.
|
||||
/// see zbar_window_set_overlay()
|
||||
void set_overlay (int level)
|
||||
{
|
||||
zbar_window_set_overlay(_window, level);
|
||||
}
|
||||
|
||||
/// retrieve current content level of reader overlay.
|
||||
/// see zbar_window_get_overlay()
|
||||
|
||||
/// draw a new image into the output window.
|
||||
/// see zbar_window_draw()
|
||||
void draw (Image& image)
|
||||
{
|
||||
if(zbar_window_draw(_window, image) < 0)
|
||||
throw_exception(_window);
|
||||
}
|
||||
|
||||
/// clear the image from the output window.
|
||||
/// see zbar_window_draw()
|
||||
void clear ()
|
||||
{
|
||||
if(zbar_window_draw(_window, NULL) < 0)
|
||||
throw_exception(_window);
|
||||
}
|
||||
|
||||
/// redraw the last image.
|
||||
/// zbar_window_redraw()
|
||||
void redraw ()
|
||||
{
|
||||
if(zbar_window_redraw(_window) < 0)
|
||||
throw_exception(_window);
|
||||
}
|
||||
|
||||
/// resize the image window.
|
||||
/// zbar_window_resize()
|
||||
void resize (unsigned width, unsigned height)
|
||||
{
|
||||
if(zbar_window_resize(_window, width, height) < 0)
|
||||
throw_exception(_window);
|
||||
}
|
||||
|
||||
private:
|
||||
zbar_window_t *_window;
|
||||
};
|
||||
|
||||
/// select a compatible format between video input and output window.
|
||||
/// see zbar_negotiate_format()
|
||||
static inline void negotiate_format (Video& video, Window& window)
|
||||
{
|
||||
if(zbar_negotiate_format(video, window) < 0)
|
||||
throw_exception(video);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
After Width: | Height: | Size: 319 B |
|
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<!--
|
||||
Copyright 2009-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
|
||||
All Rights Reserved
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Barcode Reader Help</title>
|
||||
<style type="text/css">
|
||||
html, body { margin: 0; padding: 0; background: black; color: white; font-family: sans-serif; font-size: 16px }
|
||||
h1 { margin: .5em 0; text-align: center; font-size: 28px }
|
||||
h2 { font-size: 24px }
|
||||
hr { margin: 1em 0; height: 0; border: none; border-top: solid 1px #666 }
|
||||
.smaller { font-size: 85% }
|
||||
p { margin: .5em }
|
||||
a { color: #8af }
|
||||
p.cen { text-align: center }
|
||||
p.title { margin: 1em; clear: both; text-align: center }
|
||||
div.col { width: 50% }
|
||||
.clear { clear: both }
|
||||
.iconlist { position: relative; clear: both; margin: 4px 0; padding: 1px 0 }
|
||||
.icon { width: 64px; height: 64px; overflow: hidden; margin: 12px 16px; padding: 0; background: url("zbar-helpicons.png") no-repeat; font: bold 56px "Marker Felt"; text-align: center }
|
||||
.sample { display: block; height: 96px; overflow: hidden; margin: 12px auto; padding: 0; background: url("zbar-samples.png") no-repeat; text-align: center}
|
||||
.left { float: left }
|
||||
.right { float: right }
|
||||
.iconlist > p { margin: 10px }
|
||||
.iconlist > h2 { margin: 10px }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="title" style="color: #f88">Barcode Reader Help</h1>
|
||||
<hr/>
|
||||
<p class="title">Recognized barcodes should look like</p>
|
||||
<div class="col left">
|
||||
<a class="sample" style="width: 118px; background-position: -96px" href="http://wikipedia.org/wiki/EAN-13"></a>
|
||||
<p class="cen"><a href="http://wikipedia.org/wiki/EAN-13">EAN/UPC<br/>Product Codes</a></p>
|
||||
</div>
|
||||
<div class="col right">
|
||||
<a class="sample" style="width: 96px" href="http://wikipedia.org/wiki/QR_Code"></a>
|
||||
<p class="cen"><a href="http://wikipedia.org/wiki/QR_Code">QR Codes</a></p>
|
||||
</div>
|
||||
<p class="clear cen smaller">Also recognized, but not shown:
|
||||
<a href="http://wikipedia.org/wiki/Code_128">Code 128</a>,
|
||||
<a href="http://wikipedia.org/wiki/DataBar">DataBar (RSS)</a>,
|
||||
<a href="http://en.wikipedia.org/wiki/Code_93">Code 93</a>,
|
||||
<a href="http://wikipedia.org/wiki/Code_39">Code 39</a> and
|
||||
<a href="http://wikipedia.org/wiki/Interleaved_2_of_5">Interleaved 2 of 5</a></p>
|
||||
<hr/>
|
||||
<p class="clear title">Hints for successful scanning</p>
|
||||
<div class="iconlist">
|
||||
<div class="icon left"></div>
|
||||
<p>Ensure there is plenty of</p>
|
||||
<h2 style="color: #ff4">Light</h2>
|
||||
</div>
|
||||
<div class="iconlist">
|
||||
<div class="icon left" style="background: none; color: #2d4">4"</div>
|
||||
<h2 style="color: #4f6">Distance</h2>
|
||||
<p>should be about 3 to 5 inches</p>
|
||||
</div>
|
||||
<div class="iconlist">
|
||||
<div class="icon left" style="background-position: 0 -64px"></div>
|
||||
<h2 style="color: #3ee">Shake</h2>
|
||||
<p>to force the camera to focus</p>
|
||||
</div>
|
||||
<div class="iconlist">
|
||||
<div class="icon left" style="background-position: 0 -128px"></div>
|
||||
<h2 style="color: #59f">Wait</h2>
|
||||
<p>for the autofocus to finish</p>
|
||||
</div>
|
||||
<div class="iconlist">
|
||||
<div class="icon left" style="background-position: 0 -192px"></div>
|
||||
<h2 style="color: #d5f">Hold Still</h2>
|
||||
<p>while the barcode is scanned</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function onZBarHelp(argv) {
|
||||
var title;
|
||||
switch(argv.reason) {
|
||||
case "INFO": break;
|
||||
case "FAIL": title = "No Barcode Detected"; break;
|
||||
}
|
||||
if(title) document.getElementById('title').textContent = title;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// main.m
|
||||
// SimpleConfig
|
||||
//
|
||||
// Created by realtek on 6/16/14.
|
||||
// Copyright (c) 2014 Realtek. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "RTKAppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([RTKAppDelegate class]));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?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>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
//
|
||||
// SimpleConfigTests.m
|
||||
// SimpleConfigTests
|
||||
//
|
||||
// Created by realtek on 6/16/14.
|
||||
// Copyright (c) 2014 Realtek. All rights reserved.
|
||||
//
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
@interface SimpleConfigTests : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
@implementation SimpleConfigTests
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
[super setUp];
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
{
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testExample
|
||||
{
|
||||
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/* Localized versions of Info.plist keys */
|
||||
|
||||