コード例 #1
0
        /// <summary>
        /// Get all the settings and their current value
        /// </summary>
        public async Task <Vocabulary.Settings> GetCurrentValues()
        {
            // Create the message
            UserSettingsMessage SettMsg = new UserSettingsMessage(_token);

            // Get the codec
            UserSettingsMessageCodec UserSettCodec = new UserSettingsMessageCodec();

            // Send the message
            if (await Send(await UserSettCodec.Encode(SettMsg)))
            {
                // If sent, get the response
                string MsgReceived = await _CameraSocket.Receive();

                // Get the codec
                CamSettingsMessageCodec CamSettCodec = new CamSettingsMessageCodec();

                // Decode the string
                CamSettingsMessage CamSettMsg = await CamSettCodec.Decode(MsgReceived);

                if (CamSettMsg.rval != 0 || CamSettMsg.msg_id != SettMsg.msg_id)
                {
                    return(null);
                }
                return(CamSettMsg.param);
            }
            // If there is a problem
            return(null);
        }
コード例 #2
0
        public void CreateUserSettingsMessage()
        {
            UserSettingsMessage UserGetSettings = new UserSettingsMessage(token);

            Assert.AreEqual(UserGetSettings.token, token);
            Assert.AreEqual(UserGetSettings.msg_id, 3); //MUST be 3
        }