# sys::PlatformService

    sys::Obj
      sys::Virtual
        sys::Component
          sys::Service
            sys::PlatformService

`public class PlatformService` `[niagaraIcon="module://icons/x16/platform.png"]`

PlatformService is a service designed for a specific hardware/OS platform.

memAvailable

  `public property long memAvailable [readonly]`

  The amount of available runtime memory, in bytes. This property must be updated during execute()

netConfigError

  `public static const define int netConfigError`

  Network failed due to configuration error

netFatal

  `public static const define int netFatal`

  Network interface has fatal error

netInitializing

  `public static const define int netInitializing`

  Network interface is initializing i.e. acquiring DHCP address or joining RF network

netOk

  `public static const define int netOk`

  Network interface is operational

platformId

  `public inline property Buf platformId [asStr, summary=false, max=128, readonly]`

  The platform identifier which defines how this Sedona device should be provisioned.

platformVer

  `public inline property Buf platformVer [asStr, summary=false, max=17, readonly]`

  The platform version. This should be a Dewey Decimal style version (x.y.z). The default value is "0" and should be used to indicate that the platform does not have a meaningful concept for platform version.

canHibernate

  `public virtual override bool canHibernate()`

  By default, a Platform Service assumes that the platform does not support hibernation, so this method always returns false. If your platform supports hibernation, you should override this method to return true.

execute

  `public virtual override void execute()`

getNetworkState

  `public virtual int getNetworkState()`

  Return the current state of the network interface. For devices that support multiple interfaces, return the state of the primary network interface on the platform.

init

  `public virtual int init(Str[] args, int argsLen)`

  Initialize the platform with the command line arguments. Return 0 on success. Return non-zero on failure, which will terminate the process.

lookup

  `public static PlatformService lookup()`

  Lookup the platform service for this VM. Return null if the application hasn't booted yet or is missing a platform service.

notify

  `public virtual void notify(Str key, Str val)`

  Notify the platform of a name/value pair setting or state change.

reboot

  `public action void reboot() [confirmRequired]`

  Action to reboot the entire host platform. This typically means to reboot the entire operating system.

refreshMemory

  `public virtual void refreshMemory()`

  Update the memAvailable property to reflect the current amount of available memory.

restart

  `public action void restart() [confirmRequired]`

  Action to restart the Sedona application on the host platform. This typically means restart just the Sedona process.

start

  `public virtual override void start()`

updatePlatformId

  `public void updatePlatformId(Str id)`

  Convenience to set the platformId property, and call changed()

updatePlatformVer

  `public void updatePlatformVer(Str ver)`

  Convenience to set the platformVer property, and call changed()

workDuringFreeTime

  `public virtual bool workDuringFreeTime(long nsUntilDeadline)`

  Returns true if the platform wants to the App to invoke work() again on all Services during free time before the next App execute needs to begin.

  For Apps with long scanPeriods (greater than 50ms), this allows Services to respond to network traffic or other asynchronous events multiple times during a single scanPeriod - even if the service didn't have any immediate work to do.

  i.e. - Sox services responds to a poll request, but then has no further work, nor doing any other services. A few ms later, another poll request comes in. If this method returns false, no further workd will be done until the beginning of the next scan period If this method returns true, work() will be called on all services again and the poll request will be handled before the next scanPeriod.

  nsUntilDeadline represents the time remaining before the next App execute() cycle again. Depending on the underlying OS/system architecture, the platform may want to sleep or otherwise relinquish the CPU for some fraction of nsUntilDeadline before returning and allowing App to call service work again.

  See also the Apps chapter in Sedona docs

yield

  `public virtual void yield(long yieldTime)`

  Inform platform that SVM will be exiting with Err.yield and needs to be scheduled to run again (via resume in vm.c) in ns nanoseconds to meet the desired App.scanPeriod value.

  If the application overruns its scan period, yieldTime will be negative. In this case the VM should be scheduled to run again as soon as possible.

  See also the Apps chapter in Sedona docs

yieldRequired

  `public virtual bool yieldRequired()`

  Return true if App must yield CPU by exiting VM each cycle.

  Platforms that support pre-emptive multitasking should return false since App can sleep to yield CPU.

  Cooperative multitasking platforms that expect tasks to run to completion and return so other tasks can execute should return true.

  See also the Apps chapter in Sedona docs