# Adding the SDK
## Importing the SDK
1. Download AsReaderBLESDK and AsReaderSDK4 locally.
1. Create a new project.
{width="700"}
1. Select ".NET MAUI APP".
{width="700"}
1. Select ".NET 7.0".
{width="700"}
1. Create the App name and location.
{width="700"}
1. Right-click on "AsReaderSDK4MAUIDemo.csproj" and open it with TextEdit.
{width="700"
1. Delete all unnecessary frameworks within the red box in the figure below (net70-iOS).
(This is the operation when using only the iOS platform. This step is not necessary for multi-platform.)
{width="700"}
1. The result after deletion is shown below.
{width="700"}
1. Copy the locally downloaded AsReaderBLESDK and AsReaderSDK4 to the project folder.
{width="600"}
1. Dependencies -> Right-click -> Add Project Reference...
{width="600"}
1. In the Pop-up window, click ".Net
Assembly" and select "Browse...".
{width="700"}
1. In the Pop-up window, select "AsReaderBLESDK.IOS.dll" and "AsReaderSDK4.IOS.dll" and click the "Open" button.
{width="700"}
1. In the "References" window, select "AsReaderBLESDK.IOS.dll" and "AsReaderSDK4.IOS.dll" and click the "Select" button.
{width="700"}
1. After adding, "AsReaderBLESDK.IOS" and "AsReaderSDK4.IOS" will appear in "Assemblies".
{width="400"}
1. If you are using a multi-platform configuration, please change the library path referring to the figure below.
{width="700"}
## Adding Protocols
Add the supported protocols to `Info.plist`.
{width="700"}
## Adding Permissions
### Adding Bluetooth Usage Permission
Add the Bluetooth usage permission to `Info.plist`.
{width="700"}
---
# Using the SDK
## Importing the SDK
Import the SDK using the `using` statement in the class of the application that uses the SDK.
{width="700"}
## Inheriting the `AsReaderDeviceDelegate` Class
*It is recommended to create this in the iOS folder of Platforms.*
## Object Initialization
Initialize the AsReaderBarcodeDevice object
```cs
AsReaderBarcodeDevice asReaderBarcodeDevice = AsReaderBarcodeDevice.SharedInstance();
asReaderBarcodeDevice.DelegateBarcode = new AsReaderDockManagerBarcodeDelegate();
```
## Implementing Delegate Methods
### `Plugged` Method
```cs
public override void Plugged(bool plug)
{
if (plug)
{
//Connection Successful
}
else
{
//Disconnect
}
}
```
### `ReaderConnected` Method
```cs
public override void ReaderConnected(int status)
{
if (status == 0xff)
{
//Power ON
}
else
{
//Power OFF
}
}
```
### `ReceivedScanData` Method
```cs
public override void ReceivedScanData(NSData readData)
{
if (AsReaderInfo.SharedInstance().CurrentReaderMode == ReaderMode.Barcode)
{
NSString str = new NSString();
try
{
str = new NSString(readData, NSStringEncoding.ShiftJIS);
}
catch
{
try
{
str = new NSString(readData, NSStringEncoding.UTF8);
}
catch
{
try
{
str = new NSString(readData, NSStringEncoding.ASCIIStringEncoding);
}
catch
{
str = new NSString("Encoding Error");
}
}
}
}
}
```
### Power On
After receiving the connection success result in the `Plugged` method, call the method to turn the power On.
```cs
AsReaderDevice device = AsReaderRFIDDevice.SharedInstance();
device.SetReaderPowerWithPowerOnBeep(true, true, true, true, true, true, 0);
```
### Start Scan
```cs
_ = AsReaderBarcodeDevice.SharedInstance().StartScan;
```
The scan result is called back in the `ReceivedScanData` method.
### Stop Scan
```cs
_ = AsReaderBarcodeDevice.SharedInstance().StopScan;
```
### Power Off
```cs
AsReaderDevice device = AsReaderRFIDDevice.SharedInstance();
device.SetReaderPowerWithPowerOnBeep(false, true, true, true, true, true, 0);
```
---
# Changing the .Net Version
The demo application can only be used with the version of the tools that were used when it was built.
Example: If built with ".net MAUI 8", it can only be used with ".net MAUI 8". It cannot be used with ".net MAUI 7" or ".net MAUI 9".
The following is an example of how to change ".net MAUI 7" to ".net MAUI 8".
1. Right-click the Project -> Properties
{width="400"}
2. Under General -> Target .NET Runtime, select ".NET 8.0".
{width="500"}
3. Select the .csproj in the project folder and open it with an editor.
{width="500"}
4. Perform the following modification:
{width="900"}
`net7.0-ios`
↓
`net8.0-ios`
Add the following configuration:
```xml
true
8.0.3
true
```
Save the file after modification.
5. Reload the project after saving.
6. All the following projects must be modified Using steps 1-5 above.
{width="600"}
---
# Using the API
Please refer to the Objective-C SDK manual for information on using the API.
[AsReader SDK for iOS](https://asreader.com/download/SDK4/docs/sdk_docs/index.html#)