YAKDevice.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // MCDevice.h
  3. // MCKit
  4. //
  5. // Created by WengFei Wang on 21/05/2018
  6. // Copyright © 2018 WengFei Wang. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. /**
  11. Description For W311N only
  12. //you can use MPMusicPlayerController to make a simple music player or use AVFoundation or AVKit to make a better one
  13. - MCMediaStateMusicStart: start to play music
  14. - MCMediaStateMusicPause: pause play
  15. - MCMediaStateMusicContinue: continue play
  16. - MCMediaStateMusicStop: stop play music
  17. - MCMediaStateMusicSkipToNext: skip to next music
  18. - MCMediaStateMusicSkipToNextPrevious: skip to previous music
  19. //you can use you can use UIImagePickerController to make a camera or use AVFoundation to make a better one
  20. - MCMediaStateTakePicture: take picture
  21. - MCMediaStateStopTakePicture: stop take picture
  22. //Here you can remind user via play ringtone or vibration
  23. - MCMediaStateFindPhone : find phone
  24. */
  25. typedef NS_ENUM(NSUInteger, MCMediaState) {
  26. MCMediaStateMusicStart = 0,
  27. MCMediaStateMusicPause,
  28. MCMediaStateMusicContinue,
  29. MCMediaStateMusicStop,
  30. MCMediaStateMusicSkipToNext,
  31. MCMediaStateMusicSkipToNextPrevious,
  32. MCMediaStateTakePicture,
  33. MCMediaStateStopTakePicture,
  34. MCMediaStateFindPhone,
  35. };
  36. typedef NS_ENUM(NSInteger, MCDeviceType) {
  37. MCDeviceTypeW307N = 0x0100,
  38. MCDeviceTypeW311N = 0x0200,
  39. };
  40. /**
  41. MCDeviceDelegate Monitoring the state of Initialized Device
  42. */
  43. @protocol MCDeviceDelegate <NSObject>
  44. - (void)didInitializeDevice;
  45. @end
  46. @interface YAKDevice : NSObject
  47. /**
  48. peripheral.identifier.UUIDString
  49. */
  50. @property (nonatomic, readonly, copy) NSString *identifier;
  51. @property (nonatomic, copy) NSString *macString;
  52. /**
  53. peripheral name
  54. */
  55. @property (nonatomic, readonly, copy, nullable) NSString *name;
  56. /**
  57. peripheral localName
  58. */
  59. @property (nonatomic, copy, nullable) NSString *localName;
  60. /**
  61. discovered peripheral RSSI
  62. */
  63. @property (nonatomic, strong) NSNumber *discoveredRSSI;
  64. /**
  65. device battery Percentage
  66. */
  67. @property (nonatomic, readonly, assign) NSInteger batteryPercentage;
  68. /**
  69. device firmware Version
  70. */
  71. @property (nonatomic, readonly, copy) NSString *firmwareVersion;
  72. /**
  73. the state if peripheral
  74. */
  75. @property (nonatomic, readonly, assign, getter=isConnected) BOOL connected;
  76. /**
  77. the type of the device
  78. */
  79. @property (nonatomic, readonly, assign) MCDeviceType deviceType;
  80. /**
  81. is autoConnect?
  82. */
  83. @property (nonatomic, assign) BOOL autoConnect;
  84. @property (nonatomic, assign) BOOL hasVerificateConnect;
  85. @property (nonatomic, weak, nullable) id<MCDeviceDelegate>delegate;
  86. - (void)readRSSI:(void (^)(NSNumber *RSSINumber))response;
  87. @end
  88. NS_ASSUME_NONNULL_END