Skip to content

Instantly share code, notes, and snippets.

@escoz
Created July 27, 2010 15:27
Show Gist options
  • Save escoz/492376 to your computer and use it in GitHub Desktop.
Save escoz/492376 to your computer and use it in GitHub Desktop.
/// LineaSDK.cs
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;
using MonoTouch.UIKit;
namespace LineaSDK
{
[BaseType (typeof (NSObject))]
interface LineaDelegate {
//-(void)connectionState:(int)state;
[Export ("connectionState:")]
void ConnectionState ([Target] NSObject lineaDelegate, int state);
//-(void)buttonPressed:(int)which;
[Export ("buttonPressed:")]
void ButtonPressed ([Target] NSObject lineaDelegate, int which);
//-(void)buttonReleased:(int)which;
[Export ("buttonReleased:")]
void ButtonReleased ([Target] NSObject lineaDelegate, int which);
//-(void)barcodeData:(NSString *)barcode type:(int)type;
[Export ("barcodeData:type:")]
void BarcodeDataType ([Target] NSObject lineaDelegate, string barcode, int type);
//-(void)batteryCapacity:(int)percent;
[Export ("batteryCapacity:")]
void BatteryCapacity ([Target] NSObject lineaDelegate, int percent);
//-(void)magneticCardData:(NSString *)track1 track2:(NSString *)track2 track3:(NSString *)track3;
[Export ("magneticCardData:track2:track3:")]
void MagneticCardDataTrack2 ([Target] NSObject lineaDelegate, string track1, string track2, string track3);
//-(void)magneticCardRawData:(NSData *)tracks;
[Export ("magneticCardRawData:")]
void MagneticCardRawData ([Target] NSObject lineaDelegate, NSData tracks);
//-(void)magneticCardEncryptedData:(int)encryption data:(NSData *)data;
[Export ("magneticCardEncryptedData:data:")]
void MagneticCardEncryptedDataData ([Target] NSObject lineaDelegate, int encryption, NSData data);
//-(void)magneticCardEncryptedRawData:(int)encryption data:(NSData *)data;
[Export ("magneticCardEncryptedRawData:data:")]
void MagneticCardEncryptedRawDataData ([Target] NSObject lineaDelegate, int encryption, NSData data);
}
[BaseType (typeof (NSObject))]
interface Linea {
[Export ("delegate"), NullAllowed]
LineaDelegate Delegate { get; set; }
//-(void)connect;
[Export ("connect")]
void Connect ();
//-(void)disconnect;
[Export ("disconnect")]
void Disconnect ();
//-(NSString *)barcodeType2Text:(int)barcodeType;
[Export ("barcodeType2Text:")]
string BarcodeType2Text (int barcodeType);
//-(void)startScan;
[Export ("startScan")]
void StartScan ();
//-(void)stopScan;
[Export ("stopScan")]
void StopScan ();
//-(int)getScanTimeout;
[Export ("getScanTimeout")]
int GetScanTimeout { get; }
//-(void)setScanTimeout:(int)timeout;
[Export ("setScanTimeout:")]
void SetScanTimeout (int timeout);
//-(int)getScanButtonMode;
[Export ("getScanButtonMode")]
int GetScanButtonMode { get; }
//-(void)setScanButtonMode:(int)mode;
[Export ("setScanButtonMode:")]
void SetScanButtonMode (int mode);
//-(int)getScanMode;
[Export ("getScanMode")]
int GetScanMode { get; }
//-(void)setScanMode:(int)mode;
[Export ("setScanMode:")]
void SetScanMode (int mode);
//-(void)enableBarcode:(int)barcodeType enabled:(BOOL)enabled;
[Export ("enableBarcode:enabled:")]
void EnableBarcode (int barcodeType, bool enabled);
//-(void)setScanBeep:(BOOL)enabled volume:(int)volume beepData:(int *)data length:(int)length;
[Export ("setScanBeep:volume:beepData:length:")]
void SetScanBeep (bool enabled, int volume, int data, int length);
//-(int)getBatteryCapacity;
[Export ("getBatteryCapacity")]
int GetBatteryCapacity { get; }
//-(BOOL)isBarcodeEnabled:(int)type;
[Export ("isBarcodeEnabled:")]
bool IsBarcodeEnabled (int type);
//-(BOOL)isBarcodeSupported:(int)type;
[Export ("isBarcodeSupported:")]
bool IsBarcodeSupported (int type);
//-(void)playSound:(int)volume beepData:(int *)data length:(int)length;
[Export ("playSound:beepData:length:")]
void PlaySound (int volume, int data, int length);
//-(void)msStartScan;
[Export ("msStartScan")]
void MsStartScan ();
//-(void)msStopScan;
[Export ("msStopScan")]
void MsStopScan ();
//-(int)getMSCardDataMode;
[Export ("getMSCardDataMode")]
int GetMSCardDataMode { get; }
//-(void)setMSCardDataMode:(int)mode;
[Export ("setMSCardDataMode:")]
void SetMSCardDataMode (int mode);
//-(BOOL)getCharging;
[Export ("getCharging")]
bool GetCharging { get; }
//-(BOOL)setCharging:(BOOL)enabled;
[Export ("setCharging:")]
bool SetCharging (bool enabled);
//-(void)getFirmwareFileInformation:(NSString *)path firmwareInfo:(struct firmwareInfo *)info;
//[Export ("getFirmwareFileInformation:firmwareInfo:")]
//void GetFirmwareFileInformation (string path, struct firmwareInfo info);
//-(void)updateFirmware:(NSString *)path;
[Export ("updateFirmware:")]
void UpdateFirmware (string path);
//-(int)getSyncButtonMode;
[Export ("getSyncButtonMode")]
int GetSyncButtonMode { get; }
//-(void)setSyncButtonMode:(int)mode;
[Export ("setSyncButtonMode:")]
void SetSyncButtonMode (int mode);
//-(BOOL)msProcessFinancialCard:(financialCard *)data track1:(NSString *)track1 track2:(NSString *)track2;
//[Export ("msProcessFinancialCard:track1:track2:")]
//bool MsProcessFinancialCard (financialCard data, string track1, string track2);
//-(int)getBarcodeTypeMode;
[Export ("getBarcodeTypeMode")]
int GetBarcodeTypeMode { get; }
//-(BOOL)setBarcodeTypeMode:(int)mode;
[Export ("setBarcodeTypeMode:")]
bool SetBarcodeTypeMode (int mode);
//-(void)identSetKey:(NSData *)key;
[Export ("identSetKey:")]
void IdentSetKey (NSData key);
//-(NSData *)identEncryptData:(NSData *)data;
[Export ("identEncryptData:")]
NSData IdentEncryptData (NSData data);
//-(BOOL)barcodeEngineWrite:(void *)data length:(int)length;
[Export ("barcodeEngineWrite:length:")]
bool BarcodeEngineWrite (IntPtr data, int length);
//-(BOOL)barcodeEngineWrite:(NSString *)data;
[Export ("barcodeEngineWrite:")]
bool BarcodeEngineWrite (string data);
//-(int)barcodeEngineRead:(void *)data length:(int)length timeout:(double)timeout;
[Export ("barcodeEngineRead:length:timeout:")]
int BarcodeEngineRead (IntPtr data, int length, double timeout);
//-(void)barcodeEnginePowerControl:(BOOL)engineOn;
[Export ("barcodeEnginePowerControl:")]
void BarcodeEnginePowerControl (bool engineOn);
//-(BOOL)barcodeOpticonSetParams:(NSString *)data;
[Export ("barcodeOpticonSetParams:")]
bool BarcodeOpticonSetParams (string data);
//-(int)btmGetEnabled;
[Export ("btmGetEnabled")]
int BtmGetEnabled { get; }
//-(void)btmSetEnabled:(BOOL)enabled;
[Export ("btmSetEnabled:")]
void BtmSetEnabled (bool enabled);
//-(BOOL)btmWrite:(NSString *)data;
[Export ("btmWrite:")]
bool BtmWrite (string data);
//-(int)btmRead:(void *)data length:(int)length timeout:(double)timeout;
[Export ("btmRead:length:timeout:")]
int BtmRead (IntPtr data, int length, double timeout);
//-(NSString *)btmReadLine:(double)timeout;
[Export ("btmReadLine:")]
string BtmReadLine (double timeout);
//-(NSArray *)btDiscoverDevices:(int)maxDevices maxTime:(double)maxTime codTypes:(int)codTypes;
[Export ("btDiscoverDevices:maxTime:codTypes:")]
NSArray BtDiscoverDevices (int maxDevices, double maxTime, int codTypes);
//-(NSString *)btGetDeviceName:(NSString *)address;
[Export ("btGetDeviceName:")]
string BtGetDeviceName (string address);
//-(BOOL)btConnect:(NSString *)address pin:(NSString *)pin;
[Export ("btConnect:pin:")]
bool BtConnect (string address, string pin);
//-(NSArray *)prnDiscoverPrinters:(double)maxTime;
[Export ("prnDiscoverPrinters:")]
NSArray PrnDiscoverPrinters (double maxTime);
//-(BOOL)prnConnect:(NSString *)address pin:(NSString *)pin;
[Export ("prnConnect:pin:")]
bool PrnConnect (string address, string pin);
//-(void)prnDisconnect;
[Export ("prnDisconnect")]
void PrnDisconnect ();
//-(BOOL)prnWrite:(uint8_t *)data channel:(int)channel length:(int)length timeout:(double)timeout;
//[Export ("prnWrite:channel:length:timeout:")]
//bool PrnWrite (uint8_t data, int channel, int length, double timeout);
//-(int)prnRead:(uint8_t *)data channel:(int)channel length:(int)length timeout:(double)timeout stop:(int)stop;
//[Export ("prnRead:channel:length:timeout:stop:")]
//int PrnRead (uint8_t data, int channel, int length, double timeout, int stop);
//-(void)prnLogo;
[Export ("prnLogo")]
void PrnLogo ();
//-(void)prnText:(NSString *)textString;
[Export ("prnText:")]
void PrnText (string textString);
//-(void)prnLineFeed;
//[Export ("prnLineFeed")]
//void PrnLineFeed ();
//-(void)prnLineFeed:(int)lines;
[Export ("prnLineFeed:")]
void PrnLineFeed (int lines);
//-(void)prnFeedPaper;
[Export ("prnFeedPaper")]
void PrnFeedPaper ();
//-(void)prnLineSpace:(int)lineSpace;
[Export ("prnLineSpace:")]
void PrnLineSpace (int lineSpace);
//-(void)prnImage:(UIImage *)image align:(int)align;
[Export ("prnImage:align:")]
void PrnImage (UIImage image, int align);
}
}
/// LineaSDKEnums.cs
namespace LineaSDK
{
public enum BARCODES // in LineaSDK.h
{
BAR_ALL=0,
BAR_UPC,
BAR_CODABAR,
BAR_CODE25_NI2OF5,
BAR_CODE25_I2OF5,
BAR_CODE39,
BAR_CODE93,
BAR_CODE128,
BAR_CODE11,
BAR_CPCBINARY,
BAR_DUN14,
BAR_EAN2,
BAR_EAN5,
BAR_EAN8,
BAR_EAN13,
BAR_EAN128,
BAR_GS1DATABAR,
BAR_ITF14,
BAR_LATENT_IMAGE,
BAR_PHARMACODE,
BAR_PLANET,
BAR_POSTNET,
BAR_INTELLIGENT_MAIL,
BAR_MSI,
BAR_POSTBAR,
BAR_RM4SCC,
BAR_TELEPEN,
BAR_PLESSEY,
BAR_PDF417,
BAR_MICROPDF417,
BAR_DATAMATRIX,
BAR_AZTEK,
BAR_QRCODE,
BAR_MAXICODE,
BAR_LAST
}
public enum BARCODES_EX // in LineaSDK.h
{
BAR_EX_ALL=0,
BAR_EX_UPCA,
BAR_EX_CODABAR,
BAR_EX_CODE25_NI2OF5,
BAR_EX_CODE25_I2OF5,
BAR_EX_CODE39,
BAR_EX_CODE93,
BAR_EX_CODE128,
BAR_EX_CODE11,
BAR_EX_CPCBINARY,
BAR_EX_DUN14,
BAR_EX_EAN2,
BAR_EX_EAN5,
BAR_EX_EAN8,
BAR_EX_EAN13,
BAR_EX_EAN128,
BAR_EX_GS1DATABAR,
BAR_EX_ITF14,
BAR_EX_LATENT_IMAGE,
BAR_EX_PHARMACODE,
BAR_EX_PLANET,
BAR_EX_POSTNET,
BAR_EX_INTELLIGENT_MAIL,
BAR_EX_MSI_PLESSEY,
BAR_EX_POSTBAR,
BAR_EX_RM4SCC,
BAR_EX_TELEPEN,
BAR_EX_UK_PLESSEY,
BAR_EX_PDF417,
BAR_EX_MICROPDF417,
BAR_EX_DATAMATRIX,
BAR_EX_AZTEK,
BAR_EX_QRCODE,
BAR_EX_MAXICODE,
BAR_EX_RESERVED1,
BAR_EX_RESERVED2,
BAR_EX_RESERVED3,
BAR_EX_RESERVED4,
BAR_EX_RESERVED5,
BAR_EX_UPCA_2,
BAR_EX_UPCA_5,
BAR_EX_UPCE,
BAR_EX_UPCE_2,
BAR_EX_UPCE_5,
BAR_EX_EAN13_2,
BAR_EX_EAN13_5,
BAR_EX_EAN8_2,
BAR_EX_EAN8_5,
BAR_EX_CODE39_FULL,
BAR_EX_ITA_PHARMA,
BAR_EX_CODABAR_ABC,
BAR_EX_CODABAR_CX,
BAR_EX_SCODE,
BAR_EX_MATRIX_2OF5,
BAR_EX_IATA,
BAR_EX_KOREAN_POSTAL,
BAR_EX_CCA,
BAR_EX_CCB,
BAR_EX_CCC,
BAR_EX_LAST
}
public enum CONN_STATES // in LineaSDK.h
{
CONN_DISCONNECTED=0,
CONN_CONNECTING,
CONN_CONNECTED
}
public enum SCAN_MODES // in LineaSDK.h
{
MODE_SINGLE_SCAN=0,
MODE_MULTI_SCAN
}
public enum BUTTON_STATES // in LineaSDK.h
{
BUTTON_DISABLED=0,
BUTTON_ENABLED
}
public enum MS_MODES // in LineaSDK.h
{
MS_PROCESSED_CARD_DATA=0,
MS_RAW_CARD_DATA
}
public enum BT_MODES // in LineaSDK.h
{
BARCODE_TYPE_DEFAULT=0,
BARCODE_TYPE_EXTENDED
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment