コード例 #1
0
        public void updateValue()
        {
            if (_pointArrayChangedDelegate != null)
            {
                _pointArrayChangedDelegate(_pointList.ToArray(), ChangedBy.SIM);
            }

            Transporter.getInstance().getModel().exposedValueChanged(this, new StringData(arrayToString()));
        }
コード例 #2
0
        public void updateValue()
        {
            if (_stringArrayChangedDelegate != null)
            {
                _stringArrayChangedDelegate(_values.ToArray(), ChangedBy.SIM);
            }

            Transporter.getInstance().getModel().exposedValueChanged(this, new ArrayData(_values.ToArray()));
        }
コード例 #3
0
        public void getData(string simId, string key, GetDataRequestSuccessDelegate successDelegate, GetDataRequestErrorDelegate errorDelegate)
        {
            string dataReturnString = ExternalCalls.getKeyPairSessionStorage(simId, key);

            // returns json string defined as below

            /*
             *  var response =
             *  {
             *      success: true,
             *      key: javaKey,
             *      value: null,
             *      exists: false
             *  };
             */

            // Parse return string from external call
            JObject jObject = JsonConvert.DeserializeObject <JObject>(dataReturnString);

            JProperty propSuccess = jObject.Property("success");
            //JProperty propKey = jObject.Property("key");
            JProperty propValue  = jObject.Property("value");
            JProperty propExists = jObject.Property("exists");

            bool success = propSuccess.Value.ToObject <bool>();


            Message.GetDataResponse getDataResponse = new Message.GetDataResponse();
            getDataResponse.handshake = Transporter.getInstance().getHandshake();
            getDataResponse.simId     = simId;
            getDataResponse.key       = key;
            getDataResponse.value     = null;
            getDataResponse.exists    = propExists.ToObject <bool>();

            if (success == true)
            {
                getDataResponse.responseType = "success";
            }
            else
            {
                getDataResponse.responseType = "error";
            }

            if (propValue.Value != null)
            {
                getDataResponse.value = propValue.Value.ToObject <string>();
            }

            if (success == true)
            {
                successDelegate(getDataResponse);
            }
            else
            {
                errorDelegate(getDataResponse);
            }
        }
コード例 #4
0
        public void unexpose()
        {
            if (_exposedName == null)
            {
                return;
            }

            Transporter.getInstance().getModel().unexposeValue(_exposedName);

            _exposedName = null;
        }
コード例 #5
0
        public void setValue(float value)
        {
            if (_value == value)
            {
                return;
            }

            _value = value;

            if (_numberChangedDelegate != null)
            {
                _numberChangedDelegate(_value, ChangedBy.SIM);
            }

            Transporter.getInstance().getModel().exposedValueChanged(this, new NumberData(_value));
        }
コード例 #6
0
        public void setValue(string value)
        {
            if (_value == value)
            {
                return;
            }

            _value = value;

            if (_mathExpressionChangedDelegate != null)
            {
                _mathExpressionChangedDelegate(_value, ChangedBy.SIM);
            }

            Transporter.getInstance().getModel().exposedValueChanged(this, new StringData(_value));
        }
コード例 #7
0
        public void setValue(T value)
        {
            if ((int)(object)_value == (int)(object)value)
            {
                return;
            }

            _value = value;

            if (_enumChangedDelegate != null)
            {
                _enumChangedDelegate(_value, ChangedBy.SIM);
            }

            Transporter.getInstance().getModel().exposedValueChanged(this, new StringData(_value.ToString()));
        }
コード例 #8
0
        public void setValue(bool value)
        {
            if (_value == value)
            {
                return;
            }

            _value = value;

            if (_booleanChangedDelegate != null)
            {
                _booleanChangedDelegate(_value, ChangedBy.SIM);
            }

            Transporter.getInstance().getModel().exposedValueChanged(this, new BoolData(_value));
        }
コード例 #9
0
        public override void expose(string name, bool isReadonly, bool isWriteonly)
        {
            if (_exposedName != null)
            {
                throw new Exception("Value has alread been exposed as: " + _exposedName);
            }

            if (name == null)
            {
                throw new Exception("Exposed name cannot be null!");
            }

            SimCapiValue simCapiValue = new SimCapiValue(name, SimCapiValueType.ARRAY_POINT, isReadonly, isWriteonly, false, new StringData(arrayToString()));
            bool         exposed      = Transporter.getInstance().getModel().exposeValue(this, simCapiValue);

            if (exposed == true)
            {
                _exposedName = name;
            }
        }
コード例 #10
0
        public void setData(string simId, string key, string value, SetDataRequestSuccessDelegate successDelegate)
        {
            bool success = ExternalCalls.setKeyPairSessionStorage(simId, key, value);

            SimCapiConsole.log("SimCapiLocalData set data: " + success.ToString());

            if (success == false)
            {
                return;
            }

            Message.SetDataResponse setDataResponse = new Message.SetDataResponse();
            setDataResponse.handshake    = Transporter.getInstance().getHandshake();
            setDataResponse.simId        = simId;
            setDataResponse.key          = key;
            setDataResponse.value        = value;
            setDataResponse.responseType = "success";

            if (success == true)
            {
                successDelegate(setDataResponse);
            }
        }