Tags: ClearBlade/python-iot
Tags
Develop (#34) * ListDevicesRequest >> _prepare_params_for_list: (#16) modified to handle gatewayListOptions following NodeJS SDK * updated device class and enums (#19) * updated send_command function to base64 encode payload (#18) * Changed 'cloud_ack_time' to 'cloud_update_time' (#20) * Iot 918 conform to google format times binary data (#24) * 1. imports incl. google.api_core.datetime_helpers 2. Added logic to def from_json in class DeviceState and DeviceConfig to convert times to DateTimeWithNanoseconds and binaryData to bytes if env. vars set * 1. Changed Device.from_json to support GCP types for time, binaryData. 2. Changed DeviceState.from_json to handle blank binaryData 3. Changed DeviceConfig.from_json to handle blank binaryData * Removed extra 'import base64' * Added note about types of times, binaryData * Cleaned up formatting * Further cleanup * Added copyright info. at top of files * Not to 'pip install google-api-core' * Removed instructions for installing datetime_helpers module. Also now changed 'google.api_core' to 'proto' * Added "proto.datetime_helpers" to dependencies * Changed 'google.api_core' to 'proto.' * Removed call to set 'convert_binarydata_to_bytes' in Devices.from_json * Changed README to reflect decision on ONE env. var * Changed module to import to proto-plus * Two env. vars -> BINARYDATA_AND_TIME_GOOGLE_FORMAT * Removed a '.' * Format improvements for README * Added note about new env. var in 'Quick Start' sec * 'config', 'state' None? (i.e. not in fieldMask?) (#26) * 'config', 'state' None? (i.e. not in fieldMask?) * Added new @Property's to address DESK-2174 * Iot 994 add credential classes (#28) * Made PublicKeyFormat a child class of Enum * 1. import PublicKeyFormat from .resources 2. New dodict class for providing dot notation for dicts when read. 3. Call to dodict in credentials getter. 4. New functions for converting PublicKeyFormat to/from string. 5. Calls to PublicKeyFormat conversion functions. * Added note about how to run from source * Formatting * More formatting * Formatting * Formatting * Clearer info. on running from source * 1. Import PublicKeyCredential & DeviceCredential 2. Remove dotdict class. 3. Remove convertCredentialsFormatToString. 4. Set self._credentials=convertCredentialsFormatsToString(credentials) 5. Simplified Device class' credentials getter. 6. Changed Device class attr from 'credentials' to '_credentials' * Added code to _create_device_body to: 1. Convert DeviceCredential and PublicKeyCredential objects to dicts 2. Convert PublicKeyFormat class to string This is prior to creating device in registry. * Add PublicKeyCredential & DeviceCredential classes * Changed PublicKeyCredential constructor params: publicKeyFormat -> format publicKey -> key * 1. bug: DeviceCredential constructor calls PublicKeyCredential constructor where params were reversed. 2. Added classmethod convert_credentials_for_create_update. * 1. Removed unnecessary var from convertCredentialsFormatToString. 2. Calling convert_credentials_for_create_update in _prepare_params_body_for_update fcn * 1. Import DeviceCredential 2. Remove code for converting credentials from _create_device_body and call DeviceCredential.convert_credentials_for_create_update instead * 1. Removed the config and state conversion code from class Device. 2. In Device.from_json returned config as DeviceConfig.from_json() and state as DeviceState.from_json() 3. In DeviceState replace attr. self._update_time w/ self.updateTime and self._binary_data w/ self.binaryData 4. Added __getitem__ and get functions. * In classes PublicKeyCredential & DeviceCredential added function "get" which does the same thing as __getitem__ * Document changes from last version in UPGRADING.md * Turned ClearBlade and Google License info. into comments * Formatting changes * In 'convert_credentials_for_create_update' check for expirationTime. If it is datetime convert to ISO string * Formatting * Formatting * Formatting * Formatting * Formatting * Prefixed license info. * bug: if expirationTime type 'datetime', isoformat won't work: 'Z' suffix is left off and is needed by CB platform. Resolved by replacing isoformat with strftime. * bug: def get_value; if json_data None throws err (#30) * bug: def get_value; if json_data None throws err * In def convertCredentials... added check for None * Added name attribute to Device class. * Added code to populate the name attribute on the device object. --------- Co-authored-by: rajasd27 <[email protected]> Co-authored-by: Jim Bouquet <[email protected]>
Merging develop to main (#25) * ListDevicesRequest >> _prepare_params_for_list: (#16) modified to handle gatewayListOptions following NodeJS SDK * updated device class and enums (#19) * updated send_command function to base64 encode payload (#18) * Changed 'cloud_ack_time' to 'cloud_update_time' (#20) * Iot 918 conform to google format times binary data (#24) * 1. imports incl. google.api_core.datetime_helpers 2. Added logic to def from_json in class DeviceState and DeviceConfig to convert times to DateTimeWithNanoseconds and binaryData to bytes if env. vars set * 1. Changed Device.from_json to support GCP types for time, binaryData. 2. Changed DeviceState.from_json to handle blank binaryData 3. Changed DeviceConfig.from_json to handle blank binaryData * Removed extra 'import base64' * Added note about types of times, binaryData * Cleaned up formatting * Further cleanup * Added copyright info. at top of files * Not to 'pip install google-api-core' * Removed instructions for installing datetime_helpers module. Also now changed 'google.api_core' to 'proto' * Added "proto.datetime_helpers" to dependencies * Changed 'google.api_core' to 'proto.' * Removed call to set 'convert_binarydata_to_bytes' in Devices.from_json * Changed README to reflect decision on ONE env. var * Changed module to import to proto-plus * Two env. vars -> BINARYDATA_AND_TIME_GOOGLE_FORMAT * Removed a '.' * Format improvements for README * Added note about new env. var in 'Quick Start' sec --------- Co-authored-by: rajasd27 <[email protected]>
PreviousNext