Code Monkey home page Code Monkey logo

zhoujin960157994 / telinksigmeshlib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thanhtunguet/telinksigmeshlib

0.0 0.0 0.0 7.26 MB

This library is a part of Telink Sig Mesh SDK. Published to GitHub for personal usage only. Visit the Telink Wiki to acquire the full SDK zip file and development handbooks.

Home Page: http://wiki.telink-semi.cn/wiki/chip-series/TLSR825x-Series/

Shell 0.09% Objective-C 53.87% C 46.01% Makefile 0.01% Ruby 0.01%

telinksigmeshlib's Introduction

TelinkSigMeshLib

version: v3.3.2

About

The TelinkSigMeshLib library allows to provision、keybind and send messages to Bluetooth Mesh devices.

Bluetooth Mesh specification may be found here: https://www.bluetooth.com/specifications/mesh-specifications/

The library is compatible with version 1.0.1 of the Bluetooth Mesh Profile Specification.

Sample app

The sample application demonstrates how to use the library.

Supported features

  1. GATT provisioning with no oob devices and static oob devices that available in Bluetooth Mesh Profile 1.0.1.
  2. Fast provisioning with no oob devices that avilable the telink private protocol.
  3. Normal keybind:connect node -> read servers -> open notify -> set filter -> get composition -> appkey add -> bind model to appkey.
  4. Fast keybind(Default Bound, node need avilable the telink private protocol):connect node -> read servers -> open notify -> set filter -> appkey add.
  5. Control node with unicastAddress and groupAddress:onoff,light,temperature,level,HSL.
  6. Setting and clearing publication to a Model.
  7. Setting and removing subscriptions to a Model.
  8. Add node to group and delete node from group.
  9. Add LPN node.
  10. GATT OTA: nodes need avilable the telink private protocol.
  11. Scheduler models.
  12. Scene models.
  13. Proxy Filter.

Requirements

  • Xcode 11.0 or newer.
  • An iOS 9.0 or newer device with BLE capabilities.

Setting up the library

  • copy folder TelinkSigMeshLib to your project, then Link Binary With Libraries the TelinkSigMeshLib.framework.

Open API

    1. Start SDK.
[SDKLibCommand startMeshSDK];
    1. Set SDK log level.
[SigLogger.share setSDKLogLevel:SigLogLevelDebug];
    1. GATT add nodes API1 (auto add)
- (void)startAddDeviceWithNextAddress:(UInt16)address networkKey:(NSData *)networkKey netkeyIndex:(UInt16)netkeyIndex appkeyModel:(SigAppkeyModel *)appkeyModel unicastAddress:(UInt16)unicastAddress uuid:(nullable NSData *)uuid keyBindType:(KeyBindTpye)type productID:(UInt16)productID cpsData:(nullable NSData *)cpsData isAutoAddNextDevice:(BOOL)isAuto provisionSuccess:(addDevice_prvisionSuccessCallBack)provisionSuccess provisionFail:(ErrorBlock)provisionFail keyBindSuccess:(addDevice_keyBindSuccessCallBack)keyBindSuccess keyBindFail:(ErrorBlock)keyBindFail finish:(AddDeviceFinishCallBack)finish;
    1. GATT add node API2 (single add)
- (void)startAddDeviceWithNextAddress:(UInt16)address networkKey:(NSData *)networkKey netkeyIndex:(UInt16)netkeyIndex appkeyModel:(SigAppkeyModel *)appkeyModel peripheral:(CBPeripheral *)peripheral provisionType:(ProvisionTpye)provisionType staticOOBData:(nullable NSData *)staticOOBData keyBindType:(KeyBindTpye)type productID:(UInt16)productID cpsData:(nullable NSData *)cpsData provisionSuccess:(addDevice_prvisionSuccessCallBack)provisionSuccess provisionFail:(ErrorBlock)provisionFail keyBindSuccess:(addDevice_keyBindSuccessCallBack)keyBindSuccess keyBindFail:(ErrorBlock)keyBindFail;
    1. GATT add node API3: simple api (single add)
- (void)startAddDeviceWithSigAddConfigModel:(SigAddConfigModel *)configModel provisionSuccess:(addDevice_prvisionSuccessCallBack)provisionSuccess provisionFail:(ErrorBlock)provisionFail keyBindSuccess:(addDevice_keyBindSuccessCallBack)keyBindSuccess keyBindFail:(ErrorBlock)keyBindFail;
    1. Add nodes by fast provision
- (void)startFastProvisionWithProvisionAddress:(UInt16)provisionAddress productId:(UInt16)productId compositionData:(NSData *)compositionData currentConnectedNodeIsUnprovisioned:(BOOL)unprovisioned addSingleDeviceSuccessCallback:(AddSingleDeviceSuccessOfFastProvisionCallBack)singleSuccess finish:(ErrorBlock)finish;
    1. Start connect mesh network(this api will retry connect action every 5 seconds unless connect success or call stopMeshConnectWithComplete:)
- (void)startMeshConnectWithComplete:(nullable startMeshConnectResultBlock)complete;
    1. Stop connect mesh network
- (void)stopMeshConnectWithComplete:(nullable stopMeshConnectResultBlock)complete;
    1. Control node: OnOffSet(more control api in SDKLibCommand)
+ (SigMessageHandle *)genericOnOffSetWithDestination:(UInt16)destination isOn:(BOOL)isOn retryCount:(NSInteger)retryCount responseMaxCount:(NSInteger)responseMaxCount ack:(BOOL)ack successCallback:(responseGenericOnOffStatusMessageBlock)successCallback resultCallback:(resultBlock)resultCallback;
    1. Send ini command API1(api reference c-lib SDK, iniData like "a3ff000000000200ffffc21102c4020100".)
+ (nullable NSError *)sendOpINIData:(NSData *)iniData successCallback:(responseAllMessageBlock)successCallback resultCallback:(resultBlock)resultCallback;
    1. Send ini command API2
+ (nullable NSError *)sendIniCommandModel:(IniCommandModel *)model successCallback:(responseAllMessageBlock)successCallback resultCallback:(resultBlock)resultCallback;
    1. Message's live from TelinkSigMeshLib(developer need set SigMeshLib.share.delegateForDeveloper = self;)

12.1. APP did Receive Message from node.

- (void)didReceiveMessage:(SigMeshMessage *)message sentFromSource:(UInt16)source toDestination:(UInt16)destination;

12.2. APP did Send Message to node.

- (void)didSendMessage:(SigMeshMessage *)message fromLocalElement:(SigElementModel *)localElement toDestination:(UInt16)destination;

12.3. APP failed To Send Message.

- (void)failedToSendMessage:(SigMeshMessage *)message fromLocalElement:(SigElementModel *)localElement toDestination:(UInt16)destination error:(NSError *)error;

12.4. APP did Receive SigProxyConfiguration Message from node.

- (void)didReceiveSigProxyConfigurationMessage:(SigProxyConfigurationMessage *)message sentFromSource:(UInt16)source toDestination:(UInt16)destination;

SigMesh iOS SDK of Telink Semiconductor (Shanghai) Co., Ltd.

telinksigmeshlib's People

Contributors

thanhtunguet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.