61 lines
2.4 KiB
Java
61 lines
2.4 KiB
Java
package com.mogo.cloud;
|
|
|
|
import com.elegant.spi.annotations.Service;
|
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
|
import com.mogo.realtime.api.IRealTimeProvider;
|
|
import com.mogo.realtime.entity.SocketReceiveDataProto3;
|
|
import com.mogo.realtime.util.MortonCode;
|
|
|
|
import static com.mogo.cloud.socket.SocketMsgType.MSG_TYPE_UPLINK_CAR_DATA;
|
|
|
|
|
|
/**
|
|
* @author liujing
|
|
* @description 描述
|
|
* @since: 2021/1/26
|
|
*/
|
|
@Service(value = IRealTimeProvider.class)
|
|
class SPIRealTimeTestClass implements IRealTimeProvider {
|
|
|
|
@Override
|
|
public SocketReceiveDataProto3.SocketReceiveDataProto getLocationMsg() {
|
|
|
|
long mortonCode = MortonCode.encodeMorton(116.410871, 39.968309);
|
|
|
|
SocketReceiveDataProto3.LocationInfoProto locationInfoProto =
|
|
SocketReceiveDataProto3.LocationInfoProto.newBuilder()
|
|
.setLat(39.968309)
|
|
.setLon(116.410871)
|
|
.setHeading(120)
|
|
.setSystemTime(System.currentTimeMillis())
|
|
.setSatelliteTime(System.currentTimeMillis())
|
|
.setAlt(55)
|
|
.setDataAccuracy(1)
|
|
.setSpeed(30)
|
|
.setMortonCode(mortonCode)
|
|
.setSn(MoGoAiCloudClientConfig.getInstance().getSn())
|
|
.build();
|
|
|
|
SocketReceiveDataProto3.MyLocationReq myLocationReq =
|
|
SocketReceiveDataProto3.MyLocationReq.newBuilder()
|
|
.setLastCoordinate(locationInfoProto)
|
|
.setDataAccuracy(1)
|
|
.setMortonCode(mortonCode)
|
|
.setFromType(0)
|
|
.setSn(MoGoAiCloudClientConfig.getInstance().getSn())
|
|
.build();
|
|
|
|
SocketReceiveDataProto3.OnePerSecondSendReqProto self =
|
|
SocketReceiveDataProto3.OnePerSecondSendReqProto.newBuilder()
|
|
.setSelf(myLocationReq)
|
|
.build();
|
|
return SocketReceiveDataProto3.SocketReceiveDataProto.newBuilder()
|
|
.setIPCSn(MoGoAiCloudClientConfig.getInstance().getSn() + "xavier")
|
|
.setSn(MoGoAiCloudClientConfig.getInstance().getSn())
|
|
.setData(self)
|
|
.setMsgType(MSG_TYPE_UPLINK_CAR_DATA.getMsgType())
|
|
.setSeq(System.currentTimeMillis()).build();
|
|
|
|
}
|
|
}
|