BroadcastSm::BroadcastSm(const SequenceNumber &sequence_number, const ServiceType &service_type, const SmeAddress &source_addr, const MessageId &message_id, const PriorityFlag &priority_flag, const Time &schedule_delivery_time, const Time &validity_period, const ReplaceIfPresentFlag &replace_if_present_flag, const DataCoding &data_coding, const SmDefaultMsgId &sm_default_msg_id) : TlvsHeader(CommandLength(min_length), CommandId(CommandId::BroadcastSm), CommandStatus(CommandStatus::ESME_ROK), sequence_number), service_type(service_type), source_addr(source_addr), message_id(message_id), priority_flag(priority_flag), schedule_delivery_time(schedule_delivery_time), validity_period(validity_period), replace_if_present_flag(replace_if_present_flag), data_coding(data_coding), sm_default_msg_id(sm_default_msg_id) { Header::updateLength(service_type.length() + source_addr.getAddress().length() + message_id.length() + schedule_delivery_time.length() + validity_period.length()); }
DataSm::DataSm() : TlvsHeader(CommandLength(min_length), CommandId(CommandId::DataSm), CommandStatus(CommandStatus::ESME_ROK), SequenceNumber::Min) { }
/// @brief Default constructor. /// note Sets all values to their defaults. Smpp::EnquireLinkResp::EnquireLinkResp() : Response(CommandLength(MinLength), CommandId(CommandId::EnquireLinkResp), CommandStatus(CommandStatus::ESME_ROK), SequenceNumber::Min) { }
Unbind::Unbind() : Header(CommandLength(min_length), CommandId(CommandId::Unbind), CommandStatus(CommandStatus::ESME_ROK), SequenceNumber::Min) { }
CancelBroadcastSmResp::CancelBroadcastSmResp() : Header(CommandLength(min_length), CommandId(CommandId::CancelBroadcastSmResp), CommandStatus(CommandStatus::ESME_ROK), SequenceNumber::Min) { }
Unbind::Unbind(const SequenceNumber &sequence_number) : Header(CommandLength(min_length), CommandId(CommandId::Unbind), CommandStatus(CommandStatus::ESME_ROK), sequence_number) { }
//-------------------------------------------------------------------------------- PDU_bind_type_resp::PDU_bind_type_resp(uint32_t c) : SMPP_PDU(CommandLength(MinLength), CommandId (c), CommandStatus(CommandStatus::ESME_ROK), SequenceNumber::Min) { }
SubmitMultiResp::SubmitMultiResp() : TlvsHeader(CommandLength(min_length), CommandId(CommandId::SubmitMultiResp), CommandStatus(CommandStatus::ESME_ROK), SequenceNumber::Min) { }
/// @brief Construct from a buffer. /// @param b The buffer (octet array). Smpp::EnquireLinkResp::EnquireLinkResp(const Smpp::Uint8* b) : Response(CommandLength(MinLength), CommandId(CommandId::EnquireLinkResp), CommandStatus(CommandStatus::ESME_ROK), 1) { decode(b); }
DataSm::DataSm(const SequenceNumber &sequence_number, const ServiceType &service_type, const SmeAddress &source_addr, const SmeAddress &destination_addr, const EsmClass &esm_class, const RegisteredDelivery ®istered_delivery, const DataCoding &data_coding) : TlvsHeader(CommandLength(min_length), CommandId(CommandId::DataSm), CommandStatus(CommandStatus::ESME_ROK), sequence_number), service_type(service_type), source_addr(source_addr), destination_addr(destination_addr), esm_class(esm_class), registered_delivery(registered_delivery), data_coding(data_coding) { Header::updateLength(service_type.length() + source_addr.getAddress().length() + destination_addr.getAddress().length()); }
//-------------------------------------------------------------------------------- PDU_bind_type::PDU_bind_type() : SMPP_PDU(CommandLength(MinLength), CommandId (CommandId::BindReceiver), CommandStatus(CommandStatus::ESME_ROK), SequenceNumber::Min) {}
void LocalDeviceImpl::HandleEvent(struct hci_event_header* event) { /* printf("### Incoming event: len = %d\n", event->elen); for (int16 index = 0; index < event->elen + 2; index++) { printf("%x:", ((uint8*)event)[index]); } printf("### \n"); */ BMessage* request = NULL; int32 eventIndexLocation; // Check if it is a requested one switch (event->ecode) { case HCI_EVENT_CMD_COMPLETE: { struct hci_ev_cmd_complete* commandComplete = JumpEventHeader<struct hci_ev_cmd_complete>(event); TRACE_BT("LocalDeviceImpl: Incoming CommandComplete(%d) for %s\n", commandComplete->ncmd, BluetoothCommandOpcode(commandComplete->opcode)); request = FindPetition(event->ecode, commandComplete->opcode, &eventIndexLocation); if (request != NULL) CommandComplete(commandComplete, request, eventIndexLocation); break; } case HCI_EVENT_CMD_STATUS: { struct hci_ev_cmd_status* commandStatus = JumpEventHeader<struct hci_ev_cmd_status>(event); TRACE_BT("LocalDeviceImpl: Incoming CommandStatus(%d)(%s) for %s\n", commandStatus->ncmd, BluetoothError(commandStatus->status), BluetoothCommandOpcode(commandStatus->opcode)); request = FindPetition(event->ecode, commandStatus->opcode, &eventIndexLocation); if (request != NULL) CommandStatus(commandStatus, request, eventIndexLocation); break; } default: TRACE_BT("LocalDeviceImpl: Incoming %s event\n", BluetoothEvent(event->ecode)); request = FindPetition(event->ecode); if (request != NULL) HandleExpectedRequest(event, request); break; } if (request == NULL) { TRACE_BT("LocalDeviceImpl: Event %s could not be understood or delivered\n", BluetoothEvent(event->ecode)); HandleUnexpectedEvent(event); } }
//-------------------------------------------------------------------------------- PDU_data_sm_resp::PDU_data_sm_resp() : SMPP_PDU(CommandLength(MinLength), CommandId(CommandId::DataSmResp), CommandStatus(CommandStatus::ESME_ROK), SequenceNumber::Min) {}
BOOL handle_vendorcommand(BYTE cmd) { BYTE request_type = SETUPDAT[0]; BYTE subcommand = SETUPDAT[2]; BYTE command = SETUPDAT[3]; BOOL direction_in = (request_type & bmREQUESTTYPE_DIRECTION) == REQUESTTYPE_DIRECTION_IN; WORD data_length = ((WORD *) SETUPDAT)[3]; if (config != CONFIG_CONFIGURED || cmd != VENDOR_COMMAND || (request_type & (bmREQUESTTYPE_TYPE | bmREQUESTTYPE_RECIPIENT)) != (REQUESTTYPE_TYPE_VENDOR | REQUESTTYPE_RECIPIENT_DEVICE)) { return FALSE; } #if 0 /* Useful for debugging from host */ if (command == COMMAND_MEMORY) { __xdata BYTE * buf = EP0BUF; BYTE count = LSB(data_length); if (data_length > 64) return FALSE; switch (subcommand) { case COMMAND_MEMORY_INTERNAL: { __data BYTE *ram = (__data BYTE *) SETUPDAT[4]; if (SETUPDAT[5]) return FALSE; if (direction_in) { while (count--) { *buf++ = *ram++; } EP0BCH = SETUPDAT[7]; SYNCDELAY; EP0BCL = SETUPDAT[6]; SYNCDELAY; } else { while (count--) { *ram++ = *buf++; } } return TRUE; } case COMMAND_MEMORY_EXTERNAL: { __xdata BYTE *ram = (__xdata BYTE *) ((WORD *) SETUPDAT)[2]; if (direction_in) { while (count--) { *buf++ = *ram++; } EP0BCH = SETUPDAT[7]; SYNCDELAY; EP0BCL = SETUPDAT[6]; SYNCDELAY; } else { while (count--) { *ram++ = *buf++; } } return TRUE; } case COMMAND_MEMORY_CODE: { __code BYTE *ram = (__code BYTE *) ((WORD *) SETUPDAT)[2]; if (direction_in) { while (count--) { *buf++ = *ram++; } EP0BCH = SETUPDAT[7]; SYNCDELAY; EP0BCL = SETUPDAT[6]; SYNCDELAY; } else { return FALSE; } return TRUE; } default: return FALSE; } } #endif switch (fpga_configure_running) { case FALSE: switch (direction_in) { case FALSE: if (data_length) { return FALSE; } switch (command) { case COMMAND_FPGA: switch (subcommand) { case COMMAND_FPGA_CONFIGURE_START: FPGAConfigureStart(); fpga_configure_running = TRUE; break; default: return FALSE; } break; /* XXX: Would it be more appropriate to make these per-endpoint instead ? */ case COMMAND_STOP: CommandStop(); break; case COMMAND_PAUSE: CommandPause(subcommand); break; default: return FALSE; } break; case TRUE: switch (command) { case COMMAND_STATUS: if (data_length != 1) { return FALSE; } EP0BUF[0] = CommandStatus(); EP0BCH = 0x00; SYNCDELAY; EP0BCL = 0x01; SYNCDELAY; break; default: return FALSE; } break; } break; case TRUE: switch (direction_in) { case FALSE: switch (command) { case COMMAND_FPGA: switch (subcommand) { case COMMAND_FPGA_CONFIGURE_START: if (data_length) { return FALSE; } FPGAConfigureStart(); fpga_configure_running = TRUE; break; case COMMAND_FPGA_CONFIGURE_WRITE: if (!data_length) { return FALSE; } while (data_length) { BYTE received; EP0BCL = 0; /* arm endpoint */ while (EP01STAT & bmEP0BSY); received = EP0BCL; if (received > data_length || FPGAConfigureWrite(EP0BUF, received)) { return FALSE; } data_length -= received; } break; case COMMAND_FPGA_CONFIGURE_STOP: if (data_length) { return FALSE; } fpga_configure_running = FALSE; FPGAConfigureStop(); break; default: return FALSE; } break; default: return FALSE; } break; case TRUE: return FALSE; break; } break; } return TRUE; }
BindReceiverResp::BindReceiverResp() : TlvsHeader(CommandLength(min_length), CommandId(CommandId::BindReceiverResp), CommandStatus(CommandStatus::ESME_ROK), SequenceNumber::Min) { }