25
TY’s Terminal App for IOS™ Source code Document Version 4.2 Oct-2020

Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

TY’s Terminal App for IOS™ Source code Document

Version 4.2

Oct-2020

Page 2: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 2|25

TAIYO YUDEN CO., LTD.

Class Documentation

AppDelegate Class Reference

Inheritance diagram for AppDelegate:

Properties

UIWindow * window

The documentation for this class was generated from the following file: TY's Terminal App/AppDelegate.h

Page 3: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 3|25

TAIYO YUDEN CO., LTD.

AppDelegate() Category Reference

The documentation for this category was generated from the following file: TY's Terminal App/AppDelegate.m

Page 4: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 4|25

TAIYO YUDEN CO., LTD.

DeviceData Struct Reference

Public Attributes

CBPeripheral * peripheral

NSNumber * rssi

The documentation for this struct was generated from the following file: TY's Terminal App/Devices.m

Page 5: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 5|25

TAIYO YUDEN CO., LTD.

DeviceInfo Class Reference

Inheritance diagram for DeviceInfo:

Properties

IBOutlet UIImage * icon

IBOutlet UILabel * name

IBOutlet UILabel * rssi

IBOutlet UILabel * ident

The documentation for this class was generated from the following file: TY's Terminal App/CustomCells.h

Page 6: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 6|25

TAIYO YUDEN CO., LTD.

DeviceSelection Class Reference

Inheritance diagram for DeviceSelection:

Instance Methods

(void) - refreshView

Method Documentation

- (void) refreshView

Clears all currently discovered devices and the UITableView and restarts scanning.

The documentation for this class was generated from the following files:

TY's Terminal App/Devices.h

TY's Terminal App/Devices.m

Page 7: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 7|25

TAIYO YUDEN CO., LTD.

DeviceSelection() Category Reference

Properties

IBOutlet DeviceInfo * cbDeviceEntry

IBOutlet UITableView * tableView

NSMutableArray * deviceList

NSMutableArray * rssiList

CBPeripheral * connected_peripheral

The documentation for this category was generated from the following file: TY's Terminal App/Devices.m

Page 8: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 8|25

TAIYO YUDEN CO., LTD.

MsgEntry Class Reference

Inheritance diagram for MsgEntry:

Properties

IBOutlet UILabel * msg

The documentation for this class was generated from the following file: TY's Terminal App/CustomCells.h

Page 9: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 9|25

TAIYO YUDEN CO., LTD.

Terminal Class Reference

Inheritance diagram for Terminal:

Instance Methods

(BOOL) - writeMessageToPeripheral:

(void) - printMessageToScreen:characteristic:

(void) - clearScreen

(NSData *) - ascii2hex:

(NSData *) - hex2string:

(char) - getValidHex:

Protected Types

enum format_t { Fmt_Ascii, Fmt_Hex }

enum eol_t { EOL_NONE, EOL_CR, EOL_LF, EOL_CRLF }

Properties

CBPeripheral * peripheral

Member Enumeration Documentation

- (enum) eol_t[protected]

End of line character selection enumerators

- (enum) format_t[protected]

Numeric format enumerators [Hex, Ascii]

Method Documentation

- (NSData *) ascii2hex: (NSData*) message

Converts an ascii sequence to hexadecimal ie. 'AB' -> 0xAB. The conversion will fail if

there are any non-hexadecimal characters present. Special charactes (e.g. spaces) will be

ignored. Used when transmitting hex data

Parameters

message ascii formatted input sequence.

Returns

hex formatted sequence, null if invalid.

- (void) clearScreen

Clears the message lists and empties the message table

- (char) getValidHex: (char) b

Checks if a byte is a valid hexadecimal character [0-9, A-F].

Page 10: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 10|25

TAIYO YUDEN CO., LTD.

Parameters

b byte to check.

Returns

Ascii value of valid character, 0xFE if special character, 0xFF if invalid.

- (NSData *) hex2string: (NSData *) message

Converts a hex sequence to string format for display. Used when receiving hex

data.

@param message Input sequence to be converted.

8

Returns

Ascii formatted sequence

- (void) printMessageToScreen: (NSString *) message characteristic: (CBCharacteristic *) characteristic

Displays the specified characters on screen. If the message source is the same as the

previous, the characters are appended to the end of the string. Otherwise a new table entry

is created.

Parameters

message The message to display on screen @oaram characteristic The message source

(TX or RX)

- (BOOL) writeMessageToPeripheral: (NSString *) string

Transmits a string of characters to the connected peripheral using the TX characteristic.

Characters are transmitted in blocks conforming to maximum BLE packet size. The string

will be converted if a non-Ascii format is selected.

Parameters

string Message input by user

Returns

True on success, False on failure

The documentation for this class was generated from the following files:

TY's Terminal App/Terminal.h

TY's Terminal App/Terminal.m

Page 11: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 11|25

TAIYO YUDEN CO., LTD.

Terminal() Category Reference

Properties

⚫ IBOutlet UIButton * Send

⚫ IBOutlet UIBarButtonItem * OPT

⚫ IBOutlet UIButton * EOL

⚫ IBOutlet UIButton * Format

⚫ IBOutlet UIButton * Clear

⚫ IBOutlet UITextField * txt_message

⚫ IBOutlet NSLayoutConstraint * ControlsViewBtmConstraint

⚫ IBOutlet UITableView * messageTable

⚫ NSMutableArray * messages

The documentation for this class was generated from the following files:

TY's Terminal App/Terminal.m

Page 12: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 12|25

TAIYO YUDEN CO., LTD.

BeaconCell : UITableViewCell Class Reference [Swift]

Instance Methods (void) awakeFromNib()

Properties IBOutlet UILabel! header

IBOutlet UILabel! time_lbl

IBOutlet UILabel! temp_lbl

IBOutlet UILabel! hum_lbl

IBOutlet UILabel! light_lbl

IBOutlet UILabel! air_lbl

IBOutlet UILabel! sound_lbl

IBOutlet UILabel! accx_lbl

IBOutlet UILabel! accy_lbl

IBOutlet UILabel! accz_lbl

IBOutlet UILabel! elec_lbl

IBOutlet UILabel! txpwr_lbl

IBOutlet UILabel! c02_lbl

IBOutlet UILabel! rssi

IBOutlet UILabel! seq_lbl

The documentation for this class is from the following files:

TY's Terminal App/Beacons.swift

Page 13: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 13|25

TAIYO YUDEN CO., LTD.

Beacons : UIViewController, UITextViewDelegate, UITableViewDelegate, UITableViewDataSource Class Reference [Swift] Instance Methods

(void) viewDidLoad()

(objc void) updateBeaconsLog(notification: NSNotification)

(objc void) refreshTable(notification: NSNotification)

(objc void) newBeaconData(new: BeaconLog)

(String) createLogHeader(bdata: BeaconData)

(String) parseDateToTime(date: Date)

(Int) tableView(_ tableView: UITableView, numberOfRowsInSection section: Int)

(UITableViewCell) tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath)

(void) scrollToBottom()

(void) viewWillAppear(_ animated: Bool)

Properties

IBOutlet UINavigationBar! b_navbar

IBOutlet UITableView! beaconTable

Array<BeaconLog>! beaconData

The documentation for this class is from the following files:

TY's Terminal App/Beacons.swift

Page 14: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 14|25

TAIYO YUDEN CO., LTD.

ManufacturingData class Reference [Swift] Instance methods

(void) init(companyId: UInt16, typeId: UInt8, sequenceNumber: Int16, temperature: Int16,

humidity: Int16, light: UInt16, co2: Int16, airPressure: Int16, soundPressure: Int16, accelerationX:

Int16, accelerationY: Int16, accelerationZ: Int16, electricity: Int16, txPower: Int8) throws

ManufacturerDataError.tydBeaconError

(convenience void) init?(ID: [UInt8], TID: [UInt8], seq: [UInt8], T: [UInt8], H: [UInt8], L:

[UInt8], C: [UInt8], A: [UInt8], sound: [UInt8], accX: [UInt8], accY: [UInt8], accZ: [UInt8], E:

[UInt8], Tpow: [UInt8]) throws ManufacturerDataError.tydBeaconError

(convenience void) init?(data: Data) throws ManufacturerDataError.notTYDBeacon

Properties

UInt16 companyID

UInt8 TypeID

Int16 SequenceNumber

Int16 Temperature

Int16 Humidity

UInt16 Light

Int16 CO2

Int16 AirPressure

Int16 SoundPressure

Int16 AccelerationX

Int16 AccelerationY

Int16 AccelerationZ

Int16 Electricity

Int8 TxPower

The documentation for this class is from the following files:

TY's Terminal App/Beacons.swift

Page 15: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 15|25

TAIYO YUDEN CO., LTD.

ManufacturerDataError : Error Enumeration Reference [Swift]

Properties case tydBeaconError

case notTYDBeacon

case unknownError

The documentation for this class is from the following files:

TY's Terminal App/Beacons.swift

Page 16: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 16|25

TAIYO YUDEN CO., LTD.

BeaconLog Structure Reference [Swift]

Instance Methods (void) init(name: String, time: String, temperature:Int16, humidity:Int16, light:UInt16, air:Int16,

sound: Int16, acc_x:Int16, acc_y:Int16, acc_z:Int16, electricity: Int16, tx_power:Int8, co2:Int16,

rssi: Int, seq: Int16)

Properties String name

String time

Int16 sequence

Double temperature

Int16 humidity

UInt16 light

Int16 air

Int16 sound

Double acc_x

Double acc_y

Double acc_z

Int16 electricity

Int8 tx_power

Int16 co2

Int rssi

The documentation for this class is from the following files:

TY's Terminal App/Beacons.swift

Page 17: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 17|25

TAIYO YUDEN CO., LTD.

Data Extension Reference [Swift]

Instance Methods (OptionsSet) HexEncodingOptions

Properties

String hexEncodedString(options: HexEncodingOptions = [])

The documentation for this class is from the following files:

TY's Terminal App/Beacons.swift

Page 18: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 18|25

TAIYO YUDEN CO., LTD.

Int16 Extension Reference [Swift]

Instance Methods (void) init?(bytes: [UInt8], littleEndian: Bool = true)

The documentation for this class is from the following files:

TY's Terminal App/Beacons.swift

Page 19: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 19|25

TAIYO YUDEN CO., LTD.

TYDVar Structure Reference [Swift]

Properties static int PUBLIC_ID = 0xFFFF

The documentation for this class is from the following files:

TY's Terminal App/Beacons.swift

Page 20: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 20|25

TAIYO YUDEN CO., LTD.

UInt16 Extension Reference [Swift]

Instance Methods (void) init?(bytes: [UInt8], littleEndian: Bool = true)

The documentation for this class is from the following files:

TY's Terminal App/Beacons.swift

Page 21: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 21|25

TAIYO YUDEN CO., LTD.

DeviceData : NSObject Class Reference [Swift]

Instance methods (void) init(peripheral: CBPeripheral, rssi: NSNumber)

Properties objc CBPeripheral peripheral

objc NSNumber rssi

The documentation for this class is from the following files:

TY's Terminal App/TabController.swift

Page 22: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 22|25

TAIYO YUDEN CO., LTD.

TAIYOYUDEN Class Reference [Swift]

Properties static String SERVICE_UUID = "442F1570-8A00-9A28-CBE1-E1D4212D53EB"

static String RXCHAR_UUID = "442F1571-8A00-9A28-CBE1-E1D4212D53EB"

static String TXCHAR_UUID = "442F1572-8A00-9A28-CBE1-E1D4212D53EB"

static String TXCHARWITHRES_UUID = "442F1574-8A00-9A28-CBE1-E1D4212D53EB"

static String MATCH_UUID = "686905E4-1358-48CC-B95F-80587DE4CBCB"

The documentation for this class is from the following files:

TY's Terminal App/TabController.swift

Page 23: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 23|25

TAIYO YUDEN CO., LTD.

TabController : UITabBarController Class Reference [Swift]

Extensions TabController: CBCentralManagerDelegate

TabController: CBPeripheralDelegate

Instance Methods (void) viewDidLoad()

(objc void) disconnectPeripheral(notification: NSNotification)

(objc void) stopScanning(notification: NSNotification)

(objc void) startAdvertisement(notification: NSNotification)

(Array<CBPeripheral>) getDevices()

(Array<NSNumber>) getRssi()

(objc void) connectToDevice(notification: NSNotification)

(void) centralManagerDidUpdateState(_ central: CBCentralManager)

(void) centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral,

advertisementData: [String : Any], rssi RSSI: NSNumber)

(void) centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral)

(void) centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral:

CBPeripheral, error: Error?)

(void) centralManager(_ central: CBCentralManager, didFailToConnect peripheral:

CBPeripheral, error: Error?)

(void) centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any])

(void) peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?)

(void) peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService,

error: Error?)

Properties CBCentralManager! centralManager

Dictionary<String,DeviceData>! deviceList

Array<Int>! rssiList

Array<BeaconData>! beaconList

Array<CBUUID>! services

CBPeripheral! connected_peripheral

The documentation for this class is from the following files:

TY's Terminal App/TabController.swift

Page 24: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 24|25

TAIYO YUDEN CO., LTD.

BeaconData Structure Reference [Swift]

Properties String name

Date time

Data data

Int rssi

The documentation for this class is from the following files:

TY's Terminal App/TabController.swift

Page 25: Terminal App IOS - YUDEN...TY's Terminal App/AppDelegate.h 26-Oct.2020 Ver4.2 TAIYO YUDEN CO., LTD. Page 3|25 TAIYO YUDEN CO., LTD. AppDelegate() Category Reference The documentation

26-Oct.2020 Ver4.2

TAIYO YUDEN CO., LTD.

Page 25|25

TAIYO YUDEN CO., LTD.

Note: THIS SOFTWARE OR SAMPLE CODE IS PROVIDED BY TAIYO YUDEN CO., LTD. (“TAIYO YUDEN”)"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TAIYO YUDEN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR SAMPLE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.