mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-19 00:20:26 +00:00
Updated FHEM for command
Started Broadlink implementation
This commit is contained in:
@@ -1,20 +1,50 @@
|
||||
package com.bwssystems.HABridge.plugins.http;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.bwssystems.HABridge.api.NameValue;
|
||||
import com.bwssystems.HABridge.plugins.http.HTTPHandler;
|
||||
|
||||
public class HttpTestHandler extends HTTPHandler {
|
||||
private String theData;
|
||||
private List<NameValue> theData;
|
||||
|
||||
public String getTheData() {
|
||||
return theData;
|
||||
public void setTheData(String compareValue, String testData) {
|
||||
if( this.theData == null )
|
||||
this.theData = new ArrayList<NameValue>();
|
||||
NameValue aValueSet = new NameValue();
|
||||
aValueSet.setName(compareValue);
|
||||
aValueSet.setValue(testData);
|
||||
this.theData.add(aValueSet);
|
||||
}
|
||||
|
||||
public void setTheData(String theData) {
|
||||
this.theData = theData;
|
||||
public void updateTheData(String compareValue, String testData) {
|
||||
if( this.theData == null ) {
|
||||
this.theData = new ArrayList<NameValue>();
|
||||
NameValue aValueSet = new NameValue();
|
||||
aValueSet.setName(compareValue);
|
||||
aValueSet.setValue(testData);
|
||||
this.theData.add(aValueSet);
|
||||
}
|
||||
else {
|
||||
for(NameValue aTest:this.theData) {
|
||||
if(aTest.getName().equals(compareValue));
|
||||
aTest.setValue(testData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String doHttpRequest(String url, String httpVerb, String contentType, String body, NameValue[] headers) {
|
||||
return theData;
|
||||
String responseData = null;
|
||||
for(NameValue aTest:theData) {
|
||||
if(url.contains(aTest.getName()))
|
||||
responseData = aTest.getValue();
|
||||
else if(aTest.getName() == null || aTest.getName().isEmpty())
|
||||
responseData = aTest.getValue();
|
||||
|
||||
if(responseData != null)
|
||||
break;
|
||||
}
|
||||
return responseData;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user