Esempio n. 1
0
		public BleConnectorInitData (string portName, Bytes service, bool debug, int portThreadSleep)
		{
			this.PortName = portName;
			this.ServiceUUID = service;
			this.Debug = debug;
			this.PortThreadSleep = portThreadSleep;
		}
		public void DeSerialize (Bytes bytes)
		{
			using (ByteDeserializer bd = new ByteDeserializer (bytes))
			{
				Event = bd.DeSerializeClassifierEvent ();

				switch (Event)
				{
				case ProtocolClassifierEvent.ArmSynced:
					{
						Arm = bd.DeSerializeArm ();
						Direction = bd.DeSerializeBraceletDirection ();
						break;
					}
				case ProtocolClassifierEvent.Pose:
					{
						Pose = bd.DeSerializePose ();
						break;
					}
				case ProtocolClassifierEvent.SyncFailed:
					{
						SyncResult = bd.DeSerializeSyncResult ();
						break;
					}
				}
			}
		}
Esempio n. 3
0
		public BleWriteAttribute (BleProtocol ble, SerialPort port, byte connection, ushort attributeHandle, Bytes value)
			: base (ble, port)
		{
			this.Connection = connection;
			this.AttributeHandle = attributeHandle;
			this.Value = value;
		}
Esempio n. 4
0
		public void DeSerialize (Bytes bytes)
		{
			using (ByteDeserializer bd = new ByteDeserializer (bytes))
			{
				EmgData = bd.DeSerializeBytes (EMG_DATA_SIZE);
			}
		}
Esempio n. 5
0
		public BlePeripheralService (Bytes UUID, ushort startHandle, ushort endHandle)
		{
			this.Attributes = new List<BlePeripheralAttribute> ();
			this.Characteristics = new List<BlePeripheralCharacteristic> ();

			this.ServiceUUID = UUID;
			this.StartHandle = startHandle;
			this.EndHandle = endHandle;
		}
Esempio n. 6
0
		public void DeSerialize (Bytes bytes)
		{
			using (ByteDeserializer bd = new ByteDeserializer (bytes))
			{
				Event = bd.DeSerializeMotionEvent ();
				TapDirection = bd.DeSerializeByte ();
				TapCount = bd.DeSerializeByte ();
			}
		}
Esempio n. 7
0
		public void DeSerialize (Bytes bytes)
		{
			using (ByteDeserializer bd = new ByteDeserializer (bytes))
			{
				// ORDER IS MANDATORY
				Major = bd.DeSerializeUshort ();
				Minor = bd.DeSerializeUshort ();
				Patch = bd.DeSerializeUshort ();
				HardwareRevision = bd.DeSerializeHardwareRevision ();
			}
		}
Esempio n. 8
0
		public void DeSerialize (Bytes bytes)
		{
			using (ByteDeserializer bd = new ByteDeserializer (bytes))
			{
				// ORDER IS MANDATORY
				OrientationW = bd.DeSerializeShort ();
				OrientationX = bd.DeSerializeShort ();
				OrientationY = bd.DeSerializeShort ();
				OrientationZ = bd.DeSerializeShort ();
				Accelerometer = bd.DeSerializeShorts (ACCELEROMETER_DATA_LENGTH);
				Gyroscope = bd.DeSerializeShorts (GYROSCOPE_DATA_LENGTH);
			}
		}
Esempio n. 9
0
		public void DeSerialize (Bytes bytes)
		{
			using (ByteDeserializer bd = new ByteDeserializer (bytes))
			{
				// ORDER IS MANDATORY
				SerialNumber = bd.DeSerializeBytes (SERIAL_NUMBER_LENGTH);
				UnlockPose = bd.DeSerializePose ();
				ActiveClassifierType = bd.DeSerializeClassifierModel ();
				ActiveClassifierIndex = bd.DeSerializeByte ();
				HasCustomClassifier = bd.DeSerializeBool ();
				StreamIndicating = bd.DeSerializeByte ();
				Sku = bd.DeSerializeSku ();
				Reserved = bd.DeSerializeBytes (RESERVED_LENGTH);
			}
		}
Esempio n. 10
0
		public Task Send(ArraySegment<byte> data, params object[] connectionIDs)
		{
			var bytes = new Bytes { value = data.Array, offset = data.Offset, length = data.Count };
			if (connectionIDs == null || connectionIDs.Length <= 0)
				_writer.write_untyped(bytes, ref InstanceHandle_t.HANDLE_NIL);
			else
			{
				for (int i = 0; i < connectionIDs.Length; i++)
				{
					var handle = connectionIDs[i] == null ? InstanceHandle_t.HANDLE_NIL : (InstanceHandle_t)connectionIDs[i];
					_writer.write_untyped(bytes, ref handle);
				}
			}
			return Task.FromResult(true);
		}
Esempio n. 11
0
		public override void on_data_available(DataReader reader)
		{
			var bytes = new Bytes();
			var info = new SampleInfo();

			reader.take_next_sample_untyped(bytes, info);

			if (bytes.value != null)
			{
				var args = new DataReceivedArgs
				{
					Data = new ArraySegment<byte>(bytes.value, bytes.offset, bytes.length),
					SessionID = info.instance_handle
				};
				Received.Invoke(this, args);
			}
		}
Esempio n. 12
0
 public int send(Bytes data, [DefaultParameterValue(0)] int flags) {
     byte[] buffer = data.GetUnsafeByteArray();
     try {
         return _socket.Send(buffer, (SocketFlags)flags);
     } catch (Exception e) {
         throw MakeException(_context, e);
     }
 }
Esempio n. 13
0
 public static Sha256Object sha256(Bytes data) {
     return new Sha256Object((IList<byte>)data);
 }
Esempio n. 14
0
 public void update(Bytes newBytes) {
     update((IList<byte>)newBytes);
 }
Esempio n. 15
0
		public void DeSerialize (Bytes bytes)
		{
			throw new InvalidOperationException ("DeSerialize is not possible for ~CommandType-s");
		}
Esempio n. 16
0
 public byte[] Any(Bytes request)
 {
     return Guid.Parse(request.Text).ToByteArray();
 }
Esempio n. 17
0
 private Bytes FinishBytesPlus(Bytes s) {
     Token t = PeekToken();
     while (true) {
         if (t is ConstantValueToken) {
             Bytes cvs;
             if ((cvs = t.Value as Bytes) != null) {
                 s = s + cvs;
                 NextToken();
                 t = PeekToken();
                 continue;
             } else {
                 ReportSyntaxError("invalid syntax");
             }
         }
         break;
     }
     return s;
 }
Esempio n. 18
0
            public _Array from_buffer_copy(Bytes array, [DefaultParameterValue(0)]int offset) {
                ValidateArraySizes(array, offset, ((INativeType)this).Size);

                _Array res = (_Array)CreateInstance(Context.SharedContext);
                res._memHolder = new MemoryHolder(((INativeType)this).Size);
                for (int i = 0; i < ((INativeType)this).Size; i++) {
                    res._memHolder.WriteByte(i, array._bytes[i]);
                }
                return res;
            }
Esempio n. 19
0
 public void update(Bytes newData) {
     update((IList<byte>)newData);
 }
Esempio n. 20
0
		public BlePeripheralCharacteristic FindCharacteristicByUUID (Bytes uuid)
		{
			return CharacteristicMap[uuid];
		}
Esempio n. 21
0
 public void VisitBytes(Bytes b)
 {
     throw new NotImplementedException();
 }
		public BlePeripheralCharacteristic (Bytes uuid, ushort handle)
		{
			this.AttributeUUID = uuid;
			this.Handle = handle;
		}
		public CharacteristicValueChangedEventArgs (Bytes uuid, Bytes value)
		{
			this.CharacteristicUUID = uuid;
			this.Value = value;
		}
Esempio n. 24
0
 public void sendall(Bytes data, [DefaultParameterValue(0)] int flags) {
     sendallWorker(data.GetUnsafeByteArray(), flags);
 }
Esempio n. 25
0
 public static MD5Type @new(Bytes data) {
     return new MD5Type((IList<byte>)data);
 }
Esempio n. 26
0
 public int sendto(Bytes data, int flags, PythonTuple address) {
     byte[] buffer = data.GetUnsafeByteArray();
     EndPoint remoteEP = TupleToEndPoint(_context, address, _socket.AddressFamily, out _hostName);
     try {
         return _socket.SendTo(buffer, (SocketFlags)flags, remoteEP);
     } catch (Exception e) {
         throw MakeException(_context, e);
     }
 }
Esempio n. 27
0
 public static byte[] GetBytes(Bytes bytes) {
     return bytes._bytes;
 }
Esempio n. 28
0
 public int sendto(Bytes data, PythonTuple address) {
     return sendto(data, 0, address);
 }
Esempio n. 29
0
 private static void ValidateArraySizes(Bytes bytes, int offset, int size) {
     ValidateArraySizes(bytes.Count, offset, size);
 }
Esempio n. 30
0
 public static sha @new(Bytes data) {
     return new sha((IList<byte>)data);
 }