Devel há 3 anos atrás
pai
commit
05f702fd65

+ 8 - 8
android/src/main/java/com/melihyarikkaya/rnserialport/RNSerialportModule.java

@@ -86,8 +86,8 @@ public class RNSerialportModule extends ReactContextBaseJavaModule {
   private int STOP_BIT     = UsbSerialInterface.STOP_BITS_1;
   private int PARITY       =  UsbSerialInterface.PARITY_NONE;
   private int FLOW_CONTROL = UsbSerialInterface.FLOW_CONTROL_OFF;
-  private boolean FLOW_CONTROL_RTS_CTS = false;
-  private boolean FLOW_CONTROL_DSR_DTR = false;
+  private boolean FLOW_CONTROL_RTS = false;
+  private boolean FLOW_CONTROL_DTR = false;
   private int BAUD_RATE = 9600;
 
 
@@ -204,14 +204,14 @@ public class RNSerialportModule extends ReactContextBaseJavaModule {
     this.FLOW_CONTROL = FLOW_CONTROL;
   }
   @ReactMethod
-  public void setRTS(boolean FLOW_CONTROL_RTS_CTS) {
-    this.FLOW_CONTROL_RTS_CTS = FLOW_CONTROL_RTS_CTS;
-    serialPort.setRTS(FLOW_CONTROL_RTS_CTS);
+  public void setRTS(boolean FLOW_CONTROL_RTS) {
+    this.FLOW_CONTROL_RTS = FLOW_CONTROL_RTS;
+    serialPort.setRTS(FLOW_CONTROL_RTS);
   }
   @ReactMethod
-  public void setDTR(boolean FLOW_CONTROL_DSR_DTR) {
-    this.FLOW_CONTROL_DSR_DTR = FLOW_CONTROL_DSR_DTR;
-    serialPort.setDTR(FLOW_CONTROL_DSR_DTR);
+  public void setDTR(boolean FLOW_CONTROL_DTR) {
+    this.FLOW_CONTROL_DTR = FLOW_CONTROL_DTR;
+    serialPort.setDTR(FLOW_CONTROL_DTR);
   }
 
   @ReactMethod

+ 8 - 0
types/index.d.ts

@@ -166,6 +166,14 @@ interface RNSerialportStatic {
    * @memberof RNSerialportStatic
    */
   setFlowControl(control: FlowControls): void;
+  /**
+   *  Set RTS
+   */
+  setRTS(FLOW_CONTROL_RTS: boolean): void;
+  /**
+   *  Set DTR
+   */
+  setRTS(FLOW_CONTROL_DTR: boolean): void;
 
   /**
    * Set the auto connection baudrate