Пример #1
0
    public ModelGET getModelData(string modelID)
    {
        AINWebStreamReader requestModel = new AINWebStreamReader();

        requestModel.Start1(modelUrlFrontPart + modelID + modelUrlEndPart);
        string   stream = requestModel.GetNextBlock();
        ModelGET model  = JsonUtility.FromJson <ModelGET> (stream);

        return(model);
    }
Пример #2
0
    // to be called for the first time or when refresh button is pressed
    public void getData()
    {
        Debug.Log("getData funtion of AINReadStream");
        request = new AINWebStreamReader();
        //request.Start1(Url);
        string stream = request.GetNextBlock();

        Debug.Log("getdata stream: stream");


        if (!string.IsNullOrEmpty(stream))
        {
            equipment = JsonUtility.FromJson <EquipmentGET> (stream);

            //equipment = JsonConvert.DeserializeObject<EquipmentGET>(stream,
            //	new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd" });
            gameObject.GetComponent <AINIoT> ().nameVal = equipment.name;
            Debug.Log("NAMEEEEE" + equipment.name);
            //check if serial number is null give batch num
            gameObject.GetComponent <AINIoT> ().serialNumVal = equipment.serialNumber;
            Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-NL");
            gameObject.GetComponent <AINIoT> ().buildDateVal   = Convert.ToString(equipment.buildDate.ToShortDateString());
            gameObject.GetComponent <AINIoT> ().nextServiceVal = "21-9-2017";

            ModelGET model = getModelData(equipment.modelId);
            if (string.IsNullOrEmpty(model.manufacturer))
            {
                gameObject.GetComponent <AINIoT> ().manufacturerVal = "Acme Pumps";
            }
            else
            {
                gameObject.GetComponent <AINIoT> ().manufacturerVal = model.manufacturer;
            }
            gameObject.GetComponent <AINIoT> ().modelNameVal = model.name;
        }
    }