|
|
@ -63,23 +63,23 @@ public class DetailActivity extends AppCompatActivity implements View.OnClickLis |
|
|
|
if (this.mMTConnectionHandler.mTConnectionFeature.supportTriggers.size() > 0 |
|
|
|
&& this.mMTConnectionHandler.triggers.size() > 0) { |
|
|
|
Trigger trigger = new Trigger(); |
|
|
|
trigger.setCurSlot(mCurSlot);//选择设置那个通道 |
|
|
|
boolean isOpen = true; //代表是否开启了触发器 |
|
|
|
trigger.setCurSlot(mCurSlot); |
|
|
|
boolean isOpen = true; |
|
|
|
if (isOpen) { |
|
|
|
TriggerType triggerType = TriggerType.BTN_DTAP_EVT; |
|
|
|
trigger.setTriggerType(TriggerType.BTN_DTAP_EVT);//双击按键 |
|
|
|
trigger.setTriggerType(TriggerType.BTN_DTAP_EVT); |
|
|
|
switch (triggerType) { |
|
|
|
case TEMPERATURE_ABOVE_ALARM://温度高于 |
|
|
|
case TEMPERATURE_BELOW_ALARM://温度低于 |
|
|
|
case HUMIDITY_ABOVE_ALRM://湿度高于 |
|
|
|
case HUMIDITY_BELOW_ALRM://湿度低于 |
|
|
|
case LIGHT_ABOVE_ALRM://光感高于 |
|
|
|
case LIGHT_BELOW_ALARM://光感低于 |
|
|
|
case FORCE_ABOVE_ALRM://压感大于 |
|
|
|
case FORCE_BELOW_ALRM://压感低于 |
|
|
|
case TVOC_ABOVE_ALARM://TVOC大于 |
|
|
|
case TVOC_BELOW_ALARM://TVOC低于 |
|
|
|
trigger.setCondition(10);//这些触发条件,时长 mTemCondition 不需要乘 1000 |
|
|
|
case TEMPERATURE_ABOVE_ALARM: |
|
|
|
case TEMPERATURE_BELOW_ALARM: |
|
|
|
case HUMIDITY_ABOVE_ALRM: |
|
|
|
case HUMIDITY_BELOW_ALRM: |
|
|
|
case LIGHT_ABOVE_ALRM: |
|
|
|
case LIGHT_BELOW_ALARM: |
|
|
|
case FORCE_ABOVE_ALRM: |
|
|
|
case FORCE_BELOW_ALRM: |
|
|
|
case TVOC_ABOVE_ALARM: |
|
|
|
case TVOC_BELOW_ALARM: |
|
|
|
trigger.setCondition(10); |
|
|
|
break; |
|
|
|
default: |
|
|
|
trigger.setCondition(10 * 1000); |
|
|
@ -89,9 +89,9 @@ public class DetailActivity extends AppCompatActivity implements View.OnClickLis |
|
|
|
trigger.setCondition(0); |
|
|
|
} |
|
|
|
if (version.getValue() > 4) { |
|
|
|
trigger.setAdvInterval(2000);//广播间隔 100 ms ~ 5000 ms |
|
|
|
trigger.setRadioTxpower(0);//广播功率:-40dBm ~ 4dBm |
|
|
|
trigger.setAlwaysAdvertising(false);//true:总是广播,false:不总是广播 |
|
|
|
trigger.setAdvInterval(2000); |
|
|
|
trigger.setRadioTxpower(0); |
|
|
|
trigger.setAlwaysAdvertising(false); |
|
|
|
} |
|
|
|
this.mMTConnectionHandler.setTriggerCondition(trigger, new SetTriggerListener() { |
|
|
|
@Override |
|
|
|