/// <summary> /// if the service is a splitter service /// </summary> /// <param name="sid">the service ID</param> public static bool IsSplitter(this ServiceIDs sid) { if (sid == ServiceIDs.LOW_POWER_START || sid == ServiceIDs.LOW_POWER_END || sid == ServiceIDs.HIGH_POWER_START || sid == ServiceIDs.HIGH_POWER_END || sid == ServiceIDs.OPTIONAL_HIGH_POWER_START || sid == ServiceIDs.OPTIONAL_HIGH_POWER_END) { return(true); } return(false); }
/// <summary> /// if the service exist /// </summary> /// <param name="swi">the service ID</param> public static bool ExistWorker(this ServiceIDs swi) { switch (swi) { case ServiceIDs.VALIDATOR: return(false); default: return(true); } }
public static bool IsLayer1Service(this ServiceIDs sid) { switch (sid) { case ServiceIDs.INPUTMANAGER_INTERNAL: case ServiceIDs.INPUTMANAGER_EXTERNAL: case ServiceIDs.LAUNCHER: case ServiceIDs.UPDATESERVICE: case ServiceIDs.POWERMANAGER: return(true); } return(false); }
/// <summary> /// if the service exist /// </summary> /// <param name="swi">the service ID</param> public static bool ExistForwarder(this ServiceIDs swi) { switch (swi) { case ServiceIDs.HTTP_LISTENER: case ServiceIDs.SYS_REPORTER: case ServiceIDs.L2FORWARDER: case ServiceIDs.LAYER1: case ServiceIDs.UPDATESERVICE: return(false); default: return(true); } }
/// <summary> /// short string of the service /// </summary> /// <param name="swi">the service ID</param> public static string ShortString(this ServiceIDs swi) { lock (locker) { if (!shortNames.ContainsKey(swi)) { shortNames.Add(swi, swi.ToString() .Replace("INTERNAL", "Int") .Replace("EXTERNAL", "Ext") .Replace("MANAGER", "Mgr") .Replace("SERVICE", "Serv") .Replace("SYSTEM", "Sys")); } return(shortNames[swi]); } }
/// <summary> /// forwarder ID of the service /// </summary> /// <param name="swi">the service ID</param> /// <returns></returns> public static string ForwarderID(this ServiceIDs swi) { return("FWD_" + swi.ShortString()); }
/// <summary> /// work ID of the service /// Notice: we treat worker and service as the same mostly in layer0 because currently one service only got one worker. /// </summary> /// <param name="swi">the service ID</param> /// <returns></returns> public static string WorkerID(this ServiceIDs swi) { return("WRK_" + swi.ShortString()); }
/// <summary> /// the service publish to topic /// </summary> /// <param name="swi">the service ID</param> public static string PubChannelID(this ServiceIDs swi) { return("service/" + swi.ShortString().ToLower()); }
/// <summary> /// string convertion of service ID /// </summary> /// <param name="swi">the service ID</param> /// <returns>the string of the service ID</returns> public static string ServiceID(this ServiceIDs swi) { return("SER_" + swi.ToString()); }