public synchronized void FromByteArray(byte[] BA, TIndex Idx) throws IOException, OperationException { Timestamp = TGeographServerServiceOperation.ConvertBEByteArrayToDouble(BA, Idx.Value); Idx.Value += 8; Value = TGeographServerServiceOperation.ConvertBEByteArrayToInt64(BA, Idx.Value); Idx.Value += 8; super.FromByteArray(BA, /*ref*/ Idx); }
public synchronized byte[] ToByteArray() throws IOException { byte[] Result = new byte[ValueSize]; byte[] BA = TGeographServerServiceOperation.ConvertDoubleToBEByteArray(Timestamp); System.arraycopy(BA, 0, Result, 0, BA.length); BA = TGeographServerServiceOperation.ConvertInt64ToBEByteArray(Value); System.arraycopy(BA, 0, Result, 8, BA.length); return Result; }
@Override public void run() { try { ConnectDestination(); try { // . receive incoming operations TIndex OperationMessageOrigin = new TIndex(); TOperationSession OperationSession = new TOperationSession(); byte[] OperationMessage = null; TProcessIncomingOperationResult ProcessIncomingOperationResult = new TProcessIncomingOperationResult(); while (!Canceller.flCancel) { if (LANModule.Device.ModuleState == TDEVICEModule.MODULE_STATE_RUNNING) { OperationMessageOrigin.Reset(); OperationSession.New(); OperationMessage = TGeographServerServiceOperation.CheckReceiveMessage( LANModule.Device.UserID, LANModule.Device.UserPassword, DestinationConnection, DestinationConnectionInputStream, DestinationConnectionOutputStream, /*out*/ OperationSession, /*out*/ OperationMessageOrigin, LANModule.Device.ConnectorModule.LoopSleepTime); if (OperationMessage != null) { // . process incoming operation flProcessingOperation = true; try { LANModule.Device.ConnectorModule.ProcessIncomingOperation( OperationSession.ID, OperationMessage, /*ref*/ OperationMessageOrigin, CUAL, DestinationConnectionInputStream, DestinationConnectionOutputStream, ProcessIncomingOperationResult); if (ProcessIncomingOperationResult.ResultCode >= 0) { TObjectComponentServiceOperation ObjectOperation = ProcessIncomingOperationResult.Operation.GetObjectComponentServiceOperation(); if (ObjectOperation instanceof TObjectSetComponentDataServiceOperation) { LANModule.Device.ConnectorModule.OutgoingSetComponentDataOperationsQueue .AddNewOperation((TObjectSetComponentDataServiceOperation) ObjectOperation); LANModule.Device.ConnectorModule .ImmediateTransmiteOutgoingSetComponentDataOperations(); } } } finally { flProcessingOperation = false; } } } else Thread.sleep(LANModule.Device.ConnectorModule.LoopSleepTime); } } finally { DisconnectDestination(); } } catch (InterruptedException E) { } catch (Throwable TE) { // . log errors LANModule.Device.Log.WriteError("ConnectorModule.DeviceConnectionRepeater", TE.getMessage()); if (!(TE instanceof Exception)) TGeoLogApplication.Log_WriteCriticalError(TE); } // . Repeaters.remove(this); }