| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- //
- // SocketMsgModel.m
- // OneCable
- //
- // Created by KaRam Kim on 2017. 4. 20..
- // Copyright © 2017년 ntels. All rights reserved.
- //
- #import "SocketMsgModel.h"
- #define MSG_TYPE_KEY @"message_type"
- #define REQUEST_ID_KEY @"request_id"
- @implementation SocketRequestModel
- -(id)initWithMsgType:(NSString *)msgType
- {
- if (self = [super init]) {
- self.messageType = msgType;
- }
- return self;
- }
- //-(void)setRequestId:(int)requestId
- //{
- // NSLog(@"Request ID : %d", requestId);
- // self.requestId = [NSString stringWithFormat:@"%d", requestId];
- //}
- -(NSString *)getSendMessage
- {
- NSMutableDictionary *info = [[NSMutableDictionary alloc] initWithDictionary:_requestMsg];
- info[MSG_TYPE_KEY] = self.messageType;
- info[REQUEST_ID_KEY] = self.requestId;
- NSError *error;
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:info
- options:NSJSONWritingPrettyPrinted
- error:&error];
-
-
- NSString *result = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
- if (!error)
- {
- NSLog(@"Got an error: %@", error);
- }
-
- return result;
- }
- @end
- @implementation SocketReponseModel
- @end
- @implementation CommandModel
- @end
- @implementation SoKDeviceModel
- @end
- @implementation SoKNodeModel
- @end
- @implementation ContentModel
- @end
|