This package contains StarMgsIO SDK Ver 1.5.3.
StarMgsIO.xcframework is a framework for supporting application
development for Star scales.
In accordance with Apple’s guidelines,
StarMgsIO Ver.1.5.2 or later include a privacy manifest file.
Please see here
for the Manifest file.
StarMgsIO does not use the Required Reason API from Ver.1.0.0. (As of
January 29, 2024)
MG_series_Scale_StarMgsIO_iOS_SDK_V1.5.3/
├── Documents/
│ └── readme.url // Link to SDK manual
├── SDK/
│ └── Star_MgsIO_SDK.xcodeproj // Sample App(Ver.1.5.3)
├── StarMgsIO.xcframework // StarMgsIO(Ver.1.5.3)
├── Package.swift
└── SoftwareLicenseAgreement_En.pdf // Software License Agreement
Supported models : - MG-S Scale - MG-S322 - MG-S1501 - MG-S8200 -
MG-S322 USCA
- MG-S1501 USCA - MG-S8200 CA - MG-T Scale - MG-T12 - MG-T30 - MG-T60 -
MG-T12 UDB - MG-T30 UDB - MG-T60 UDB
Supported OS : - iOS 13.0 - 18.0
Supported Xcode : - Xcode 15.2
StarMgsIO SDK library supports Swift Package Manager and Framework. Please link library that suits your application configuration.
In order to integrate the StarMgsIO framework into your iOS application, Use Swift Package Manager.
https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app
Open the project file by Xcode.
Select target from “TARGETS” in project setting view.
Select “Build Phases” and click ‘+’ button in “Link Binary with Libraries”.
Click “Add Other …” button and select StarMgsIO.framework from the file dialog.
Development with Swift
StarMgsIO Framework is written in Objective-C. To use them in Swift,
you need to add Objective-C Bridging-Header to your project.
1. Select File – New – File… from Xcode menu.
2. Select the Header File , and then click Next .
3. Enter a name and click Create to create an empty header file. In the
example shown below, the header file name is
“Star_MgsIO_SDK-Bridging-Header.h”.
4. Write the following import lines in the header file created.
#import <StarMgsIO/StarMgsIO.h>
This class is used to manage a scale.
Shared accessory manager |
---|
open class func StarDeviceManager() |
Public properties and methods |
---|
- void
scanForScales() Start scanning scales. |
- void stopScan() Stop scanning scales. |
- void connectScale(STARScale
scale) Connect to a scale and set delegate to notify the communication result with it. The result will be notified to delegate object. |
- void connectScaleWithIdentifier
(String 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. |
- void disconnectScale(STARScale
scale) Disconnect a scale. The result will be notified to delegate object. |
- String
versionString Get StarMgsIO.framework version name. |
- STARDeviceManagerDelegate
delegate Delegate object to receive the results of methods. |
This protocol is used to receive the result of processes done in the STARDeviceManager class.
Public methods |
---|
func manager(_ manager:
STARDeviceManager, didDiscover scale: STARScale?, error:
Error?) Notify the execution result of scanForScales method of STARDeviceManager class. |
func manager(_ manager:
STARDeviceManager, didConnect scale: STARScale?, error:
Error?) Notify the execution result of connectScale: method of STARDeviceManager class. |
func manager(_ manager:
STARDeviceManager, didDisconnectScale scale: STARScale?, error:
Error?) Notify the execution result of disconnectScale: method of STARDeviceManager class or physical disconnection. |
This class is used to communicate with a scale.
Public properties and methods |
---|
String name? The name of the scale. |
String identifier? The identifier(UUID) of the scale. |
STARScaleDelegate
delegate? Delegate object to receive the results of methods. |
- void
updateSetting:(STARScaleSetting setting) Change scale settings. The result will be notified to delegate object. |
This protocol is used to receive the result of processes done in the STARScale class.
Public methods |
---|
-func scale(_ scale: STARScale!,
didRead scaleData: STARScaleData!, error: Error!) Notify that weight data is received from a scale. |
-func scale(_ scale: STARScale!,
didUpdate setting: STARScaleSetting, error: Error!) Notify execution result of updateSetting method. |
This enum is used to specity the scale setting.
Constants |
---|
STARScaleSettingZeroPointAdjustment Zero Point Adjustment |
This class manages weight data received from a scale.
Public properties and methods |
---|
Double
weight Weight |
STARUnit unit Unit of weight |
STARComparatorResult
comparatorResult Result of comparator function |
STARDataType
dataType Type of the data |
STARStatus
status Scale status |
Int
numberOfDecimalPlaces Number of decimal places of weight |
String rawString Raw string |
This enum is used to specify the unit of weight.
Constants |
---|
invalid Invalid value |
MG Milligram |
G Gram |
CT Carat |
MOM Momme |
OZ Ounce |
LB Pound |
OZT Troy ounce |
DWT Penny weight |
GN Grain |
TLH Hong Kong tael |
TLS Singapore tael |
TLT Taiwan tael |
TO Tola |
MSG Mesghal |
BAT Baht |
PCS Parts counting |
percent Percentage weighing |
coefficient Multiplied by Coefficient |
This enum is used to specify the result of comparator function.
Constants |
---|
invalid Invalid value |
shortage Shortage |
proper Proper |
over Over |
This enum is used to specify the scale type.
Constants |
---|
Invalid Invalid value |
MGS MG-S322,MG-S1501,MG-S8200,MG-S322 USCA, MG-S1501 USCA MG-S8200 USCA |
MGTS MG-T12,MG-T30,MG-T60,MG-T12 UDB,MG-T30 UDB,MG-T60 UDB |
This class is used to determine the scale type.
Constants |
---|
STARScaleType_ENUM
getEnum(name:String) Get the ScaleType of Enum type from the String name (MGS or MGTS). |
This enum is used to specify the type of the data.
Constants |
---|
invalid Invalid value |
netNotTared Net weight (not tared) |
net Net weight (tared) |
tare Tare weight |
presetTare Preset tare weight |
total Total value |
unit Unit weight |
gross Gross |
This enum is used to specify the status of weight data.
Constants |
---|
invalid Invalid value |
stable Data stable |
unstable Data unstable |
error Data error |
This enum represents the type of error.
Constants |
---|
notAvailableError The host device does not have the function to connect to a scale. |
alreadyConnectedError Attempt to connect to a scale even though already connected to it. |
timeoutError Operation timed out. |
notSupportedError Attempt to connect to not supported device. |
unexpectedError Operation is failed due to unexpected error. |
unexpectedDisconnectionError Scale is disconnected unexpextedly. |
notConnectedError Attempt to operate a scale even though not connected to it. |
requestRejectedError Change scale settings operation is failed due to request is rejected. |
StarMgsIO SDK library supports Framework. Please link library that suits your application configuration.
Open the project file by Xcode.
Select target from “TARGETS” in project setting view.
Select “Build Phases” and click ‘+’ button in “Link Binary with Libraries”.
Click “Add Other …” button and select StarMgsIO.framework from the file dialog.
At the beginning of the source code, import the header file as follows.
#import <StarMgsIO/StarMgsIO.h>
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. |
- (void)stopScan; Stop scanning scales. |
**- (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. |
**-
(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. |
**- (void)disconnectScale:(nonnull
STARScale *)scale; Disconnect a scale. The result will be notified to delegate** object. |
**@property(nonatomic, readonly) NSString
*versionString;** Get StarMgsIO.framework version name. |
@property(nonatomic, weak)
id<STARDeviceManagerDelegate> delegate; Delegate object to receive the results of methods. |
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;** Notify the execution result of scanForScales method of STARDeviceManager class. |
**- (void)manager:(nonnull
STARDeviceManager )managerr> didConnectScale:(STARScale
)scale error:(NSError *)error;** Notify the execution result of connectScale: method of STARDeviceManager class. |
**- (void)manager:(nonnull
STARDeviceManager )manager didDisconnectScale:(STARScale )scale
error:(NSError *)error;** Notify the execution result of disconnectScale: method of STARDeviceManager class or physical disconnection. |
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, 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. |
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. |
This enum is used to specity the scale setting.
Constants |
---|
STARScaleSettingZeroPointAdjustment Zero Point Adjustment |
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 |
This enum is used to specify the unit of weight.
Constants |
---|
STARUnitInvalid Invalid value |
STARUnitMG Milligram |
STARUnitG Gram |
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 |
This enum is used to specify the result of comparator function.
Constants |
---|
STARComparatorResultInvalid Invalid value |
STARComparatorResultShortage Shortage |
STARComparatorResultProper Proper |
STARComparatorResultOver Over |
This enum is used to specify the scale type.
Constants |
---|
Invalid Invalid value |
MGS MG-S322,MG-S1501,MG-S8200,MG-S322 USCA, MG-S1501 USCA MG-S8200 USCA |
MGTS MG-T12,MG-T30,MG-T60,MG-T12 UDB,MG-T30 UDB,MG-T60 UDB |
This class is used to determine the scale type.
Constants |
---|
**+(STARScaleType_ENUM) getEnum:(NSString
*)name** Get the ScaleType of Enum type from the String name (MGS or MGTS). |
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 |
This enum is used to specify the status of weight data.
Constants |
---|
STARStatusInvalid Invalid value |
STARStatusStable Data stable |
STARStatusUnstable Data unstable |
STARStatusError Data error |
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 - 2024 Star Micronics Co., Ltd. All rights reserved.
Ver.1.5.3(US market only)
2024/11/22
Ver.1.5.2(US market only)
2024/3/27
Ver.1.5.1(US market only)
2024/2/9
Ver.1.5.0(US market only)
2023/10/31
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