| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.mqtt.service.MqttPushCallback; |
| | | import com.doumee.core.mqtt.service.MqttToolService; |
| | | import com.doumee.dao.business.model.Locks; |
| | | import com.doumee.service.business.DeviceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class DeviceServiceImpl implements DeviceService { |
| | | |
| | | @Autowired |
| | | private MqttToolService mqttToolService; |
| | | |
| | | @Override |
| | | @PostConstruct |
| | | public void startSubcribe() { |
| | | mqttToolService.subscribe(new String[]{ Constants.MqttTopic.openLock, Constants.MqttTopic.closeLock}); |
| | | } |
| | | @Override |
| | | public String openLock(Locks locks) { |
| | | public boolean openLock(Locks locks) { |
| | | mqttToolService.pubMessage(locks.getName(), Constants.MqttTopic.openLock); |
| | | return null; |
| | | return true; |
| | | } |
| | | |
| | | } |