달력

5

« 2024/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
2011. 12. 29. 15:16

OGEMA - DeviceSimulationV2.impl OSGi 이야기2011. 12. 29. 15:16

ogmea.sample.device.Sim.DeviceSimulation implements RunningModule,,ResourceListener

interface RunningModle extends Module
- SyncMaster에 의해 호출되는 moudule interface
- start(ExecutionTime curTime), step(ExecutionTime curTime), stop(ExecutionTime curTime)을 메소드 노출

-start(ExecutionTime curTime)
모듈이 시작될 때, 마스터에 의해 이 함수는 호출된다.

-step
모듈의 한 스텝씩 마스터에 의해 이 함수는 호출된다.

-stop
모듈이 멈출때, master에 의해 이 함수는 호출된다.
 
Module{String getName();}

/******************************************************************/
ResourceListener
어떤 자원의 사용가능성을 리스닝하려고 할 때

ConnectMode resourceAvailable(int id, int demandId);
-  application 정보와 요구되는 자원의 사용가능성의 어플리케이션을 설명한다. 
- id : 사용가능한 resource id
- demandId : id를 가지고 demandId를 가지는 리소스를 이용할 수 있는가?
- ConnectionMode : 위에 대한 답을 enum 타입으로 리턴

enum ConnectMode{NO_CONNECTION,NO_WRITE_DEMAND, HAS_WRITE_DEMAND_APP,RESOURCE_DELETED}

 void resourceUpdatedBoolean(int demandId, int id, boolean value); 
- id가 변했을 떄 요청되는 demandID를 가지고 있는 리소스의 값의 변경여부
- value : new value of resource changed

 void resourceUpdatedInt(int demandId, int id, int value);
- id가 변했을 때 요청되는 dmandId를 가지고 있는 리소스의 값을 value로 지정한다.

void resourceUpdatedFloat(int demandId, int id, float value);
void resourceUpdatedString(int demandId, int id, String value);
void resourceUpdatedLong(int demandId, int id, long value);
ConnectMode resourceRegisterStatusChanged(int demandId, int id,
boolean hasBeenUnlocked,
String otherApplicationName, ConnectMode newOwnConnectMode);

List<Integer> getWritingDemands(int demandId, int resourceId);
 String getName();


/***********************************************************/

이제부터 진짜다... 이거보고 감동먹었슴
 시스템 실행중에 즉, 런타임 중에 어플을 올린다는 것은 힘든 작업이다. 리플렉션에 대해 꿰고 있어야 할 수 있다고 생각한다.

/**
 * Information about one resource which is managed by the device simulation.</p>

디바이스 시뮬레이션에 의해 관리되는 하나의 리소스의 정보를 추상화한 클래스 
 
 * @author Johanna Kuhlmann
 */
private class SimulatedDeviceResource {
private Field field; /* field having the resource */
private String resourcePath; /* path of the resource */
private boolean supervised; /* true if resource is supervised, i.e. a ResourceDemand is registered */
private ConnectMode access; /* read or write access */
private int id; /* id of the resource */
private SimulatedDevice simulatedDevice; /* parent, i.e. the complete device */
private Object lastValue; /* last value for checks if the value of a write resource was modified.
* The value only is set for output resources. For input resources its always null */
}

/***********************************************************/
 public class SimulatedDevice {

//하는 일이 뭘까?
//simulated devices의 새로운 storage
public SimulatedDevice(KnownDevice device) {}


'OSGi 이야기' 카테고리의 다른 글

OGEMA - SyncMaster  (0) 2011.12.29
OGEMA - ogema.sample.deviceSim.devices  (0) 2011.12.29
ECF 개요  (0) 2011.12.29
OSGi WebBundle  (0) 2011.12.27
OSGi Extender  (0) 2011.12.27
:
Posted by НooпeУ


Code Start Code End