Nespresso coffee demo working on the Arch Pro
Dependencies: EthernetInterface mbed-rtos mbed nsdl rgb_sensor_buffer
Fork of mbed_nsdl by
Diff: resources/payload.h
- Revision:
- 6:8729a0db0e25
diff -r cb0df4fbe7a1 -r 8729a0db0e25 resources/payload.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resources/payload.h Fri Jul 18 10:47:23 2014 +0000 @@ -0,0 +1,49 @@ +/* + * Builds the payload to send to the server. + * + * Copyright (c) 2014 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _PAYLOAD_H +#define _PAYLOAD_H +#include "rgb_sensor.h" + +// TODO: include from common file +#ifndef RGB_VALUES +#define RGB_VALUES 512 +#endif + +class Payload +{ +public: + Payload(); + + void build(const TRGB *samples, int sample_count); + int raw_bytes_size(); + uint8_t* raw_bytes() const; + +private: + typedef struct + { + int sample_count; + int mean[3]; + signed char deltas[RGB_VALUES][3]; + } MeanDeltaBuffer; + + MeanDeltaBuffer m_mdb; + int m_mdb_bytes; +}; + +#endif // _PAYLOAD_H \ No newline at end of file