English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Travel Features

Last Updated on : 2022-04-13 02:11:57download

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
TuyaSmartDevice (TuyaSmartOutdoor) Travel SDK extension class related to devices
TuyaSmartOutdoorDeviceListService Data service to process the device list
TuyaSmartSchemaModel (TuyaSmartOutdoor) 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 TuyaSmartDevice and supports the advanced logic programming language to check whether device DPs are supported.

API description

- (void)tyod_publishDPWithCode:(NSString *)code
                       DPValue:(id)DPValue
                       success:(nullable TYSuccessHandler)success
                       failure:(nullable TYFailureError)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

- (TuyaSmartSchemaModel *)tyod_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 *, TuyaSmartOutdoorProductIconModel *> *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 TuyaSmartOutdoorProductIconModel

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(^)(TuyaSmartOutdoorDeviceHardwareModel *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 TuyaSmartOutdoorDeviceHardwareModel

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
TuyaSmartOutdoorCycleRecordModel Model of cycling route data
TuyaSmartOutdoorLocationUploadModel Model of cycling routes reported by Bluetooth devices
TuyaSmartOutdoorCyclingService Cycling API

Get the list of routes

API description

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

Parameters

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

Data model of TuyaSmartOutdoorCycleRecordModel

Field Data 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.
startTime Double The start time of a route.
endTime Double The end time of a route.

Get route statistics

API description

- (void)requestTripTrackStatisticWithDeviceId:(NSString *)devId
                                    startTime:(double)startTime
                                      endTime:(double)endTime
                                   completion:(void (^)(TuyaSmartOutdoorCycleRecordModel *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:(TuyaSmartOutdoorLocationUploadModel *)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 TuyaSmartOutdoorLocationUploadModel

Field Data 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
TuyaSmartOutdoorStoreRequestModel Search stores within a geographical scope specified by a radius
TuyaSmartOutdoorStorePageRequestModel Search stores by keyword with results returned on pages
TuyaSmartOutdoorStoreModel Model of store data
TuyaSmartOutdoorStoreService Store API

Search stores within geographical scope specified by radius

API description

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

Parameters

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

Data model of TuyaSmartOutdoorStoreRequestModel

Field Data 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 TuyaSmartOutdoorStoreModel

Field Data type Description
identifier NSString The store ID.
coverUrl NSString The image of the store.
vendorname 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:(TuyaSmartOutdoorStorePageRequestModel *)params
                         completion:(void (^)(NSArray<TuyaSmartOutdoorStoreModel*> *storeList, NSError *error))completion;

Parameters

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

Data model of TuyaSmartOutdoorStorePageRequestModel

Field Data 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.