Пример #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"));
 }