mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
removed scep impl from virtual fire alarm
This commit is contained in:
parent
2025179df0
commit
37969ba0a0
@ -208,7 +208,10 @@ public class FireAlarmMQTTCommunicator extends MQTTTransportHandler {
|
||||
@Override
|
||||
public void run() {
|
||||
int currentTemperature = agentManager.getTemperature();
|
||||
String message = "PUBLISHER:" + AgentConstants.TEMPERATURE_CONTROL + ":" + currentTemperature;
|
||||
String message = "{\"event\": {\"metaData\": {\"owner\": \"" + AgentManager
|
||||
.getInstance().getAgentConfigs().getDeviceOwner() + "\",\"deviceId\": \"" + AgentManager
|
||||
.getInstance().getAgentConfigs().getDeviceId() + "\",\"time\": " +
|
||||
"0},\"payloadData\": { \"temperature\": " + currentTemperature + "} }}";
|
||||
|
||||
try {
|
||||
String payLoad = AgentUtilOperations.prepareSecurePayLoad(message);
|
||||
|
||||
@ -189,8 +189,10 @@ public class FireAlarmXMPPCommunicator extends XMPPTransportHandler {
|
||||
|
||||
try {
|
||||
int currentTemperature = agentManager.getTemperature();
|
||||
|
||||
String message = AgentConstants.TEMPERATURE_CONTROL + ":" + currentTemperature;
|
||||
String message = "{\"event\": {\"metaData\": {\"owner\": \"" + AgentManager
|
||||
.getInstance().getAgentConfigs().getDeviceOwner() + "\",\"deviceId\": \"" + AgentManager
|
||||
.getInstance().getAgentConfigs().getDeviceId() + "\",\"time\": " +
|
||||
"0},\"payloadData\": { \"temperature\": " + currentTemperature + "} }}";
|
||||
String payLoad = AgentUtilOperations.prepareSecurePayLoad(message);
|
||||
|
||||
xmppMessage.setTo(xmppAdminJID);
|
||||
|
||||
@ -62,7 +62,7 @@ public class AgentConstants {
|
||||
public static final int DEFAULT_MQTT_RECONNECTION_INTERVAL = 2; // time in seconds
|
||||
public static final int DEFAULT_MQTT_QUALITY_OF_SERVICE = 0;
|
||||
public static final String MQTT_SUBSCRIBE_TOPIC = "%s/" + DEVICE_TYPE + "/%s";
|
||||
public static final String MQTT_PUBLISH_TOPIC = "%s/" + DEVICE_TYPE + "/%s/publisher";
|
||||
public static final String MQTT_PUBLISH_TOPIC = "%s/" + DEVICE_TYPE + "/%s/temperature";
|
||||
|
||||
/* ---------------------------------------------------------------------------------------
|
||||
Device/Agent specific properties to be read from the 'deviceConfig.properties' file
|
||||
|
||||
@ -153,15 +153,15 @@ public class AgentManager {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (!EnrollmentManager.getInstance().isEnrolled()) {
|
||||
EnrollmentManager.getInstance().beginEnrollmentFlow();
|
||||
}
|
||||
} catch (AgentCoreOperationException e) {
|
||||
log.error("Device Enrollment Failed:\n");
|
||||
log.error(e);
|
||||
System.exit(0);
|
||||
}
|
||||
// try {
|
||||
// if (!EnrollmentManager.getInstance().isEnrolled()) {
|
||||
// EnrollmentManager.getInstance().beginEnrollmentFlow();
|
||||
// }
|
||||
// } catch (AgentCoreOperationException e) {
|
||||
// log.error("Device Enrollment Failed:\n");
|
||||
// log.error(e);
|
||||
// System.exit(0);
|
||||
// }
|
||||
|
||||
//Start agent communication
|
||||
agentCommunicator.get(protocol).connect();
|
||||
|
||||
@ -250,6 +250,7 @@ public class AgentUtilOperations {
|
||||
}
|
||||
|
||||
public static String prepareSecurePayLoad(String message) throws AgentCoreOperationException {
|
||||
if (EnrollmentManager.getInstance().isEnrolled()) {
|
||||
PrivateKey devicePrivateKey = EnrollmentManager.getInstance().getPrivateKey();
|
||||
String encodedMessage = Base64.encodeBase64String(message.getBytes());
|
||||
String signedPayload;
|
||||
@ -267,9 +268,13 @@ public class AgentUtilOperations {
|
||||
//below statements are temporary fix.
|
||||
jsonPayload.put(JSON_SERIAL_KEY, EnrollmentManager.getInstance().getSCEPCertificate().getSerialNumber());
|
||||
return jsonPayload.toString();
|
||||
} else {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
public static String extractMessageFromPayload(String message) throws AgentCoreOperationException {
|
||||
if (EnrollmentManager.getInstance().isEnrolled()) {
|
||||
String actualMessage;
|
||||
|
||||
PublicKey serverPublicKey = EnrollmentManager.getInstance().getServerPublicKey();
|
||||
@ -301,6 +306,9 @@ public class AgentUtilOperations {
|
||||
throw new AgentCoreOperationException(errorMsg);
|
||||
}
|
||||
return actualMessage;
|
||||
} else {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getAuthenticationMethod() {
|
||||
|
||||
@ -111,7 +111,7 @@ public class EnrollmentManager {
|
||||
*/
|
||||
private EnrollmentManager() {
|
||||
this.SCEPUrl = AgentManager.getInstance().getEnrollmentEP();
|
||||
setEnrollmentStatus();
|
||||
//setEnrollmentStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user