示例#1
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='name'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <Device> > GetDeviceByNameAsync(this ITelldusdeviceAPI operations, string name, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetDeviceByNameWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#2
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <string> GetConfigFileAsync(this ITelldusdeviceAPI operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetConfigFileWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#3
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Device> GetDeviceByIdAsync(this ITelldusdeviceAPI operations, int id, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetDeviceByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#4
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static IList <Device> GetAllDevices(this ITelldusdeviceAPI operations)
 {
     return(operations.GetAllDevicesAsync().GetAwaiter().GetResult());
 }
示例#5
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static string GetConfigFile(this ITelldusdeviceAPI operations)
 {
     return(operations.GetConfigFileAsync().GetAwaiter().GetResult());
 }
示例#6
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='config'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task StoreConfigAsync(this ITelldusdeviceAPI operations, ConfigFile config = default(ConfigFile), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.StoreConfigWithHttpMessagesAsync(config, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
示例#7
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='config'>
 /// </param>
 public static void StoreConfig(this ITelldusdeviceAPI operations, ConfigFile config = default(ConfigFile))
 {
     operations.StoreConfigAsync(config).GetAwaiter().GetResult();
 }
示例#8
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 public static Device GetDeviceById(this ITelldusdeviceAPI operations, int id)
 {
     return(operations.GetDeviceByIdAsync(id).GetAwaiter().GetResult());
 }
示例#9
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='name'>
 /// </param>
 public static IList <Device> GetDeviceByName(this ITelldusdeviceAPI operations, string name)
 {
     return(operations.GetDeviceByNameAsync(name).GetAwaiter().GetResult());
 }
示例#10
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='device'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task AddDeviceAsync(this ITelldusdeviceAPI operations, Device device = default(Device), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.AddDeviceWithHttpMessagesAsync(device, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
示例#11
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='device'>
 /// </param>
 public static void AddDevice(this ITelldusdeviceAPI operations, Device device = default(Device))
 {
     operations.AddDeviceAsync(device).GetAwaiter().GetResult();
 }
示例#12
0
 public TelldusService()
 {
     _api = new TelldusdeviceAPI(new Uri("http://localhost:5000"));
 }