当前位置: 首页>>代码示例>>Java>>正文


Java CoapResponse.getResponseText方法代码示例

本文整理汇总了Java中org.eclipse.californium.core.CoapResponse.getResponseText方法的典型用法代码示例。如果您正苦于以下问题:Java CoapResponse.getResponseText方法的具体用法?Java CoapResponse.getResponseText怎么用?Java CoapResponse.getResponseText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.californium.core.CoapResponse的用法示例。


在下文中一共展示了CoapResponse.getResponseText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response) {
	String content = response.getResponseText();
	System.out.println("-CO01----------");
	System.out.println(content);
	dimXMLStr = content;
	try {
		spo2DIM = new DomainInformationModel("Spo2 DS");

		readXML(content);
		String contentData = Spo2Device.getDIMRep(sensorId, spo2DIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));

		System.out.println("DIM :" + " GET DIM " + "\n");
	} catch (Exception e) {
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:23,代码来源:Spo2Monitor.java

示例2: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response) {
	String content = response.getResponseText();
	System.out.println("-CO01----------");
	System.out.println(content);
	dimXMLStr = content;
	try {
		spo2DIM = new DomainInformationModel("Spo2 DS");

		readXML(content);
		String contentData = Spo2Device.getDIMRep(sensorId,
				spo2DIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));

		System.out.println("DIM :" + " GET DIM " + "\n");
	} catch (Exception e) {
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:24,代码来源:Spo2Monitor.java

示例3: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response) {
	String content = response.getResponseText();
	

	dimXMLStr = content;
	try {
		tmDIM = new DomainInformationModel("Thermometer DS");
		readXML(dimXMLStr);
		
		String contentData = ThermometerDevice.getDIMRep(sensorId,
				tmDIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
	
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));

		
	} catch (Exception e) {
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:25,代码来源:ThermometerMonitor.java

示例4: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response) {
	String content = response.getResponseText();
	// System.out.println("-CO01----------");
	System.out.println(content);
	dimXMLStr = content;
	try {
		bcDIM = new DomainInformationModel("BodyComposition DS");
		
		readXML(content);
		String contentData = BodyCompositionDevice.getDIMRep(sensorId,
				bcDIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));

		System.out.println("DIM :" + " GET DIM " + "\n");
	} catch (Exception e) {
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:24,代码来源:BodyCompositionMonitor.java

示例5: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response) {
	String content = response.getResponseText();

	dimXMLStr = content;
	try {
		wsDIM = new DomainInformationModel("Weighingscale DS");
		
		readXML(dimXMLStr);

		
		String contentData = WeighingscaleDevice.getDIMRep(sensorId,
				wsDIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
		// ����data
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));

		
	} catch (Exception e) {
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:26,代码来源:WeighingscaleMonitor.java

示例6: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response) {
	String content = response.getResponseText(); // Gets the response
													// from Coap
	dimXMLStr = content;

	try {
		cvDIM = new DomainInformationModel("CardioVascular DS");
		readXML(content);

		String contentData = CardioVascularDevice.getDIMRep(sensorId,
				cvDIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));

		System.out.println("DIM :" + " GET DIM " + "\n");
	} catch (Exception e) {
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:24,代码来源:CardioVascularMonitor.java

示例7: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response)
{
	String content = response.getResponseText(); // Gets the response from Coap
	dimXMLStr = content;
	
	try 
	{
		cvDIM = new DomainInformationModel("StrengthFitness DS");
		readXML(content);
		
		String contentData = StrengthFitnessDevice.getDIMRep(sensorId,
				cvDIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));
		
		System.out.println("DIM :" + " GET DIM " + "\n");
	} 
	catch (Exception e) 
	{
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:27,代码来源:StrengthFitnessMonitor.java

示例8: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response)
{
	String content = response.getResponseText(); // Gets the response from Coap
	try {
		cvDIM = new DomainInformationModel("StrengthFitness DS");
	
		readXML(content);
	
		String contentData = MedicationMonitorDevice.getDIMRep(sensorId,
				cvDIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));

	} 
	catch (Exception e) 
	{
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:24,代码来源:MedicationMonitor.java

示例9: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response) {
	// TODO Auto-generated method stub
	String content, targetID, spo2value, pulseratevalue;
	String message = response.getResponseText();
	String[] buf = message.split("OBX");
	
	
	String[] spo2buf = buf[buf.length-2].split("\\|");
	spo2value = spo2buf[spo2buf.length-2];
	String[] pulsebuf = buf[buf.length-1].split("\\|");
	pulseratevalue = pulsebuf[pulsebuf.length-2];
	
	
	content = D10404.getStateRep(D10404.TYPE, spo2value, pulseratevalue, message);
	targetID = SCLID+"/applications/"+D10404.TYPE+"/containers/"+DATA+"/contentInstances";
          SCL.doRequest(new RequestIndication(METHOD_CREATE,targetID,REQENTITY,new ContentInstance(content.getBytes())));
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:19,代码来源:D10404Monitor.java

示例10: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response) {
	String content = response.getResponseText();
	// System.out.println("-CO01----------");
	System.out.println(content);
	dimXMLStr = content;
	try {
		blpDIM = new DomainInformationModel("BloodPressure DS");
		
		readXML(content);
		String contentData = BloodPressureDevice.getDIMRep(sensorId,
				blpDIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));

		System.out.println("DIM :" + " GET DIM " + "\n");
	} catch (Exception e) {
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:24,代码来源:BloodPressureMonitor.java

示例11: onLoad

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
@Override
public void onLoad(CoapResponse response) {
	String content = response.getResponseText();

	dimXMLStr = content;
	try {
		gmDIM = new DomainInformationModel("GlucoseMeter DS");
		
		readXML(dimXMLStr);

		
		String contentData = GlucoseMeterDevice.getDIMRep(sensorId,
				gmDIM);
		String targetID = sclId + "/applications/" + sensorId
				+ "/containers/DATA/contentInstances";
	
		core.doRequest(new RequestIndication("CREATE", targetID,
				reqEntity, contentData));

		
	} catch (Exception e) {
		// TODO: handle exception
		e.printStackTrace();
	}
}
 
开发者ID:AINLAB,项目名称:OHP-M2M,代码行数:26,代码来源:GlucoseMeterMonitor.java

示例12: getMoods

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
public static String getMoods(GWConnection gateway, TradfriGroup group) {
	CoapResponse resp = gateway.get("/15005/" + group.getGroupID());
	if(!ResponseCode.isSuccess(resp.getCode())) {
		System.out.println("Get moods failed!");
		return "";
	}else {
		try {
			JSONArray moodIDs = new JSONArray(resp.getResponseText());
			JSONArray returnJSON = new JSONArray();
			
			for(int i = 0; i < moodIDs.length(); i++) {
				int currentID = moodIDs.getInt(i);

				group.mood(currentID).update();
				
				JSONObject currentKey = new JSONObject();
				currentKey.put("groupid", group.mood(currentID).getGroupID());
				currentKey.put("moodid", group.mood(currentID).getMoodID());
				currentKey.put("name", group.mood(currentID).getName());
				
				returnJSON.put(currentKey);
			}
			
			return returnJSON.toString();
		}catch(Exception e) {
			System.out.println("Unexpected response: " + e.getMessage());
			return "";
		}
	}
}
 
开发者ID:peterkappelt,项目名称:JTradfri,代码行数:31,代码来源:TradfriMood.java

示例13: update

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
/**
 * force a update by a blocking get
 * @return true if it was successful, false if not
 */
public Boolean update() {
	CoapResponse resp = gateway.get("/15005/" + this.group.getGroupID() + "/" + this.moodID);
	
	if(!ResponseCode.isSuccess(resp.getCode())) {
		System.out.println("Mood update for " + this.moodID + "failed!");
		return false;
	}else {
		try {
			JSONObject json = new JSONObject(resp.getResponseText());
			
			//name
			if(json.has("9001")) {
				this.name = json.getString("9001");
			}
			
			//createdAt
			if(json.has("9002")) {
				this.createdAt = json.getInt("9002");
			}
			
			return true;
		}catch(Exception e) {
			System.out.println("Unexpected response: " + e.getMessage()); 
			return false;
		}
	}
}
 
开发者ID:peterkappelt,项目名称:JTradfri,代码行数:32,代码来源:TradfriMood.java

示例14: getGroups

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
public static String getGroups(GWConnection gateway) {
	CoapResponse resp = gateway.get("/15004");
	if(!ResponseCode.isSuccess(resp.getCode())) {
		System.out.println("Get groups failed!");
		return "";
	}else {
		try {
			JSONArray groupIDs = new JSONArray(resp.getResponseText());
			JSONArray returnJSON = new JSONArray();
			
			for(int i = 0; i < groupIDs.length(); i++) {
				int currentID = groupIDs.getInt(i);

				gateway.group(currentID).update();
				
				JSONObject currentKey = new JSONObject();
				currentKey.put("groupid", gateway.group(currentID).getGroupID());
				currentKey.put("name", gateway.group(currentID).getName());
				
				returnJSON.put(currentKey);
			}
			
			return returnJSON.toString();
		}catch(Exception e) {
			System.out.println("Unexpected response: " + e.getMessage());
			return "";
		}
	}
}
 
开发者ID:peterkappelt,项目名称:JTradfri,代码行数:30,代码来源:TradfriGroup.java

示例15: getDevices

import org.eclipse.californium.core.CoapResponse; //导入方法依赖的package包/类
public static String getDevices(GWConnection gateway) {
	CoapResponse resp = gateway.get("/15001");
	if(!ResponseCode.isSuccess(resp.getCode())) {
		System.out.println("Get devices failed!");
		return "";
	}else {
		try {
			JSONArray deviceIDs = new JSONArray(resp.getResponseText());
			JSONArray returnJSON = new JSONArray();
			
			for(int i = 0; i < deviceIDs.length(); i++) {
				int currentID = deviceIDs.getInt(i);

				gateway.device(currentID).update();
				
				JSONObject currentKey = new JSONObject();
				currentKey.put("deviceid", gateway.device(currentID).getDeviceID());
				currentKey.put("name", gateway.device(currentID).getName());
				
				returnJSON.put(currentKey);
			}
			
			return returnJSON.toString();
		}catch(Exception e) {
			System.out.println("Unexpected response: " + e.getMessage());
			return "";
		}
	}
}
 
开发者ID:peterkappelt,项目名称:JTradfri,代码行数:30,代码来源:TradfriDevice.java


注:本文中的org.eclipse.californium.core.CoapResponse.getResponseText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。