network


network 는 HSP 에서 기본으로 제공하는 API로 별도의 설정 없이 사용 가능하다.
network HSP 의 Operation 또는 Hub 와 통신을 쉽게 사용하기 위해서 만들어졌으며 서버와 주고 받는 데이터는 json 정보로 전달할 수 있다.


doPost

doPost 은 POST 형식으로 HSP의 Operation 또는 Hub 에 데이터를 전달한다.

options

필드필드설명M/O
context 서버로 데이터 전송에 필요한 정보M
targetName서버이름, OP가 미리 정의되어 있어야 함M
serviceCategory서비스 카테고리M
serviceName서비스 이름M
message Header 와 Playload 로 구성되며 서버로 전송되는 실제 패킷.
개발 시에는 서버와 비즈앱 간의 합의된 규격서를 기반으로 작성된다. 
O
header패킷 공통 정보O
payload전송 데이터O
    

Example

let context = [
   "targetName": "hub1",
   "serviceCategory": "notice",
   "serviceName": "getNotice"
]
let message = [
   "header": [:],
   "payload": [
        "pageNumber": "1",
       "rowsPerPage": "10"
]
]
DAPNetwork.doPost(context, message: message, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
NSDictionary *context = @{ @"targetName" : @"hub1",
                          @"serviceCategory" : @"notice",
                          @"serviceName" : @"getNotice" };
NSDictionary *message = @{ @"header" : @{},
                          @"payload" : @{ @"pageNumber" : @"1",
                                          @"rowsPerPage" : @"10"} };
[DAPNetwork doPost:context message:message completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

doUpload

doUpload 은 HSP의 Hub 에 파일 업로드를 요청한다.

options

필드필드설명M/O
context 서버로 데이터 전송에 필요한 정보M
targetName서버이름, OP가 미리 정의되어 있어야 함M
serviceCategory서비스 카테고리M
serviceName서비스 이름M
message Header 와 Playload 로 구성되며 서버로 전송되는 실제 패킷.
개발 시에는 서버와 비즈앱 간의 합의된 규격서를 기반으로 작성된다. 
M
header패킷 공통 정보O
payload전송 데이터M
    

Example

let context = [
   "targetName": "hub1",
   "serviceCategory": "util",
   "serviceName": "fileUpload"
]
let message = [
   "header": [:],
   "payload": ["files": ["icon.png"]]
]

DAPNetwork.doUpload(context, message: message, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
NSDictionary *context = @{ @"targetName" : @"hub1",
                          @"serviceCategory" : @"util",
                          @"serviceName" : @"fileUpload" };
NSDictionary *message = @{ @"header" : @{},
                          @"payload" : @{@"files" : @[@"icon.png"]} };

[DAPNetwork doUpload:context message:message completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

doDownload

doDownload 는 HSP 의 Hub 에 파일 다운로드를 요청 한다. 

options

필드필드설명M/O
context 서버로 데이터 전송에 필요한 정보M
targetName서버이름, OP가 미리 정의되어 있어야 함M
serviceCategory서비스 카테고리M
serviceName서비스 이름M
message Header 와 Playload 로 구성되며 서버로 전송되는 실제 패킷.
개발 시에는 서버와 비즈앱 간의 합의된 규격서를 기반으로 작성된다. 
M
header패킷 공통 정보O
payload전송 데이터M
    

Example

let context = [
   "targetName": "hub1",
   "serviceCategory": "util",
   "serviceName": "fileDownload"
]
let message = [
   "header": [:],
   "payload": ["files": ["icon.png"]]
]

DAPNetwork.doDownload(context, message: message, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
NSDictionary *context = @{ @"targetName" : @"hub1",
                          @"serviceCategory" : @"util",
                          @"serviceName" : @"fileDownload" };

NSArray *files = [NSArray arrayWithObjects:@"icon.png", nil];
NSDictionary *message = @{ @"header" : @{},
                          @"payload" : @{@"files" : files} };

[DAPNetwork doDownload:context message:message completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

doUploadWithProgress

doUploadWithProgress 는 HSP 의 Hub 에 파일 업로드를 요청하면서 진행 상황을 전달 받는다. 

options

필드필드설명M/O
context 서버로 데이터 전송에 필요한 정보M
targetName서버이름, OP가 미리 정의되어 있어야 함M
serviceCategory서비스 카테고리M
serviceName서비스 이름M
message Header 와 Playload 로 구성되며 서버로 전송되는 실제 패킷.
개발 시에는 서버와 비즈앱 간의 합의된 규격서를 기반으로 작성된다. 
M
header패킷 공통 정보O
payload전송 데이터M
    

Example

HMPProgressManager.shared().useCustom(withShowLoading: { title, message in
}, hideLoading: {
}, showProgress: { title, message in
}, hideProgress: {
}, updateProgress: { infoDict in
   print("update progress info : \(infoDict)")
}, installProgress: { infoDict in
   print("install progress info : \(infoDict)")
})

let context = [
   "targetName": "hub1",
   "serviceCategory": "util",
   "serviceName": "fileUpload"
]
let message = [
   "header": [:],
   "payload": ["files": ["icon.png"]]
]

DAPNetwork.doUpload(context, message: message, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
[[HMPProgressManager sharedProgressManager] useCustomWithShowLoading:^(NSString *title, NSString *message) {    
} hideLoading:^{
} showProgress:^(NSString *title, NSString *message) {    
} hideProgress:^{
} updateProgress:^(NSDictionary *infoDict) {    
    NSLog(@"update progress info : %@", infoDict);
} installProgress:^(NSDictionary *infoDict) {
    NSLog(@"install progress info : %@", infoDict);
}];

NSDictionary *context = @{ @"targetName" : @"hub1",
                          @"serviceCategory" : @"util",
                          @"serviceName" : @"fileUpload" };
NSDictionary *message = @{ @"header" : @{},
                          @"payload" : @{@"files" : @[@"icon.png"]} };

[DAPNetwork doUpload:context message:message completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

doDownloadWithProgress

doDownloadWithProgress 는 HSP 의 Hub 에 파일 다운로드를 요청 하면서 진행 상황을 전달 받는다. 

options

필드필드설명M/O
context 서버로 데이터 전송에 필요한 정보M
targetName서버이름, OP가 미리 정의되어 있어야 함M
serviceCategory서비스 카테고리M
serviceName서비스 이름M
message Header 와 Playload 로 구성되며 서버로 전송되는 실제 패킷.
개발 시에는 서버와 비즈앱 간의 합의된 규격서를 기반으로 작성된다. 
M
header패킷 공통 정보O
payload전송 데이터M
    

Example

HMPProgressManager.shared().useCustom(withShowLoading: { title, message in
}, hideLoading: {
}, showProgress: { title, message in
}, hideProgress: {
}, updateProgress: { infoDict in
   print("update progress info : \(infoDict)")
}, installProgress: { infoDict in
   print("install progress info : \(infoDict)")
})

let context = [
   "targetName": "hub1",
   "serviceCategory": "util",
   "serviceName": "fileDownload"
]
let message = [
   "header": [:],
   "payload": ["files" : ["icon.png"]]
]

DAPNetwork.doDownload(context, message: message, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
[[HMPProgressManager sharedProgressManager] useCustomWithShowLoading:^(NSString *title, NSString *message) {    
} hideLoading:^{
} showProgress:^(NSString *title, NSString *message) {    
} hideProgress:^{
} updateProgress:^(NSDictionary *infoDict) {    
    NSLog(@"update progress info : %@", infoDict);
} installProgress:^(NSDictionary *infoDict) {
    NSLog(@"install progress info : %@", infoDict);
}];

NSDictionary *context = @{ @"targetName" : @"hub1",
                          @"serviceCategory" : @"util",
                          @"serviceName" : @"fileDownload" };

NSArray *files = [NSArray arrayWithObjects:@"icon.png", nil];
NSDictionary *message = @{ @"header" : @{},
                          @"payload" : @{ @"files" : files } };

[DAPNetwork doDownload:context message:message completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

Error Code

CodeCauseComment
E10600파라메터 값이 잘못되어 있을 경우 
E10601전달된 액션 값이 알 수 없는 액션일 경우 
E10602서버로 데이터 전송에 필요한 정보가 잘못되어 있을 경우 
E10603서버로 전송되는 실제 패킷 정보가 잘못되어 있을 경우 
E10604서버 이름이 잘못되어 있을 경우 
E10605서비스 카테고리가 잘못되어 있을 경우 
E10606서비스 이름이 잘못되어 있을 경우 
E10607전송 데이터가 잘못되어 있을 경우 
E10608업로드할 파일 정보가 잘못되어 있을 경우 
E10650실행 중 오류가 발생 되었을 경우 
E10651실행 중 업로드할 파일이 존재하지 않을 경우  
E10652서버로 부터 전달받은 응답 메시지가 없는 경우 
E10653서버로 부터 전달받은 응답 메시지가 잘못되어 있는 경우 
E10699알 수 없는 오류가 발생 되었을 경우