示例#1
0
        //public static byte[] DeviceId
        //{
        //    get
        //    {
        //        OCUUIdentity identity = null;
        //        var result = OCStack.OCGetDeviceId(out identity);
        //        if (result != OCStackResult.OC_STACK_OK)
        //        {
        //            throw new Exception(result.ToString());
        //        }
        //        return identity.deviceId;
        //    }
        //    set
        //    {
        //        if (value == null || value.Length > 16)
        //        {
        //            throw new ArgumentException(nameof(value));
        //        }
        //        var result = OCStack.OCSetDeviceId(new OCUUIdentity() { deviceId = value });
        //        if (result != OCStackResult.OC_STACK_OK)
        //        {
        //            throw new Exception(result.ToString());
        //        }
        //    }
        //}

        /// <summary>
        /// This function sets device information.
        /// Upon call to OCInit, the default Device Type (i.e. "rt") has already been set to the default
        /// Device Type "oic.wk.d". You do not have to specify "oic.wk.d" in the OCDeviceInfo.types linked
        /// list. The default Device Type is mandatory and always specified by this Device as the first
        /// Device Type.
        /// </summary>
        public static void SetDeviceInfo(string deviceName, IEnumerable <string> types, string specVersion, IEnumerable <string> dataModelVersions)
        {
            IntPtr octypes             = OCStringLL.Create(types);
            IntPtr ocdataModelVersions = OCStringLL.Create(dataModelVersions);
            var    info = new OCDeviceInfo()
            {
                deviceName        = deviceName,
                types             = octypes,
                specVersion       = specVersion,
                dataModelVersions = ocdataModelVersions
            };
            var result = OCStack.OCSetDeviceInfo(info);

            OCStackException.ThrowIfError(result);
        }
示例#2
0
 public static extern OCStackResult OCSetDeviceInfo(OCDeviceInfo deviceInfo);