Infrared Remote Control SDK Integration

Integration Preparation

Description of Infrared SDK Resource Bundle

  • LMIrcodeImage.bundle: Image resource bundle
  • LMIrcodeLanguage.bundle: Multi-language resource bundle

SDK Integration

DragLMIrcodeFramework.framework, LMIrcodeImage.bundle and LMIrcodeLanguage.bundle into your project folder,as shown below:

Then confirm in the project'sTargets-General-Framework,Libraries,and Embedded Content has been referenced SDK,as shown below:

Required external dependencies

  • Need to import Aqara iOS basic library framework:LMFramework.framework.
  • Third-party framework dependencies (need to be imported via cocoapods or direct code import)
    • Network request AFNetworking version 3.2.0
    • Layout framework Masonry version 1.1.0
    • Network image loading framework SDWebImage version 5.9.1
    • tableView pull-to-refresh framework MJRefresh

SDK Initialization and Related API Description

Before jumping to the Infrared SDK page, the following configuration items need to be initialized. If not initialized, the default will be non-shared device and the integration channel will default to third-party App access.

  • isShareIrcode: Whether the current infrared device is a shared device
  • channelTypel : The current SDK integration channel

Initialization code example:

[[LMIrcodeConfig shared] updateConfigWithParams:@{ @"channelType": @(LMIrcodeChannelTypeAqaraHome), @"isShareIrcode": @(NO) }];
[[LMMessageCenter sharedInstance] postMsg:MsgCenterType_LMIrcodeModule msg:kFWMsgIrcodeControlViewPage param:@{@"gateway_device": self.device, @"sub_device": cellData.model} block:nil];

Common navigation method macro definitions:

Method Macro Definition Description
kFWMsgIrcodeControlViewPage Infrared control page
kFWMsgIrcodeDeviceTypeMatchViewPage Infrared add, remote control type selection page

Event monitoring

When in the SDK, you need to navigate to pages within the host App or implement some business logic of the host App.Events can be monitored through the following methods, and the infrared SDK will throw out the events.

In the host project, create a new event listener management class, for example: LumiMessageManager, and add the following methods:

+ (void)load{
    [super load];

    __block id observer = [[NSNotificationCenter defaultCenter]addObserverForName:UIApplicationDidFinishLaunchingNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
        [[LMMessageCenter sharedInstance] registerMsgCenterReceiver:[LumiMessageManager shared] type:MsgCenterType_Main];
        [[NSNotificationCenter defaultCenter] removeObserver:observer];
    }];
}

+ (instancetype)shared {
    static LumiMessageManager * aInstance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        aInstance = [[LumiMessageManager alloc] init];
    });
    return aInstance;
}

The monitoring method implementation example is as follows:

/// Infrared more settings page redirects to automation page
- (void)ir_to_automation_list_view_page:(id)param block:(void(^)(NSError *error, id result))block {

}

Event block parameter description: If the current logic processing needs to callback to the SDK, simply call the block.

Copyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2025-04-17 11:08:12

results matching ""

    No results matching ""