StarMgsIO iOS SDK Ver 1.3.0

Overview

This package contains StarMgsIO SDK Ver 1.3.0.
StarMgsIO.xcframework is a framework for supporting application development for Star scales.

  1. Contents
  2. Scope
  3. Installation
  4. API
    1. STARDeviceManager
    2. STARDeviceManagerDelegate
    3. STARScale
    4. STARScaleDelegate
    5. STARScaleSetting
    6. STARScaleData
    7. STARUnit
    8. STARComparatorResult
    9. STARDataType
    10. STARStatus
  5. Copyright
  6. Release History

Contents

MG_series_Scale_StarMgsIO_iOS_SDK_V1_3_0/
├── Documents/
│   └── readme.url                      // Link to release Notes
├── Software/
│   ├── SDK/                            // Samples (Ver.1.3.0)
│   └── Distributables/
│       └── StarMgsIO.xcframework (Ver.1.1.0)
└── SoftwareLicenseAgreement_En.pdf     // Software License Agreement

Scope

Supported models :

Supported OS :

Supported Xcode :

Installation

StarMgsIO SDK library supports CocoaPods and Framework. Please link library that suits your application configuration.

Use CocoaPods

  1. Add the pod to your Podfile
    pod 'StarMgsIO', 'StarMgsIOVersion'

Please refer to Podfile in SDK for the latest library version.

  1. And then run

    pod install
  2. At the beginning of the source code, import the header file as follows.

    #import <StarMgsIO/StarMgsIO.h>

Use Framework

  1. Open the project file by Xcode.

  2. Select target from "TARGETS" in project setting view.

  3. Select "Build Phases" and click '+' button in "Link Binary with Libraries".

    setting

  4. Click "Add Other ..." button and select StarMgsIO.xcframework from the file dialog.

  5. At the beginning of the source code, import the header file as follows.

    #import <StarMgsIO/StarMgsIO.h>

API

STARDeviceManager

This class is used to manage a scale.

Shared accessory manager
+ (STARDeviceManager *)sharedManager;
Return the shared STARDeviceManager object.
Public properties and methods
- (void)scanForScales;
Start scanning scales.
[STARDeviceManager.sharedManager scanForScales];
- (void)stopScan;
Stop scanning scales.
[STARDeviceManager.sharedManager stopScan];
- (void)connectScale:(nonnull STARScale *)scale;
Connect to a scale and set delegate to notify the communication result with it. The result will be notified to delegate object.
[STARDeviceManager.sharedManager connectScale:selectedScale];
- (void)connectScaleWithIdentifier:(nonnull NSString *)identifier;
Connect to a scale and set delegate to notify the communication result with it. The result will be notified to delegate object.
identifier: The UUID that can be obtained from the identifier property of the STARScale object.
[STARDeviceManager.sharedManager connectScaleWithIdentifier:selectedScale.identifier];
- (void)disconnectScale:(nonnull STARScale *)scale;
Disconnect a scale.
The result will be notified to delegate object.
[STARDeviceManager.sharedManager disconnectScale:_scale];
@property(nonatomic, readonly) NSString *versionString;
Get StarMgsIO.xcframework version name.
@property(nonatomic, weak) id<STARDeviceManagerDelegate> delegate;
Delegate object to receive the results of methods.

STARDeviceManagerDelegate

This protocol is used to receive the result of processes done in the STARDeviceManager class.

Public methods
- (void)manager:(nonnull STARDeviceManager *)manager didDiscoverScale:(STARScale *)scale error:(NSError *)error;
Captures the result of the scanForScales() method.

Add complete code from MG-series-SDK, TableViewController, line 100, function
- (void)manager:(STARDeviceManager *)manager didDiscoverScale:(STARScale *)scale error:(NSError *)error {… }
- (void)manager:(nonnull STARDeviceManager *)managerr> didConnectScale:(STARScale *)scale error:(NSError *)error;
Captures the result of the connectScale() method when connecting to a STARScale object.

Add complete code from MG-series-SDK, TableViewController, line 117, function
- (void)manager:(STARDeviceManager *)manager didConnectScale:(STARScale *)scale error:(NSError *)error {… }
- (void)manager:(nonnull STARDeviceManager *)manager didDisconnectScale:(STARScale *)scale error:(NSError *)error;
Delegate method is notified when a STARScale object is disconnected using disconnectScale() method or when BLE connection is lost.
- (void)manager:(STARDeviceManager *)manager didDisconnectScale:(STARScale *)scale error:(NSError *)error {
if (error) {
NSLog(@"%@", error.localizedDescription);
}

if (_disconnectionHandler != nil) {
_disconnectionHandler();
}
}

STARScale

This class is used to communicate with a scale.

Public properties and methods
@property(nonatomic, readonly) NSString * _Nullable name;
The name of the scale.
@property(nonatomic, readonly) NSString * _Nullable identifier;
The identifier(UUID) of the scale.
@property(nonatomic, readonly) STARScaleType_ENUM scaleType;
The model of the scale.
@property(nonatomic, weak) id<STARScaleDelegate> _Nullable delegate;
Delegate object to receive the results of methods.
- (void)updateSetting:(STARScaleSetting)setting;
Change scale settings.
The result will be notified to delegate object.

STARScaleDelegate

This protocol is used to receive the result of processes done in the STARScale class.

Public methods
- (void)scale:(STARScale *)scale didReadScaleData:(STARScaleData *)scaleData error:(NSError *)error;
Notify that weight data is received from a scale.
- (void)scale:(STARScale *)scale didUpdateSetting:(STARScaleSetting)setting error:(NSError *)error;
Notify execution result of updateSetting method.

STARScaleSetting

This enum is used to specity the scale setting.

Constants
STARScaleSettingZeroPointAdjustment
Zero Point Adjustment

STARScaleData

This class manages weight data received from a scale.

Public properties and methods
@property(nonatomic, readonly) double weight;
Weight
@property(nonatomic, readonly) STARUnit unit;
Unit of weight
@property(nonatomic, readonly) STARComparatorResult comparatorResult;
Result of comparator function
@property(nonatomic, readonly) STARDataType dataType;
Type of the data
@property(nonatomic, readonly) STARStatus status;
Scale status
@property(nonatomic, readonly) NSInteger numberOfDecimalPlaces;
Number of decimal places of weight
@property(nonatomic, readonly) NSString *rawString;
Raw string

STARUnit

This enum is used to specify the unit of weight.

Constants
STARUnitInvalid
Invalid value
STARUnitMG
Milligram
STARUnitG
Gram
STARUnitKG
Kilogram
STARUnitCT
Carat
STARUnitMOM
Momme
STARUnitOZ
Ounce
STARUnitLB
Pound
STARUnitOZT
Troy ounce
STARUnitDWT
Penny weight
STARUnitGN
Grain
STARUnitTLH
Hong Kong tael
STARUnitTLS
Singapore tael
STARUnitTLT
Taiwan tael
STARUnitTO
Tola
STARUnitMSG
Mesghal
STARUnitBAT
Baht
STARUnitPCS
Parts counting
STARUnitPercent
Percentage weighing
STARUnitCoefficient
Multiplied by Coefficient

STARComparatorResult

This enum is used to specify the result of comparator function.

Constants
STARComparatorResultInvalid
Invalid value
STARComparatorResultShortage
Shortage
STARComparatorResultProper
Proper
STARComparatorResultOver
Over

STARScaleType_ENUM

This enum is used to specify the scale type.

Constants
STARScaleTypeInvalid
Invalid value
STARScaleTypeMGS
MG-S322,MG-S1501,MG-S8200
STARScaleTypeMGTS
MG-T12,MG-T30,MG-T60

STARScaleType

This class is used to determine the scale type.

Public methods
+ (STARScaleType_ENUM)getEnum:(NSString *)name;
Get the ScaleType of Enum type from the String name (MGS or MGTS).

STARDataType

This enum is used to specify the type of the data.

Constants
STARDataTypeInvalid
Invalid value
STARDataTypeNetNotTared
Net weight (not tared)
STARDataTypeNet
Net weight (tared)
STARDataTypeTare
Tare weight
STARDataTypePresetTare
Preset tare weight
STARDataTypeTotal
Total value
STARDataTypeUnit
Unit weight
STARDataTypeGross
Gross

STARStatus

This enum is used to specify the status of weight data.

Constants
STARStatusInvalid
Invalid value
STARStatusStable
Data stable
STARStatusUnstable
Data unstable
STARStatusError
Data error

STARErrorCode

This enum represents the type of error and is used for the code property of the NSError object.

Constants
STARNotAvailableError
The host device does not have the function to connect to a scale.
STARAlreadyConnectedError
Attempt to connect to a scale even though already connected to it.
STARTimeoutError
Operation timed out.
STARNotSupportedError
Attempt to connect to not supported device.
STARUnexpectedError
Operation is failed due to unexpected error.
STARUnexpectedDisconnectionError
Scale is disconnected unexpextedly.
STARNotConnectedError
Attempt to operate a scale even though not connected to it.
STARRequestRejectedError
Change scale settings operation is failed due to request is rejected.

Copyright 2019 - 2021 Star Micronics Co., Ltd. All rights reserved.

Release History

Ver.1.3.0(US market only)
2021/12/20

Ver.1.2.0 (US market only)
2019/12/25


Ver.1.0.1 (US market only)
2019/10/11


Ver.1.0.0 (US market only)
2018/06/29