Mobile SDK
iOS
Device Management
12 min
listing available miura devices let devices = toro bluetoothmiuradevices this will return a list of eaaccessory instances that are available to use with the torosdk for a device to be listed, it will need to be showing as connected in the ios bluetooth settings selecting a device to select the device you want to use for transactions and device management operations, set the selecteddevice property on your toroclient instance toro selecteddevice = device // where device is an eaaccessory instance to unset the selected device, set the selecteddevice to nil toro selecteddevice = nil getting device information you can get information about the selected device using the getdeviceinfo method on the toroclient instance toro getdeviceinfo { result in switch result { case success(let deviceinfo) self deviceinfo = deviceinfo case failure(let error) self errormessage = error localizeddescription } } this will return a miuradeviceinfo object containing information about the selected device, such as its serial number, system time, battery status, etc device session state you can check if the device is currently in use by the toro sdk using the issessionopen property on the toroclient instance toro issessionopen this will return true if the device is currently in use, and false otherwise reset device to known state as the toro sdk has been built to support mpi v1 68, and os v9 7, software updates are not supported over the air at present it may well be the case that the sdk works with newer (or older) versions of the mpi and os, but this is not guaranteed if you want or need to reset the miura device to toro sdk compatible os and mpi, you can use the below functions os reset toro resetdeviceos { result in switch result { case success logger d("os reset successful") case failure(let error) logger e("os reset failed \\(error)") } } mpi reset toro resetdevicempi { result in switch result { case success logger d("mpi reset successful") case failure(let error) logger e("mpi reset failed \\(error)") } } configuration file reset toro resetdeviceconfig { result in switch result { case success logger d("config reset successful") case failure(let error) logger e("config reset failed \\(error)") } } note that resetdeviceconfig() will use defaults the sdk ships with, rather than contacting the terminal management system (tms) to get the latest configuration files security and configuration updates your application should make periodic contact with the terminal management system (tms) to get the latest configuration files and security parameters the sdk does not do this automatically, to avoid performing updates at inappropriate times to check if there are any updates available, you can use the checkfordeviceupdates method on the toroclient instance toro checkfordeviceupdates { result in switch result { case success(let updates) logger d("\\(updates count) updates available") case failure(let error) logger e("update error \\(error)") } } when an update becomes available, you can execute it using the executedeviceupdate method when appropriate toro executedeviceupdate(update update) { result in switch result { case success logger d("\\(update type) executed successfully") case failure(let error) logger e("update error \\(error)") } } we recommend setting up a recurring job to check for updates, as well as on every app launch or when a device is selected
