Device
Device 은 HSP 에서 기본으로 제공하는 API로 별도의 설정 없이 사용 가능하다.
사용자는 Device 를 통해서 디바이스의 세부 정보, 설치되어 있는 BizApp 의 정보, 현재 연결되어 있는 네트워크의 정보, 마지막으로 Local 정보를 얻을 수 있다.
getDeviceInfo
getDeviceInfo 는 HSP 정보 및 iOS 단말에 대한 정보를 얻을 수 있으며 그 세 부내용은 하단의 표를 참조 한다.
Example
///////////////
// 3.10.18 이상
///////////////
let deviceAPI = DAPDevice()
let infoParam = DAPDeviceGetDeviceInfoParam()
deviceAPI.execute(with:infoParam, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이하
///////////////
let deviceAPI = DAPDevice()
let params = [Any]()
deviceAPI.execute(withActionName: "getDeviceInfo", params: params, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
// 3.10.18 이상
///////////////
let deviceAPI = DAPDevice()
let infoParam = DAPDeviceGetDeviceInfoParam()
deviceAPI.execute(with:infoParam, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이하
///////////////
let deviceAPI = DAPDevice()
let params = [Any]()
deviceAPI.execute(withActionName: "getDeviceInfo", params: params, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이상
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
DAPDeviceGetDeviceInfoParam *infoParam = [DAPDeviceGetDeviceInfoParam new];
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
ResultData *resultData = [ResultData resultDataWithType:@"textResultDlg" resultObject:[[resultDict objectForKey:kDeviceResult] firstObject]];
[self showSuccessDlgWithResultData:resultData];
} failure:^(NSError *error) {
[self showErrorDlgWithError:error];
}];
///////////////
// 3.10.18 이하
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
NSArray *params = [NSArray array];
[deviceAPI executeWithActionName:@"getDeviceInfo" params:params completion:^(NSDictionary *resultDict) {
NSLog(@"%s %d\nresultDict %@", __PRETTY_FUNCTION__, __LINE__, resultDict);
} failure:^(NSError *error) {
NSLog(@"%s %d\nerror %@", __PRETTY_FUNCTION__, __LINE__, error);
}];
// 3.10.18 이상
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
DAPDeviceGetDeviceInfoParam *infoParam = [DAPDeviceGetDeviceInfoParam new];
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
ResultData *resultData = [ResultData resultDataWithType:@"textResultDlg" resultObject:[[resultDict objectForKey:kDeviceResult] firstObject]];
[self showSuccessDlgWithResultData:resultData];
} failure:^(NSError *error) {
[self showErrorDlgWithError:error];
}];
///////////////
// 3.10.18 이하
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
NSArray *params = [NSArray array];
[deviceAPI executeWithActionName:@"getDeviceInfo" params:params completion:^(NSDictionary *resultDict) {
NSLog(@"%s %d\nresultDict %@", __PRETTY_FUNCTION__, __LINE__, resultDict);
} failure:^(NSError *error) {
NSLog(@"%s %d\nerror %@", __PRETTY_FUNCTION__, __LINE__, error);
}];
DeviceInfo
필드 | 설명 |
---|---|
첫번째 값 | api set version (예: 0.0.1) |
두번째 값 | 디바이스를 구별할 수 있는 유일한 ID값 (예: ab65507c2511a1df) |
세번째 값 | 디바이스 모델명 (예: iPhone6s) |
네번째 값 | 플랫폼명 (예: iOS) |
다섯번째 값 | 플랫폼 버전 (예: 2.6.4) |
여섯번째 값 | preConfiguration.json 내의 targetDeviceType 값 반환 (예: All) |
getAppInfo
getAppInfo 는 HSP 에 설치되어 있는 BizApp 목록을 전달 하며 그 세부 내용은 하단을 참조 한다.
Example
///////////////
// 3.10.18 이상
///////////////
let deviceAPI = DAPDevice()
let infoParam = DAPDeviceGetAppInfoParam()
deviceAPI.execute(with: infoParam, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이하
///////////////
let deviceAPI = DAPDevice()
let params = [Any]()
deviceAPI.execute(withActionName: "getappinfo", params: params, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
// 3.10.18 이상
///////////////
let deviceAPI = DAPDevice()
let infoParam = DAPDeviceGetAppInfoParam()
deviceAPI.execute(with: infoParam, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이하
///////////////
let deviceAPI = DAPDevice()
let params = [Any]()
deviceAPI.execute(withActionName: "getappinfo", params: params, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이상
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
DAPDeviceGetAppInfoParam *infoParam = [DAPDeviceGetAppInfoParam new];
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
ResultData *resultData = [ResultData resultDataWithType:@"textResultDlg" resultObject:[[resultDict objectForKey:kDeviceResult] JSONFragment]];
[self showSuccessDlgWithResultData:resultData];
} failure:^(NSError *error) {
[self showErrorDlgWithError:error];
}];
///////////////
// 3.10.18 이하
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
NSArray *params = [NSArray array];
[deviceAPI executeWithActionName:@"getAppInfo" params:params completion:^(NSDictionary *resultDict) {
NSLog(@"%s %d\nresultDict %@", __PRETTY_FUNCTION__, __LINE__, resultDict);
} failure:^(NSError *error) {
NSLog(@"%s %d\nerror %@", __PRETTY_FUNCTION__, __LINE__, error);
}];
// 3.10.18 이상
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
DAPDeviceGetAppInfoParam *infoParam = [DAPDeviceGetAppInfoParam new];
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
ResultData *resultData = [ResultData resultDataWithType:@"textResultDlg" resultObject:[[resultDict objectForKey:kDeviceResult] JSONFragment]];
[self showSuccessDlgWithResultData:resultData];
} failure:^(NSError *error) {
[self showErrorDlgWithError:error];
}];
///////////////
// 3.10.18 이하
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
NSArray *params = [NSArray array];
[deviceAPI executeWithActionName:@"getAppInfo" params:params completion:^(NSDictionary *resultDict) {
NSLog(@"%s %d\nresultDict %@", __PRETTY_FUNCTION__, __LINE__, resultDict);
} failure:^(NSError *error) {
NSLog(@"%s %d\nerror %@", __PRETTY_FUNCTION__, __LINE__, error);
}];
AppInfo
필드 | 필드 | 필드 | 설명 |
---|---|---|---|
appInfo | |||
app | 앱정보 | ||
version | 앱 버젼 (예: 1.5) | ||
appId | 앱 아이디 (예: HoneSmartPlatformDemo) | ||
launcherAppVersion | 런처앱버젼 (예: 1) | ||
bizapps | 비즈앱정보 | ||
bizappId | 비즈앱 아이디 (예: common) | ||
title | 비즈앱 타이틀 (예: Biz App Title) | ||
version | 비즈앱 버젼 (예: 1.0.0) | ||
getNetworkInfo
getNetworkInfo 는 현재 단말이 연결되어 있는 네트워크 정보를 전달 하여 보통 3G/4G 또는 Wi-Fi 등의 문자열을 JSONObject 에 "type" 키에 담아 반환 한다.
Example
///////////////
// 3.10.18 이상
///////////////
let deviceAPI = DAPDevice()
let infoParam = DAPDeviceGetNetworkInfoParam()
deviceAPI.execute(with:infoParam, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
self.showErrorDlg(error: error)
})
///////////////
// 3.10.18 이하
///////////////
let deviceAPI = DAPDevice()
let params = [Any]()
deviceAPI.execute(withActionName: "getnetworkinfo", params: params, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
// 3.10.18 이상
///////////////
let deviceAPI = DAPDevice()
let infoParam = DAPDeviceGetNetworkInfoParam()
deviceAPI.execute(with:infoParam, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
self.showErrorDlg(error: error)
})
///////////////
// 3.10.18 이하
///////////////
let deviceAPI = DAPDevice()
let params = [Any]()
deviceAPI.execute(withActionName: "getnetworkinfo", params: params, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이상
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
DAPDeviceGetNetworkInfoParam *infoParam = [DAPDeviceGetNetworkInfoParam new];
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
NSDictionary *infoDict = [[resultDict objectForKey:kDeviceResult] firstObject];
ResultData *resultData = [ResultData resultDataWithType:@"textResultDlg" resultObject:[infoDict objectForKey:@"type"]];
[self showSuccessDlgWithResultData:resultData];
} failure:^(NSError *error) {
[self showErrorDlgWithError:error];
}];
///////////////
// 3.10.18 이하
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
NSArray *params = [NSArray array];
[deviceAPI executeWithActionName:@"getNetworkInfo" params:params completion:^(NSDictionary *resultDict) {
NSLog(@"%s %d\nresultDict %@", __PRETTY_FUNCTION__, __LINE__, resultDict);
} failure:^(NSError *error) {
NSLog(@"%s %d\nerror %@", __PRETTY_FUNCTION__, __LINE__, error);
}];
// 3.10.18 이상
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
DAPDeviceGetNetworkInfoParam *infoParam = [DAPDeviceGetNetworkInfoParam new];
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
NSDictionary *infoDict = [[resultDict objectForKey:kDeviceResult] firstObject];
ResultData *resultData = [ResultData resultDataWithType:@"textResultDlg" resultObject:[infoDict objectForKey:@"type"]];
[self showSuccessDlgWithResultData:resultData];
} failure:^(NSError *error) {
[self showErrorDlgWithError:error];
}];
///////////////
// 3.10.18 이하
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
NSArray *params = [NSArray array];
[deviceAPI executeWithActionName:@"getNetworkInfo" params:params completion:^(NSDictionary *resultDict) {
NSLog(@"%s %d\nresultDict %@", __PRETTY_FUNCTION__, __LINE__, resultDict);
} failure:^(NSError *error) {
NSLog(@"%s %d\nerror %@", __PRETTY_FUNCTION__, __LINE__, error);
}];
ResultInfo
필드 | 설명 |
---|---|
type | None, Wi-Fi, 3G/4G, Unknown |
getLocale
getLocale 은 단말에서 현재 사용중인 언어 정보를 NSDictionary 에 "country", "language" 키에 담아 반환 한다.
Example
///////////////
// 3.10.18 이상
///////////////
let deviceAPI = DAPDevice()
let infoParam = DAPDeviceGetLocaleParam()
deviceAPI.execute(with: infoParam, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이하
///////////////
let deviceAPI = DAPDevice()
let params = [Any]()
deviceAPI.execute(withActionName: "getlocale", params: params, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
// 3.10.18 이상
///////////////
let deviceAPI = DAPDevice()
let infoParam = DAPDeviceGetLocaleParam()
deviceAPI.execute(with: infoParam, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이하
///////////////
let deviceAPI = DAPDevice()
let params = [Any]()
deviceAPI.execute(withActionName: "getlocale", params: params, completion: { (dict) in
guard let resultDict = dict as NSDictionary? else {
return
}
}, failure: { (resultError) in
guard let error = resultError else {
return
}
})
///////////////
// 3.10.18 이상
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
DAPDeviceGetLocaleParam *infoParam = [DAPDeviceGetLocaleParam new];
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
ResultData *resultData = [ResultData resultDataWithType:@"textResultDlg" resultObject:[resultDict objectForKey:kDeviceResult]];
resultData.dict = resultData.datas.firstObject;
[self showSuccessDlgWithResultData:resultData];
} failure:^(NSError *error) {
[self showErrorDlgWithError:error];
}];
///////////////
// 3.10.18 이하
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
NSArray *params = [NSArray array];
[deviceAPI executeWithActionName:@"getLocale" params:params completion:^(NSDictionary *resultDict) {
NSLog(@"%s %d\nresultDict %@", __PRETTY_FUNCTION__, __LINE__, resultDict);
} failure:^(NSError *error) {
NSLog(@"%s %d\nerror %@", __PRETTY_FUNCTION__, __LINE__, error);
}];
// 3.10.18 이상
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
DAPDeviceGetLocaleParam *infoParam = [DAPDeviceGetLocaleParam new];
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
ResultData *resultData = [ResultData resultDataWithType:@"textResultDlg" resultObject:[resultDict objectForKey:kDeviceResult]];
resultData.dict = resultData.datas.firstObject;
[self showSuccessDlgWithResultData:resultData];
} failure:^(NSError *error) {
[self showErrorDlgWithError:error];
}];
///////////////
// 3.10.18 이하
///////////////
DAPDeviceAPI *deviceAPI = [DAPDevice new];
NSArray *params = [NSArray array];
[deviceAPI executeWithActionName:@"getLocale" params:params completion:^(NSDictionary *resultDict) {
NSLog(@"%s %d\nresultDict %@", __PRETTY_FUNCTION__, __LINE__, resultDict);
} failure:^(NSError *error) {
NSLog(@"%s %d\nerror %@", __PRETTY_FUNCTION__, __LINE__, error);
}];