SocketMsgModel.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // SocketMsgModel.m
  3. // OneCable
  4. //
  5. // Created by KaRam Kim on 2017. 4. 20..
  6. // Copyright © 2017년 ntels. All rights reserved.
  7. //
  8. #import "SocketMsgModel.h"
  9. #define MSG_TYPE_KEY @"message_type"
  10. #define REQUEST_ID_KEY @"request_id"
  11. @implementation SocketRequestModel
  12. -(id)initWithMsgType:(NSString *)msgType
  13. {
  14. if (self = [super init]) {
  15. self.messageType = msgType;
  16. }
  17. return self;
  18. }
  19. //-(void)setRequestId:(int)requestId
  20. //{
  21. // NSLog(@"Request ID : %d", requestId);
  22. // self.requestId = [NSString stringWithFormat:@"%d", requestId];
  23. //}
  24. -(NSString *)getSendMessage
  25. {
  26. NSMutableDictionary *info = [[NSMutableDictionary alloc] initWithDictionary:_requestMsg];
  27. info[MSG_TYPE_KEY] = self.messageType;
  28. info[REQUEST_ID_KEY] = self.requestId;
  29. NSError *error;
  30. NSData *jsonData = [NSJSONSerialization dataWithJSONObject:info
  31. options:NSJSONWritingPrettyPrinted
  32. error:&error];
  33. NSString *result = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
  34. if (!error)
  35. {
  36. NSLog(@"Got an error: %@", error);
  37. }
  38. return result;
  39. }
  40. @end
  41. @implementation SocketReponseModel
  42. @end
  43. @implementation CommandModel
  44. @end
  45. @implementation SoKDeviceModel
  46. @end
  47. @implementation SoKDeviceWorkModel
  48. @end
  49. @implementation SoKNodeModel
  50. @end
  51. @implementation ContentModel
  52. @end
  53. @implementation ContentDeviceModel
  54. @end
  55. @implementation DeviceConnectionModel
  56. @end