summaryrefslogtreecommitdiff
path: root/test/traffic-incidents-service/feed/org.genivi.trafficinfo.tpegfwk/src/main/java/org/genivi/trafficinfo/tpeg/clientside/broadcastadaptionlayer/refimpl/BroadcastAdaptationLayerImplementation.java
blob: 8d21f7d165fb65b8dab36f00932e98e4a4c5d855 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 * Copyright (C) 2013 TomTom International B.V.
 * 
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.genivi.trafficinfo.tpeg.clientside.broadcastadaptionlayer.refimpl;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.genivi.trafficinfo.demo.communicationchannel.DataReceptionListener;
import org.genivi.trafficinfo.demo.communicationchannel.broadcastchannel.BroadcastReception;
import org.genivi.trafficinfo.demo.communicationchannel.broadcastchannel.impl.DummyBroadcastChannel;
import org.genivi.trafficinfo.tpeg.clientside.broadcast.fwk.TpegSfwAdaptationLayers;

public class BroadcastAdaptationLayerImplementation implements DataReceptionListener {
  private final static Logger LOGGER = Logger.getLogger(BroadcastAdaptationLayerImplementation.class.getName()); 
  
  private TpegSfwAdaptationLayers tpegSfwAdaptationLayers;
  private long channelId;
  
  // Broadcast specific attributes.
  private BroadcastReception broadcastReception;
  

  public BroadcastAdaptationLayerImplementation(String communicationChannelName, TpegSfwAdaptationLayers tpegSfwAdaptationLayers) {
    LOGGER.setLevel(Level.SEVERE);
    LOGGER.info("Creating BroadcastAdaptationLayer");
    this.tpegSfwAdaptationLayers = tpegSfwAdaptationLayers;
    
    channelId  = tpegSfwAdaptationLayers.registerAdaptationLayer(this, communicationChannelName);
    
    broadcastReception = DummyBroadcastChannel.getInstance();
    broadcastReception.addBroadcastReceptionListener(this);
  }


  @Override
  public void dataReceived(Object data) {
    LOGGER.info("Data received.");
    
    tpegSfwAdaptationLayers.transportFrameReceived(channelId, data);
  }


}