Subversion Repositories SmartDukaan

Rev

Rev 28112 | Rev 28114 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28112 Rev 28113
Line 127... Line 127...
127
		JSONObject jsonObj = new JSONObject(response.body().string());
127
		JSONObject jsonObj = new JSONObject(response.body().string());
128
 
128
 
129
		JSONObject deviceStatus = jsonObj.getJSONObject("device_status");
129
		JSONObject deviceStatus = jsonObj.getJSONObject("device_status");
130
		String status = deviceStatus.getString("value");
130
		String status = deviceStatus.getString("value");
131
 
131
 
132
		if (deviceStatus.equals("inactive") || deviceStatus.equals("disconnected")) {
132
		if (status.equals("inactive") || status.equals("disconnected")) {
-
 
133
 
-
 
134
			LOGGER.info("status" + status);
133
 
135
 
134
			Request request2 = new Request.Builder()
136
			Request request2 = new Request.Builder()
135
					.url("https://v3.api.hypertrack.com/devices/" + hyperTrackKey.getHypertrackKeyId() + "/start")
137
					.url("https://v3.api.hypertrack.com/devices/" + hyperTrackKey.getHypertrackKeyId() + "/start")
136
					.post(null).addHeader("Authorization", authString).build();
138
					.post(null).addHeader("Authorization", authString).build();
137
 
139
 
138
			Response resp = client.newCall(request2).execute();
140
			Response resp = client.newCall(request2).execute();
139
			em.setPunchIn(false);
141
			em.setPunchIn(false);
-
 
142
			LOGGER.info("resp" + resp);
-
 
143
 
140
		} else {
144
		} else if (status.equals("active")) {
141
			JSONObject c = jsonObj.getJSONObject("location");
145
			JSONObject c = jsonObj.getJSONObject("location");
142
			JSONObject d = c.getJSONObject("geometry");
146
			JSONObject d = c.getJSONObject("geometry");
143
			JSONArray coords = d.getJSONArray("coordinates");
147
			JSONArray coords = d.getJSONArray("coordinates");
144
 
148
 
145
			double lat2 = coords.getDouble(1);
149
			double lat2 = coords.getDouble(1);