1.1.0 • Published 5 years ago

react-native-smokerlyzemodule v1.1.0

Weekly downloads
44
License
-
Repository
-
Last release
5 years ago

react-native-smokerlyzemodule

Getting started

$ npm install react-native-smokerlyzemodule --save

Mostly automatic installation

$ react-native link react-native-smokerlyzemodule

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-smokerlyzemodule and add RNSmokerlyzemodule.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNSmokerlyzemodule.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RNSmokerlyzemodulePackage; to the imports at the top of the file
  • Add new RNSmokerlyzemodulePackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-smokerlyzemodule'
    project(':react-native-smokerlyzemodule').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-smokerlyzemodule/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-smokerlyzemodule')

Windows

Read it! :D

  1. In Visual Studio add the RNSmokerlyzemodule.sln in node_modules/react-native-smokerlyzemodule/windows/RNSmokerlyzemodule.sln folder to their solution, reference from their app.
  2. Open up your MainPage.cs app
  • Add using Smokerlyzemodule.RNSmokerlyzemodule; to the usings at the top of the file
  • Add new RNSmokerlyzemodulePackage() to the List<IReactPackage> returned by the Packages method

Usage

import {SmokerlyzeModule,EventSmokerlyze} from 'react-native-smokerlyzemodule';
/***********/
//khoi tao ,chay thiet bi
SmokerlyzeModule.Init().then((res)=>console.log(res));
	

//khai báo đăng kí nhận event đã cắm jack audio vào:
EventSmokerlyze.OnPlugin(event=>{console.log("data",event);}); // bool event.ready: true/false	
		
/************/		
//sau khi khoi tao xong thì sẽ đợi khoảng 5 giay thì nhận được event thiết bị đã sẵn sàng :OnDeviceReady:
//khai báo đăng kí nhận event:
EventSmokerlyze.OnDeviceReady(event=>{console.log("Ready to test",event);}); // bool event.ready: true/false



/************/
// sau khi thiết bị đã sẵn sàng thì bắt đầu test:
		SmokerlyzeModule.StartTest().then(res=>console.log(res));
		
/**************/		
// sau khi da bắt đầu test thành công, thì ta sẽ nhận được event OnStartTest
EventSmokerlyze.OnStartTest(event=>{console.log("startCountDown (bat dau hit vao)",event);});//bắt đầu giai đoạn chờ hít vào vao :(int) event.time: số miligiay đợi để tới giai đoạn thở ra


/**********/
// sau khi đã hết thời gian hít vào thì event OnStartBlew sẽ đc kích hoặt : (int) event.time: trả về khoảng thời gian để thổi hơi ra
EventSmokerlyze.OnStartBlew(event=>{console.log("StartTest (bat dau thoi)",event);});//bắt đầu giai đoạn đang thổi ra



/************/
// OnDeviceProgress: cập nhật dữ liệu khi đang test
EventSmokerlyze.OnProgress(event=>{console.log("Progress",event);});//du lieu trong giai doan thoi ra: (double) event.progress   : value: 0-700,  event.ppm : chi so ppm


/**************/
//khi ket thuc thì sẽ kích hoặt event FinishTest
EventSmokerlyze.OnFinishTest(event=>{console.log("FinishTest (Da thoi xong)",event);});//ket thuc test 

/***********/
//để dừng việc test lại:
EventSmokerlyze.StopTest().then(res=>console.log(res));// res: true


/***********/
//Remove event đã đăng kí:
EventSmokerlyze.RemoveOnDeviceReady();
EventSmokerlyze.RemoveEventStartTest();
EventSmokerlyze.RemoveEventStartBlew();
EventSmokerlyze.RemoveEventProgress();
EventSmokerlyze.RemoveEventFinishTest();
		
//add Permissions
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
	
<uses-permission android:name="android.permission.RECORD_AUDIO" />  
<uses-permission android:name="android.permission.READ_PHONE_STATE" />  
1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago