Features of Travel SDK

Last Updated on : 2024-03-25 07:08:38download

Travel SDK serves your development as an extension of Smart Life App SDK. Before you integrate the Travel SDK, implement the device control feature on top of the Smart Life App SDK.

Travel devices classes

Class name (protocol name) Description
ThingSmartDevice (ThingSmartOutdoor) Travel SDK extension class related to devices
ThingSmartOutdoorDeviceListService Data service to process the device list
ThingSmartSchemaModel (ThingSmartOutdoor) Travel SDK extension class related to data points (DPs)

Send DP data for device control

The SDK encapsulates the DP data sending methods of the parent class ThingSmartDevice and supports the advanced logic programming language to check whether device DPs are supported.

API description

- (void)tsod_publishDPWithCode:(NSString *)code
                       DPValue:(id)DPValue
                       success:(nullable ThingSuccessHandler)success
                       failure:(nullable ThingFailureError)failure;

Parameters

Parameter Description
code The value of dpCode that identifies a device DP.
dpValue The DP data to be sent. It is the raw data and does not require data conversion.
success The success callback.
failure The failure callback.

Get device DP model details

API description

- (ThingSmartSchemaModel *)tsod_schemaMWithCode:(NSString *)code;

Parameters

Parameter Description
code The value of dpCode to be sent.

Get HD device image

API description

- (void)requestProductIconWithDeviceIDList:(NSSet<NSString *> *)deviceIDList
                                   success:(void(^)(NSDictionary<NSString *, ThingSmartOutdoorProductIconModel *> *productIconMap))success
                                   failure:(void(^__nullable)(NSError * error))failure;

Parameters

Parameter Description
deviceIDList The list of device IDs.
success The success callback.
failure The failure callback.

Data model of ThingSmartOutdoorProductIconModel

Parameter Description
icon The high-definition (HD) device image with dimensions of 800 × 800 pixels.

Get device hardware details

API description

- (void)requestHardwareWithDeviceID:(NSString *)deviceID
                            success:(void(^)(ThingSmartOutdoorDeviceHardwareModel *hardwareModel))success
                            failure:(void(^)(NSError *error))failure;

Parameters

Parameter Description
deviceID The device ID.
success The success callback.
failure The failure callback.

Data model of ThingSmartOutdoorDeviceHardwareModel

Parameter Description
chassisNo The vehicle identification number.
activeTime The time when a device is activated.
productModel The device model.

Cycling navigation

Get cycling route details and report cycling routes of Bluetooth vehicles. The following classes are supported.

Class name Description
ThingSmartOutdoorCycleRecordModel Model of cycling route data
ThingSmartOutdoorLocationUploadModel Model of cycling routes reported by Bluetooth devices
ThingSmartOutdoorCyclingService Cycling API

Get the list of routes

API description

- (void)requestTripTrackWithDeviceId:(NSString *)devId
                        size:(NSInteger)size
                        completion:(void (^)(NSArray<ThingSmartOutdoorCycleRecordModel *> *records, NSError *error))completion;

Parameters

Parameter Description
devId The device ID.
size The number of entries to be returned in this call.
completion The callback.

Data model of ThingSmartOutdoorCycleRecordModel

Field Type Description
mileageUnitType NSString The unit. Default value: km.
speed Double The average speed.
mileage Double The total amount of mileage per cycling route.
battery Double The amount of power consumption.
duration Double The duration of a route.
bufferFlag Int The amount of power consumption.
startTime Double The start time of a route.
endTime Double The end time of a route.
savingCarbonData Double The carbon data. A negative value means invalid.

Get route statistics

API description

- (void)requestTripTrackStatisticWithDeviceId:(NSString *)devId
                                    startTime:(double)startTime
                                      endTime:(double)endTime
                                   completion:(void (^)(ThingSmartOutdoorCycleRecordModel *record, NSError *error))completion;

Parameters

Parameter Description
devId The device ID.
startTime The start time of a route.
endTime The end time of a route.
completion The callback.

Report cycling routes by Bluetooth devices

API description

- (void)uploadLocatonWithDeviceId:(NSString *)devId
                        productId:(NSString *)pid
                    uploadModel:(ThingSmartOutdoorLocationUploadModel *)uploadModel
                     completion:(void (^)(BOOL success, NSError *error))completion;

Parameters

Parameter Description
devId The device ID.
pid The product ID of the device. You can get the value from deviceModel.
uploadModel The reported data.
completion The callback.

Data model of ThingSmartOutdoorLocationUploadModel

Field Type Description
coord CLLocationCoordinate2D The coordinates of a location.
speed Double The current speed.
mileage Double The current amount of mileage.
started BOOL The startup status of the vehicle. If false is reported, it means the end of the route.
batteryValue Double The current battery level.

Offline stores

Class name Description
ThingSmartOutdoorStoreRequestModel Search stores within a geographical scope specified by a radius
ThingSmartOutdoorStorePageRequestModel Search stores by keyword with results returned on pages
ThingSmartOutdoorStoreModel Model of store data
ThingSmartOutdoorStoreService Store API

Search stores within geographical scope specified by radius

API description

- (void)requestStoreWithParams:(ThingSmartOutdoorStoreRequestModel *)params
                    completion:(void (^)(NSArray<ThingSmartOutdoorStoreModel*> *storeList, NSError *error))completion;

Parameters

Parameter Description
params The request data model.
completion The callback.

Data model of ThingSmartOutdoorStoreRequestModel

Field Type Description
coordType NSString The type of coordinates. Valid values:
  • WGS84: Google Maps
  • GCJ02: AutoNavi
  • BD09LL: Baidu Maps
latitude Double The latitude.
longitiude Double The longitude.
radius NSInteger The radius of the geolocational scope. Unit: km.
max NSInteger The maximum number of entries to be returned. Default value: 100.

Data model of ThingSmartOutdoorStoreModel

Field Type Description
identifier NSString The store ID.
coverUrl NSString The image of the store.
vendername NSString The name of the store.
address NSString The address of the store.
phoneNumber NSString The contact phone of the store.
coordType NSString The type of coordinates. Valid values:
  • WGS84: Google Maps
  • GCJ02: AutoNavi
  • BD09LL: Baidu Maps
distance NSInteger The distance from the store to the current location.
latitude Double The latitude.
longitiude Double The longitude.

Search stores by keyword with results returned on pages

API description

- (void)requestStorePagesWithParams:(ThingSmartOutdoorStorePageRequestModel *)params
                         completion:(void (^)(NSArray<ThingSmartOutdoorStoreModel*> *storeList, NSError *error))completion;

Parameters

Parameter Description
params The request data model.
completion The callback.

Data model of ThingSmartOutdoorStorePageRequestModel

Field Type Description
coordType NSString The type of coordinates. Valid values:
  • WGS84: Google Maps
  • GCJ02: AutoNavi
  • BD09LL: Baidu Maps
latitude Double The latitude.
longitiude Double The longitude.
keyword NSString The search keyword.
pageIndex NSInteger The index for paged query.
pageSize NSInteger The maximum number of entries returned on each page.