Class SystemV1
- java.lang.Object
-
- aero.panasonic.inflight.services.systemevents.SystemV1
-
public class SystemV1 extends java.lang.ObjectPackage Starting Point - This is the class that offers services to provide information on the system update.
It is used by an application to make API calls to subscribe and unsubscribe to system events likeSystemV1Events.PAandSystemV1Events.DECOMPRESSION. SystemV1 service gives back updates in the form of intents. Applications need to register for intents with a Local Broadcast Manager. When registering for intents with a Local Broadcast Manager, pass in as parameters:-
Local Broadcast Receiver
When this receiver's onReceive(Context,Intent) callback is invoked, the value of the System Events can be accessed as follows:
-
Event name as String from
InFlightIntentExtras.EVENT_NAME.
public void onReceive(Context context, Intent intent) { String eventName = intent .getStringExtra(InFlightIntentExtras.EVENT_NAME .getKeyName()); if (eventName.equals(SystemV1Events .getSystemV1EventName(SystemV1Events.PA))) { } } -
Event payload as Bundle from
InFlightIntentExtras.EVENT_DATA.
Bundle data = intent .getBundleExtra(InFlightIntentExtras.EVENT_DATA .getKeyName()); Log.d("Debug","getState(): "+ data.getInt(InFlightIntentExtras.STATE.getKeyName())); -
Event ID as String from
InFlightIntentExtras.SERVICE_INSTANCE_ID.
String eventID = intent .getStringExtra(InFlightIntentExtras.SERVICE_INSTANCE_ID .getKeyName());
-
Event name as String from
-
IntentFilter with action:
InFlightIntentActions.ACTION_SYSTEM_EVENT
LocalBroadcastManager.getInstance(this) .registerReceiver( mLocalBroadcastReceiver, new IntentFilter( InFlightIntentActions.ACTION_SYSTEM_EVENT .getIntentAction())); -
Local Broadcast Receiver
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSystemV1.PaStatusstatic classSystemV1.ZonalPaStatus
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSDK_VERSION
-
Constructor Summary
Constructors Constructor Description SystemV1(Context appContext, java.lang.String appId)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetDecompressionStatus()Returns Decompression status.intgetPaStatus()Returns PA status.SystemV1.PaStatusgetPedPaStatus()get the PA status for the PED environment.SystemV1.ZonalPaStatusgetZonalPaStatus()get the PA status for the seatback environmentstatic voidinitService(Context context, java.lang.String serviceInstanceId, IInFlightCallback inFlightCallback, InFlight inFlight)Initialize a SystemV1 object and return the object with the IInFlightCallback.voidsubscribe(java.util.List<SystemV1Events> systemEvents)voidunSubscribe(java.util.List<SystemV1Events> SystemEvents)This API is to unsubscribe to the list of system events like PA, Decompression, and Weight On wheels.
-
-
-
Method Detail
-
initService
public static void initService(Context context, java.lang.String serviceInstanceId, IInFlightCallback inFlightCallback, InFlight inFlight)Initialize a SystemV1 object and return the object with the IInFlightCallback.- Parameters:
context- : provide a Context to initialize the object.serviceInstanceId- : service instance id identify the service object.inFlightCallback- : IInFlightCallback will be used to return the instance or providing the error message.inFlight- : provide an InFlight instance to initialize
-
subscribe
public void subscribe(java.util.List<SystemV1Events> systemEvents)
- Parameters:
systemEvents- The list of system events the app wants to subscribe to- Example:
SystemV1.initService(activity, serviceInstanceId, inflightCallbackListener, new InFlight()); public void onInitServiceComplete(Object service,String serviceName) { if (service instanceof SystemV1) { mSystemV1 = (SystemV1) service; try { ArrayListmSystemEvents = new ArrayList (); mSystemEvents.add( SystemV1Events.PA); mSystemEvents.add(SystemV1Events.DECOMPRESSION); mSystemV1.subscribe(mSystemEvents); } catch (Exception e) { Log.exception(e); } }
-
unSubscribe
public void unSubscribe(java.util.List<SystemV1Events> SystemEvents)
This API is to unsubscribe to the list of system events like PA, Decompression, and Weight On wheels.- Parameters:
SystemEvents- The list of system events the app wants to unsubscribe to- Example:
SystemV1.initService(activity, serviceInstanceId, inflightCallbackListener, new InFlight()); public void onInitServiceComplete(Object service,String serviceName) { if (service instanceof SystemV1) { mSystemV1 = (SystemV1) service; try { ArrayListmSystemEvents = new ArrayList (); mSystemEvents.add( SystemV1Events.DECOMPRESSION); mSystemEvents.add(SystemV1Events.PA); mSystemV1.unSubscribe(mSystemEvents); } catch (Exception e) { e.printStackTrace(); } }
-
getPaStatus
public int getPaStatus()
Returns PA status.- Returns:
- int
-
getPedPaStatus
public SystemV1.PaStatus getPedPaStatus()
get the PA status for the PED environment.- Returns:
SystemV1.PaStatusindicate PA status
-
getZonalPaStatus
public SystemV1.ZonalPaStatus getZonalPaStatus()
get the PA status for the seatback environment- Returns:
SystemV1.ZonalPaStatusindicate the PA status
-
getDecompressionStatus
public boolean getDecompressionStatus()
Returns Decompression status.- Returns:
- boolean
-
-